use of cn.taketoday.http.server.reactive.HttpHandler in project today-infrastructure by TAKETODAY.
the class UndertowReactiveWebServerFactoryTests method builderCustomizersShouldBeInvoked.
@Test
void builderCustomizersShouldBeInvoked() {
UndertowReactiveWebServerFactory factory = getFactory();
HttpHandler handler = mock(HttpHandler.class);
UndertowBuilderCustomizer[] customizers = new UndertowBuilderCustomizer[4];
Arrays.setAll(customizers, (i) -> mock(UndertowBuilderCustomizer.class));
factory.setBuilderCustomizers(Arrays.asList(customizers[0], customizers[1]));
factory.addBuilderCustomizers(customizers[2], customizers[3]);
this.webServer = factory.getWebServer(handler);
InOrder ordered = inOrder((Object[]) customizers);
for (UndertowBuilderCustomizer customizer : customizers) {
ordered.verify(customizer).customize(any(Undertow.Builder.class));
}
}
use of cn.taketoday.http.server.reactive.HttpHandler in project today-infrastructure by TAKETODAY.
the class AnnotationConfigReactiveWebServerApplicationContextTests method verifyContext.
private void verifyContext() {
MockReactiveWebServerFactory factory = this.context.getBean(MockReactiveWebServerFactory.class);
HttpHandler expectedHandler = this.context.getBean(HttpHandler.class);
HttpHandler actualHandler = factory.getWebServer().getHttpHandler();
if (actualHandler instanceof DelayedInitializationHttpHandler) {
actualHandler = ((DelayedInitializationHttpHandler) actualHandler).getHandler();
}
assertThat(actualHandler).isEqualTo(expectedHandler);
}
use of cn.taketoday.http.server.reactive.HttpHandler in project today-infrastructure by TAKETODAY.
the class TomcatReactiveWebServerFactoryTests method tomcatConnectorCustomizersShouldBeInvoked.
@Test
void tomcatConnectorCustomizersShouldBeInvoked() {
TomcatReactiveWebServerFactory factory = getFactory();
HttpHandler handler = mock(HttpHandler.class);
TomcatConnectorCustomizer[] customizers = new TomcatConnectorCustomizer[4];
Arrays.setAll(customizers, (i) -> mock(TomcatConnectorCustomizer.class));
factory.setTomcatConnectorCustomizers(Arrays.asList(customizers[0], customizers[1]));
factory.addConnectorCustomizers(customizers[2], customizers[3]);
this.webServer = factory.getWebServer(handler);
InOrder ordered = inOrder((Object[]) customizers);
for (TomcatConnectorCustomizer customizer : customizers) {
then(customizer).should(ordered).customize(any(Connector.class));
}
}
use of cn.taketoday.http.server.reactive.HttpHandler in project today-framework by TAKETODAY.
the class UndertowReactiveWebServerFactoryTests method builderCustomizersShouldBeInvoked.
@Test
void builderCustomizersShouldBeInvoked() {
UndertowReactiveWebServerFactory factory = getFactory();
HttpHandler handler = mock(HttpHandler.class);
UndertowBuilderCustomizer[] customizers = new UndertowBuilderCustomizer[4];
Arrays.setAll(customizers, (i) -> mock(UndertowBuilderCustomizer.class));
factory.setBuilderCustomizers(Arrays.asList(customizers[0], customizers[1]));
factory.addBuilderCustomizers(customizers[2], customizers[3]);
this.webServer = factory.getWebServer(handler);
InOrder ordered = inOrder((Object[]) customizers);
for (UndertowBuilderCustomizer customizer : customizers) {
ordered.verify(customizer).customize(any(Undertow.Builder.class));
}
}
use of cn.taketoday.http.server.reactive.HttpHandler in project today-framework by TAKETODAY.
the class TomcatReactiveWebServerFactoryTests method tomcatProtocolHandlerCustomizersShouldBeInvoked.
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
void tomcatProtocolHandlerCustomizersShouldBeInvoked() {
TomcatReactiveWebServerFactory factory = getFactory();
HttpHandler handler = mock(HttpHandler.class);
TomcatProtocolHandlerCustomizer<AbstractHttp11Protocol<?>>[] customizers = new TomcatProtocolHandlerCustomizer[4];
Arrays.setAll(customizers, (i) -> mock(TomcatProtocolHandlerCustomizer.class));
factory.setTomcatProtocolHandlerCustomizers(Arrays.asList(customizers[0], customizers[1]));
factory.addProtocolHandlerCustomizers(customizers[2], customizers[3]);
this.webServer = factory.getWebServer(handler);
InOrder ordered = inOrder((Object[]) customizers);
for (TomcatProtocolHandlerCustomizer customizer : customizers) {
then(customizer).should(ordered).customize(any(ProtocolHandler.class));
}
}
Aggregations