use of org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebServerFactory in project spring-boot by spring-projects.
the class UndertowWebServerFactoryCustomizerTests method boundSocketOption.
private <T> T boundSocketOption(Option<T> option) {
Builder builder = Undertow.builder();
ConfigurableUndertowWebServerFactory factory = mockFactory(builder);
this.customizer.customize(factory);
OptionMap map = ((OptionMap.Builder) ReflectionTestUtils.getField(builder, "socketOptions")).getMap();
return map.get(option);
}
use of org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebServerFactory in project spring-boot by spring-projects.
the class UndertowWebServerFactoryCustomizerTests method forwardHeadersWhenStrategyIsNativeShouldConfigureValve.
@Test
void forwardHeadersWhenStrategyIsNativeShouldConfigureValve() {
this.serverProperties.setForwardHeadersStrategy(ServerProperties.ForwardHeadersStrategy.NATIVE);
ConfigurableUndertowWebServerFactory factory = mock(ConfigurableUndertowWebServerFactory.class);
this.customizer.customize(factory);
then(factory).should().setUseForwardHeaders(true);
}
use of org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebServerFactory in project spring-boot by spring-projects.
the class UndertowWebServerFactoryCustomizerTests method boundServerOption.
private <T> T boundServerOption(Option<T> option) {
Builder builder = Undertow.builder();
ConfigurableUndertowWebServerFactory factory = mockFactory(builder);
this.customizer.customize(factory);
OptionMap map = ((OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions")).getMap();
return map.get(option);
}
use of org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebServerFactory in project spring-boot by spring-projects.
the class UndertowWebServerFactoryCustomizerTests method mockFactory.
private ConfigurableUndertowWebServerFactory mockFactory(Builder builder) {
ConfigurableUndertowWebServerFactory factory = mock(ConfigurableUndertowWebServerFactory.class);
willAnswer((invocation) -> {
Object argument = invocation.getArgument(0);
Arrays.stream((argument instanceof UndertowBuilderCustomizer) ? new UndertowBuilderCustomizer[] { (UndertowBuilderCustomizer) argument } : (UndertowBuilderCustomizer[]) argument).forEach((customizer) -> customizer.customize(builder));
return null;
}).given(factory).addBuilderCustomizers(any());
return factory;
}
use of org.springframework.boot.web.embedded.undertow.ConfigurableUndertowWebServerFactory in project spring-boot by spring-projects.
the class UndertowWebServerFactoryCustomizerTests method customizeUndertowAccessLog.
@Test
void customizeUndertowAccessLog() {
bind("server.undertow.accesslog.enabled=true", "server.undertow.accesslog.pattern=foo", "server.undertow.accesslog.prefix=test_log", "server.undertow.accesslog.suffix=txt", "server.undertow.accesslog.dir=test-logs", "server.undertow.accesslog.rotate=false");
ConfigurableUndertowWebServerFactory factory = mock(ConfigurableUndertowWebServerFactory.class);
this.customizer.customize(factory);
then(factory).should().setAccessLogEnabled(true);
then(factory).should().setAccessLogPattern("foo");
then(factory).should().setAccessLogPrefix("test_log");
then(factory).should().setAccessLogSuffix("txt");
then(factory).should().setAccessLogDirectory(new File("test-logs"));
then(factory).should().setAccessLogRotate(false);
}
Aggregations