|
|
|
@ -160,6 +160,40 @@ public class ServerPropertiesTests {
|
|
|
|
|
.isInstanceOf(AccessLogValve.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void tomcatAccessLogFileDateFormatByDefault() {
|
|
|
|
|
TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory();
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
map.put("server.tomcat.accesslog.enabled", "true");
|
|
|
|
|
bindProperties(map);
|
|
|
|
|
this.properties.customize(tomcatContainer);
|
|
|
|
|
assertThat(((AccessLogValve) tomcatContainer.getEngineValves().iterator().next())
|
|
|
|
|
.getFileDateFormat()).isEqualTo("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void tomcatAccessLogFileDateFormatCanBeRedefined() {
|
|
|
|
|
TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory();
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
map.put("server.tomcat.accesslog.enabled", "true");
|
|
|
|
|
map.put("server.tomcat.accesslog.file-date-format", "yyyy-MM-dd.HH");
|
|
|
|
|
bindProperties(map);
|
|
|
|
|
this.properties.customize(tomcatContainer);
|
|
|
|
|
assertThat(((AccessLogValve) tomcatContainer.getEngineValves().iterator().next())
|
|
|
|
|
.getFileDateFormat()).isEqualTo("yyyy-MM-dd.HH");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class)
|
|
|
|
|
public void tomcatAccessLogFileDateFormatWrongFormat() {
|
|
|
|
|
TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory();
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
map.put("server.tomcat.accesslog.enabled", "true");
|
|
|
|
|
map.put("server.tomcat.accesslog.file-date-format",
|
|
|
|
|
"this-is-obviously-a-wrong-format");
|
|
|
|
|
bindProperties(map);
|
|
|
|
|
this.properties.customize(tomcatContainer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void tomcatAccessLogIsBufferedByDefault() {
|
|
|
|
|
TomcatEmbeddedServletContainerFactory tomcatContainer = new TomcatEmbeddedServletContainerFactory();
|
|
|
|
|