|
32 | 32 | import org.apache.catalina.Context;
|
33 | 33 | import org.apache.catalina.Valve;
|
34 | 34 | import org.apache.catalina.valves.RemoteIpValve;
|
| 35 | +import org.apache.coyote.AbstractProtocol; |
35 | 36 | import org.junit.Before;
|
36 | 37 | import org.junit.Test;
|
37 | 38 | import org.mockito.ArgumentCaptor;
|
@@ -324,22 +325,6 @@ public void testCustomizeTomcatMinSpareThreads() throws Exception {
|
324 | 325 | assertThat(this.properties.getTomcat().getMinSpareThreads()).isEqualTo(10);
|
325 | 326 | }
|
326 | 327 |
|
327 |
| - @Test |
328 |
| - public void testCustomizeTomcatAcceptCount() throws Exception { |
329 |
| - Map<String, String> map = new HashMap<String, String>(); |
330 |
| - map.put("server.tomcat.accept-count", "10"); |
331 |
| - bindProperties(map); |
332 |
| - assertThat(this.properties.getTomcat().getAcceptCount()).isEqualTo(10); |
333 |
| - } |
334 |
| - |
335 |
| - @Test |
336 |
| - public void testCustomizeTomcatMaxConnections() throws Exception { |
337 |
| - Map<String, String> map = new HashMap<String, String>(); |
338 |
| - map.put("server.tomcat.max-connections", "5"); |
339 |
| - bindProperties(map); |
340 |
| - assertThat(this.properties.getTomcat().getMaxConnections()).isEqualTo(5); |
341 |
| - } |
342 |
| - |
343 | 328 | @Test
|
344 | 329 | public void customizeTomcatDisplayName() throws Exception {
|
345 | 330 | Map<String, String> map = new HashMap<String, String>();
|
@@ -451,6 +436,34 @@ public void customTomcatRemoteIpValve() throws Exception {
|
451 | 436 | assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1");
|
452 | 437 | }
|
453 | 438 |
|
| 439 | + @Test |
| 440 | + public void customTomcatAcceptCount() { |
| 441 | + Map<String, String> map = new HashMap<String, String>(); |
| 442 | + map.put("server.tomcat.accept-count", "10"); |
| 443 | + bindProperties(map); |
| 444 | + |
| 445 | + TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(); |
| 446 | + this.properties.customize(container); |
| 447 | + TomcatEmbeddedServletContainer embeddedContainer = |
| 448 | + (TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer(); |
| 449 | + assertThat(((AbstractProtocol) embeddedContainer.getTomcat().getConnector() |
| 450 | + .getProtocolHandler()).getBacklog()).isEqualTo(10); |
| 451 | + } |
| 452 | + |
| 453 | + @Test |
| 454 | + public void customTomcatMaxConnections() { |
| 455 | + Map<String, String> map = new HashMap<String, String>(); |
| 456 | + map.put("server.tomcat.max-connections", "5"); |
| 457 | + bindProperties(map); |
| 458 | + |
| 459 | + TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(); |
| 460 | + this.properties.customize(container); |
| 461 | + TomcatEmbeddedServletContainer embeddedContainer = |
| 462 | + (TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer(); |
| 463 | + assertThat(((AbstractProtocol) embeddedContainer.getTomcat().getConnector() |
| 464 | + .getProtocolHandler()).getMaxConnections()).isEqualTo(5); |
| 465 | + } |
| 466 | + |
454 | 467 | @Test
|
455 | 468 | public void defaultUseForwardHeadersUndertow() throws Exception {
|
456 | 469 | UndertowEmbeddedServletContainerFactory container = spy(
|
|
0 commit comments