use of org.springframework.boot.web.embedded.tomcat.TomcatWebServer in project spring-boot by spring-projects.
the class LocalDevToolsAutoConfigurationTests method devToolsSwitchesJspServletToDevelopmentMode.
@Test
public void devToolsSwitchesJspServletToDevelopmentMode() {
this.context = initializeAndRun(Config.class);
TomcatWebServer tomcatContainer = (TomcatWebServer) ((ServletWebServerApplicationContext) this.context).getWebServer();
Container context = tomcatContainer.getTomcat().getHost().findChildren()[0];
StandardWrapper jspServletWrapper = (StandardWrapper) context.findChild("jsp");
EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils.getField(jspServletWrapper.getServlet(), "options");
assertThat(options.getDevelopment()).isEqualTo(true);
}
use of org.springframework.boot.web.embedded.tomcat.TomcatWebServer in project spring-boot by spring-projects.
the class TomcatLegacyCookieProcessorExampleTests method cookieProcessorIsCustomized.
@Test
public void cookieProcessorIsCustomized() {
ServletWebServerApplicationContext applicationContext = (ServletWebServerApplicationContext) new SpringApplication(TestConfiguration.class, LegacyCookieProcessorConfiguration.class).run();
Context context = (Context) ((TomcatWebServer) applicationContext.getWebServer()).getTomcat().getHost().findChildren()[0];
assertThat(context.getCookieProcessor()).isInstanceOf(LegacyCookieProcessor.class);
}
use of org.springframework.boot.web.embedded.tomcat.TomcatWebServer in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method customTomcatBackgroundProcessorDelay.
@Test
public void customTomcatBackgroundProcessorDelay() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("server.tomcat.background-processor-delay", "5");
bindProperties(map);
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
this.customizer.customize(factory);
assertThat(((TomcatWebServer) factory.getWebServer()).getTomcat().getEngine().getBackgroundProcessorDelay()).isEqualTo(5);
}
use of org.springframework.boot.web.embedded.tomcat.TomcatWebServer in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method defaultTomcatBackgroundProcessorDelay.
@Test
public void defaultTomcatBackgroundProcessorDelay() throws Exception {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
this.customizer.customize(factory);
assertThat(((TomcatWebServer) factory.getWebServer()).getTomcat().getEngine().getBackgroundProcessorDelay()).isEqualTo(30);
}
use of org.springframework.boot.web.embedded.tomcat.TomcatWebServer in project spring-boot by spring-projects.
the class SampleTomcatApplicationTests method testTimeout.
@Test
public void testTimeout() throws Exception {
ServletWebServerApplicationContext context = (ServletWebServerApplicationContext) this.applicationContext;
TomcatWebServer embeddedServletContainer = (TomcatWebServer) context.getWebServer();
ProtocolHandler protocolHandler = embeddedServletContainer.getTomcat().getConnector().getProtocolHandler();
int timeout = ((AbstractProtocol<?>) protocolHandler).getConnectionTimeout();
assertThat(timeout).isEqualTo(5000);
}
Aggregations