|
|
|
@ -486,39 +486,60 @@ public class ServerPropertiesTests {
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
map.put("server.tomcat.accept-count", "10");
|
|
|
|
|
bindProperties(map);
|
|
|
|
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
|
|
|
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(
|
|
|
|
|
0);
|
|
|
|
|
this.properties.customize(container);
|
|
|
|
|
TomcatEmbeddedServletContainer embeddedContainer = (TomcatEmbeddedServletContainer) container
|
|
|
|
|
.getEmbeddedServletContainer();
|
|
|
|
|
embeddedContainer.start();
|
|
|
|
|
try {
|
|
|
|
|
assertThat(((AbstractProtocol<?>) embeddedContainer.getTomcat().getConnector()
|
|
|
|
|
.getProtocolHandler()).getBacklog()).isEqualTo(10);
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
embeddedContainer.stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void customTomcatMaxConnections() {
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
map.put("server.tomcat.max-connections", "5");
|
|
|
|
|
bindProperties(map);
|
|
|
|
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
|
|
|
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(
|
|
|
|
|
0);
|
|
|
|
|
this.properties.customize(container);
|
|
|
|
|
TomcatEmbeddedServletContainer embeddedContainer = (TomcatEmbeddedServletContainer) container
|
|
|
|
|
.getEmbeddedServletContainer();
|
|
|
|
|
embeddedContainer.start();
|
|
|
|
|
try {
|
|
|
|
|
assertThat(((AbstractProtocol<?>) embeddedContainer.getTomcat().getConnector()
|
|
|
|
|
.getProtocolHandler()).getMaxConnections()).isEqualTo(5);
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
embeddedContainer.stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void customTomcatMaxHttpPostSize() {
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
map.put("server.tomcat.max-http-post-size", "10000");
|
|
|
|
|
bindProperties(map);
|
|
|
|
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory();
|
|
|
|
|
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(
|
|
|
|
|
0);
|
|
|
|
|
this.properties.customize(container);
|
|
|
|
|
TomcatEmbeddedServletContainer embeddedContainer = (TomcatEmbeddedServletContainer) container
|
|
|
|
|
.getEmbeddedServletContainer();
|
|
|
|
|
embeddedContainer.start();
|
|
|
|
|
try {
|
|
|
|
|
assertThat(embeddedContainer.getTomcat().getConnector().getMaxPostSize())
|
|
|
|
|
.isEqualTo(10000);
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
embeddedContainer.stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void customizeUndertowAccessLog() {
|
|
|
|
|