use of org.springframework.web.testfixture.http.server.reactive.bootstrap.UndertowHttpServer in project spring-framework by spring-projects.
the class ZeroCopyIntegrationTests method zeroCopy.
@ParameterizedHttpServerTest
void zeroCopy(HttpServer httpServer) throws Exception {
assumeTrue(httpServer instanceof ReactorHttpServer || httpServer instanceof UndertowHttpServer, "Zero-copy does not support Servlet");
startServer(httpServer);
URI url = new URI("http://localhost:" + port);
RequestEntity<?> request = RequestEntity.get(url).build();
ResponseEntity<byte[]> response = new RestTemplate().exchange(request, byte[].class);
assertThat(response.hasBody()).isTrue();
assertThat(response.getHeaders().getContentLength()).isEqualTo(springLogoResource.contentLength());
assertThat(response.getBody().length).isEqualTo(springLogoResource.contentLength());
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaType.IMAGE_PNG);
}
use of org.springframework.web.testfixture.http.server.reactive.bootstrap.UndertowHttpServer in project spring-framework by spring-projects.
the class AbstractWebSocketIntegrationTests method arguments.
static Stream<Object[]> arguments() throws IOException {
WebSocketClient[] clients = new WebSocketClient[] { new TomcatWebSocketClient(), new JettyWebSocketClient(), new ReactorNettyWebSocketClient(), new UndertowWebSocketClient(Xnio.getInstance().createWorker(OptionMap.EMPTY)) };
Map<HttpServer, Class<?>> servers = new LinkedHashMap<>();
servers.put(new TomcatHttpServer(TMP_DIR.getAbsolutePath(), WsContextListener.class), TomcatConfig.class);
servers.put(new JettyHttpServer(), JettyConfig.class);
servers.put(new ReactorHttpServer(), ReactorNettyConfig.class);
servers.put(new UndertowHttpServer(), UndertowConfig.class);
// Try each client once against each server..
Flux<WebSocketClient> f1 = Flux.fromArray(clients).concatMap(c -> Mono.just(c).repeat(servers.size() - 1));
Flux<Map.Entry<HttpServer, Class<?>>> f2 = Flux.fromIterable(servers.entrySet()).repeat(clients.length - 1).share();
return Flux.zip(f1, f2.map(Map.Entry::getKey), f2.map(Map.Entry::getValue)).map(Tuple3::toArray).toStream();
}
use of org.springframework.web.testfixture.http.server.reactive.bootstrap.UndertowHttpServer in project spring-framework by spring-projects.
the class MultipartIntegrationTests method transferTo.
@ParameterizedHttpServerTest
void transferTo(HttpServer httpServer) throws Exception {
// TODO Determine why Undertow fails: https://github.com/spring-projects/spring-framework/issues/25310
assumeFalse(httpServer instanceof UndertowHttpServer, "Undertow currently fails with transferTo");
startServer(httpServer);
Flux<String> result = webClient.post().uri("/transferTo").bodyValue(generateBody()).retrieve().bodyToFlux(String.class);
StepVerifier.create(result).consumeNextWith(filename -> verifyContents(Paths.get(filename), new ClassPathResource("foo.txt", MultipartHttpMessageReader.class))).consumeNextWith(filename -> verifyContents(Paths.get(filename), new ClassPathResource("logo.png", getClass()))).verifyComplete();
}
Aggregations