|
40 | 40 | import org.apache.coyote.AbstractProtocol;
|
41 | 41 | import org.eclipse.jetty.server.HttpChannel;
|
42 | 42 | import org.eclipse.jetty.server.Request;
|
| 43 | +import org.eclipse.jetty.server.Server; |
| 44 | +import org.eclipse.jetty.util.thread.ThreadPool; |
43 | 45 | import org.junit.jupiter.api.Test;
|
44 | 46 |
|
45 | 47 | import org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.Accesslog;
|
|
55 | 57 | import org.springframework.http.HttpHeaders;
|
56 | 58 | import org.springframework.http.MediaType;
|
57 | 59 | import org.springframework.http.client.ClientHttpResponse;
|
| 60 | +import org.springframework.test.util.ReflectionTestUtils; |
58 | 61 | import org.springframework.util.LinkedMultiValueMap;
|
59 | 62 | import org.springframework.util.MultiValueMap;
|
60 | 63 | import org.springframework.util.unit.DataSize;
|
@@ -450,6 +453,20 @@ void tomcatUseRelativeRedirectsDefaultsToFalse() {
|
450 | 453 | assertThat(this.properties.getTomcat().getUseRelativeRedirects()).isFalse();
|
451 | 454 | }
|
452 | 455 |
|
| 456 | + @Test |
| 457 | + void jettyThreadPoolPropertyDefaultsShouldMatchServerDefault() { |
| 458 | + JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0); |
| 459 | + JettyWebServer jetty = (JettyWebServer) jettyFactory.getWebServer(); |
| 460 | + Server server = (Server) ReflectionTestUtils.getField(jetty, "server"); |
| 461 | + ThreadPool threadPool = (ThreadPool) ReflectionTestUtils.getField(server, "_threadPool"); |
| 462 | + int idleTimeout = (int) ReflectionTestUtils.getField(threadPool, "_idleTimeout"); |
| 463 | + int maxThreads = (int) ReflectionTestUtils.getField(threadPool, "_maxThreads"); |
| 464 | + int minThreads = (int) ReflectionTestUtils.getField(threadPool, "_minThreads"); |
| 465 | + assertThat(this.properties.getJetty().getThreads().getIdleTimeout().toMillis()).isEqualTo(idleTimeout); |
| 466 | + assertThat(this.properties.getJetty().getThreads().getMax()).isEqualTo(maxThreads); |
| 467 | + assertThat(this.properties.getJetty().getThreads().getMin()).isEqualTo(minThreads); |
| 468 | + } |
| 469 | + |
453 | 470 | @Test
|
454 | 471 | void jettyMaxHttpFormPostSizeMatchesDefault() throws Exception {
|
455 | 472 | JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0);
|
|
0 commit comments