use of org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFactory in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method tomcatProtocolHandlerCustomizerBeanIsAddedToFactory.
@Test
void tomcatProtocolHandlerCustomizerBeanIsAddedToFactory() {
ReactiveWebApplicationContextRunner runner = new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withUserConfiguration(HttpHandlerConfiguration.class, TomcatProtocolHandlerCustomizerConfiguration.class).withPropertyValues("server.port: 0");
runner.run((context) -> {
TomcatReactiveWebServerFactory factory = context.getBean(TomcatReactiveWebServerFactory.class);
TomcatProtocolHandlerCustomizer<?> customizer = context.getBean("protocolHandlerCustomizer", TomcatProtocolHandlerCustomizer.class);
assertThat(factory.getTomcatProtocolHandlerCustomizers()).contains(customizer);
then(customizer).should().customize(any());
});
}
use of org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFactory in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method tomcatContextCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce.
@Test
void tomcatContextCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce() {
ReactiveWebApplicationContextRunner runner = new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withUserConfiguration(HttpHandlerConfiguration.class, DoubleRegistrationTomcatContextCustomizerConfiguration.class).withPropertyValues("server.port: 0");
runner.run((context) -> {
TomcatReactiveWebServerFactory factory = context.getBean(TomcatReactiveWebServerFactory.class);
TomcatContextCustomizer customizer = context.getBean("contextCustomizer", TomcatContextCustomizer.class);
assertThat(factory.getTomcatContextCustomizers()).contains(customizer);
then(customizer).should().customize(any(Context.class));
});
}
use of org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFactory in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method tomcatConnectorCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce.
@Test
void tomcatConnectorCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce() {
ReactiveWebApplicationContextRunner runner = new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withUserConfiguration(HttpHandlerConfiguration.class, DoubleRegistrationTomcatConnectorCustomizerConfiguration.class).withPropertyValues("server.port: 0");
runner.run((context) -> {
TomcatReactiveWebServerFactory factory = context.getBean(TomcatReactiveWebServerFactory.class);
TomcatConnectorCustomizer customizer = context.getBean("connectorCustomizer", TomcatConnectorCustomizer.class);
assertThat(factory.getTomcatConnectorCustomizers()).contains(customizer);
then(customizer).should().customize(any(Connector.class));
});
}
use of org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFactory in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method tomcatConnectorCustomizerBeanIsAddedToFactory.
@Test
void tomcatConnectorCustomizerBeanIsAddedToFactory() {
ReactiveWebApplicationContextRunner runner = new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withUserConfiguration(HttpHandlerConfiguration.class, TomcatConnectorCustomizerConfiguration.class).withPropertyValues("server.port: 0");
runner.run((context) -> {
TomcatReactiveWebServerFactory factory = context.getBean(TomcatReactiveWebServerFactory.class);
TomcatConnectorCustomizer customizer = context.getBean("connectorCustomizer", TomcatConnectorCustomizer.class);
assertThat(factory.getTomcatConnectorCustomizers()).contains(customizer);
then(customizer).should().customize(any(Connector.class));
});
}
use of org.springframework.boot.web.embedded.tomcat.TomcatReactiveWebServerFactory in project spring-boot by spring-projects.
the class ReactiveWebServerFactoryAutoConfigurationTests method tomcatProtocolHandlerCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce.
@Test
void tomcatProtocolHandlerCustomizerRegisteredAsBeanAndViaFactoryIsOnlyCalledOnce() {
ReactiveWebApplicationContextRunner runner = new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(ReactiveWebServerFactoryAutoConfiguration.class)).withUserConfiguration(HttpHandlerConfiguration.class, DoubleRegistrationTomcatProtocolHandlerCustomizerConfiguration.class).withPropertyValues("server.port: 0");
runner.run((context) -> {
TomcatReactiveWebServerFactory factory = context.getBean(TomcatReactiveWebServerFactory.class);
TomcatProtocolHandlerCustomizer<?> customizer = context.getBean("protocolHandlerCustomizer", TomcatProtocolHandlerCustomizer.class);
assertThat(factory.getTomcatProtocolHandlerCustomizers()).contains(customizer);
then(customizer).should().customize(any());
});
}
Aggregations