summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-10-30 01:38:54 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-10-30 01:38:54 +0200
commitf76debed18af4dfc5802e4480f74344567341dea (patch)
tree0650c35cdea2f819f6c9f6c0acb81f0baf57196b /config-model
parent0dd0cda7d8449708aa8347c01475583d5326a20e (diff)
Test json log configuring
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java37
1 files changed, 27 insertions, 10 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java
index 99f4387c140..520c2d6248b 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessLogTest.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.model.container.xml;
import com.yahoo.component.ComponentId;
import com.yahoo.config.model.builder.xml.test.DomBuilderTest;
import com.yahoo.container.core.AccessLogConfig;
+import com.yahoo.container.logging.JSONAccessLog;
import com.yahoo.container.logging.VespaAccessLog;
import com.yahoo.container.logging.YApacheAccessLog;
import com.yahoo.vespa.model.container.ContainerCluster;
@@ -12,10 +13,9 @@ import org.junit.Test;
import org.w3c.dom.Element;
import static com.yahoo.text.StringUtilities.quote;
-import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertEquals;
/**
* @author gjoranv
@@ -70,20 +70,37 @@ public class AccessLogTest extends ContainerModelBuilderTestBase {
" <accesslog type='yapache' ",
" fileNamePattern='pattern' rotationInterval='interval'",
" rotationScheme='date' />",
+ " <accesslog type='json' ",
+ " fileNamePattern='pattern' rotationInterval='interval'",
+ " rotationScheme='date' />",
nodesXml,
"</jdisc>" );
createModel(root, clusterElem);
- Component<?, ?> accessLogComponent = getContainerComponent("default", YApacheAccessLog.class.getName());
- assertNotNull(accessLogComponent);
- assertThat(accessLogComponent.getClassId().getName(), is(YApacheAccessLog.class.getName()));
+ { // yapache
+ Component<?, ?> accessLogComponent = getContainerComponent("default", YApacheAccessLog.class.getName());
+ assertNotNull(accessLogComponent);
+ assertEquals(YApacheAccessLog.class.getName(), accessLogComponent.getClassId().getName(), YApacheAccessLog.class.getName());
+ AccessLogConfig config = root.getConfig(AccessLogConfig.class, "default/component/com.yahoo.container.logging.YApacheAccessLog");
+ AccessLogConfig.FileHandler fileHandlerConfig = config.fileHandler();
+ assertEquals("pattern", fileHandlerConfig.pattern());
+ assertEquals("interval", fileHandlerConfig.rotation());
+ assertEquals(AccessLogConfig.FileHandler.RotateScheme.DATE, fileHandlerConfig.rotateScheme());
+ }
+
+ { // json
+ Component<?, ?> accessLogComponent = getContainerComponent("default", JSONAccessLog.class.getName());
+ assertNotNull(accessLogComponent);
+ assertEquals(JSONAccessLog.class.getName(), accessLogComponent.getClassId().getName(), JSONAccessLog.class.getName());
+ AccessLogConfig config = root.getConfig(AccessLogConfig.class, "default/component/com.yahoo.container.logging.JSONAccessLog");
+ AccessLogConfig.FileHandler fileHandlerConfig = config.fileHandler();
+ assertEquals("pattern", fileHandlerConfig.pattern());
+ assertEquals("interval", fileHandlerConfig.rotation());
+ assertEquals(AccessLogConfig.FileHandler.RotateScheme.DATE, fileHandlerConfig.rotateScheme());
+ }
+
- AccessLogConfig config = root.getConfig(AccessLogConfig.class, "default/component/com.yahoo.container.logging.YApacheAccessLog");
- AccessLogConfig.FileHandler fileHandlerConfig = config.fileHandler();
- assertThat(fileHandlerConfig.pattern(), is("pattern"));
- assertThat(fileHandlerConfig.rotation(), is("interval"));
- assertThat(fileHandlerConfig.rotateScheme(), is(AccessLogConfig.FileHandler.RotateScheme.DATE));
}