use of org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext in project spring-boot by spring-projects.
the class ReactiveWebServerAutoConfigurationTests method createFromConfigClass.
@Test
public void createFromConfigClass() {
this.context = new ReactiveWebServerApplicationContext(BaseConfiguration.class);
assertThat(this.context.getBeansOfType(ReactiveWebServerFactory.class)).hasSize(1);
assertThat(this.context.getBeansOfType(WebServerFactoryCustomizer.class)).hasSize(1);
assertThat(this.context.getBeansOfType(DefaultReactiveWebServerCustomizer.class)).hasSize(1);
}
use of org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext in project spring-boot by spring-projects.
the class ReactiveWebServerAutoConfigurationTests method missingHttpHandler.
@Test
public void missingHttpHandler() {
this.thrown.expect(ApplicationContextException.class);
this.thrown.expectMessage(Matchers.containsString("missing HttpHandler bean"));
this.context = new ReactiveWebServerApplicationContext(MissingHttpHandlerConfiguration.class);
}
use of org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext in project spring-boot by spring-projects.
the class ReactiveWebServerAutoConfigurationTests method customizeReactiveWebServer.
@Test
public void customizeReactiveWebServer() {
this.context = new ReactiveWebServerApplicationContext(BaseConfiguration.class, ReactiveWebServerCustomization.class);
MockReactiveWebServerFactory factory = this.context.getBean(MockReactiveWebServerFactory.class);
assertThat(factory.getPort()).isEqualTo(9000);
}
use of org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext in project spring-boot by spring-projects.
the class RSocketWebSocketNettyRouteProviderTests method webEndpointsShouldWork.
@Test
void webEndpointsShouldWork() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new).withConfiguration(AutoConfigurations.of(HttpHandlerAutoConfiguration.class, WebFluxAutoConfiguration.class, ErrorWebFluxAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, JacksonAutoConfiguration.class, CodecsAutoConfiguration.class, RSocketStrategiesAutoConfiguration.class, RSocketServerAutoConfiguration.class, RSocketMessagingAutoConfiguration.class, RSocketRequesterAutoConfiguration.class)).withUserConfiguration(WebConfiguration.class).withPropertyValues("spring.rsocket.server.transport=websocket", "spring.rsocket.server.mapping-path=/rsocket").run((context) -> {
ReactiveWebServerApplicationContext serverContext = (ReactiveWebServerApplicationContext) context.getSourceApplicationContext();
RSocketRequester requester = createRSocketRequester(context, serverContext.getWebServer());
TestProtocol rsocketResponse = requester.route("websocket").data(new TestProtocol("rsocket")).retrieveMono(TestProtocol.class).block(Duration.ofSeconds(3));
assertThat(rsocketResponse.getName()).isEqualTo("rsocket");
WebTestClient client = createWebTestClient(serverContext.getWebServer());
client.get().uri("/protocol").exchange().expectStatus().isOk().expectBody().jsonPath("name", "http");
});
}
use of org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext in project spring-boot by spring-projects.
the class ReactiveWebServerAutoConfigurationTests method multipleHttpHandler.
@Test
public void multipleHttpHandler() {
this.thrown.expect(ApplicationContextException.class);
this.thrown.expectMessage(Matchers.containsString("multiple HttpHandler beans : httpHandler,additionalHttpHandler"));
this.context = new ReactiveWebServerApplicationContext(BaseConfiguration.class, TooManyHttpHandlers.class);
}
Aggregations