|
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;
|
@@ -354,6 +357,20 @@ void tomcatUseRelativeRedirectsDefaultsToFalse() {
|
354 | 357 | assertThat(this.properties.getTomcat().getUseRelativeRedirects()).isFalse();
|
355 | 358 | }
|
356 | 359 |
|
| 360 | + @Test |
| 361 | + void jettyThreadPoolPropertyDefaultsShouldMatchServerDefault() { |
| 362 | + JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0); |
| 363 | + JettyWebServer jetty = (JettyWebServer) jettyFactory.getWebServer(); |
| 364 | + Server server = (Server) ReflectionTestUtils.getField(jetty, "server"); |
| 365 | + ThreadPool threadPool = (ThreadPool) ReflectionTestUtils.getField(server, "_threadPool"); |
| 366 | + int idleTimeout = (int) ReflectionTestUtils.getField(threadPool, "_idleTimeout"); |
| 367 | + int maxThreads = (int) ReflectionTestUtils.getField(threadPool, "_maxThreads"); |
| 368 | + int minThreads = (int) ReflectionTestUtils.getField(threadPool, "_minThreads"); |
| 369 | + assertThat(this.properties.getJetty().getThreadIdleTimeout().toMillis()).isEqualTo(idleTimeout); |
| 370 | + assertThat(this.properties.getJetty().getMaxThreads()).isEqualTo(maxThreads); |
| 371 | + assertThat(this.properties.getJetty().getMinThreads()).isEqualTo(minThreads); |
| 372 | + } |
| 373 | + |
357 | 374 | @Test
|
358 | 375 | void jettyMaxHttpFormPostSizeMatchesDefault() throws Exception {
|
359 | 376 | JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0);
|
|
0 commit comments