|
6 | 6 | package io.opentelemetry.javaagent.instrumentation.spring.webflux.v5_0.server.base; |
7 | 7 |
|
8 | 8 | import io.opentelemetry.instrumentation.spring.webflux.server.AbstractImmediateHandlerSpringWebFluxServerTest; |
| 9 | +import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint; |
| 10 | +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
| 11 | +import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; |
| 12 | +import org.springframework.context.annotation.Bean; |
| 13 | +import org.springframework.context.annotation.Configuration; |
| 14 | +import org.springframework.web.reactive.function.server.RouterFunction; |
| 15 | +import org.springframework.web.reactive.function.server.ServerResponse; |
| 16 | +import reactor.core.publisher.Mono; |
9 | 17 |
|
10 | 18 | class ImmediateHandlerSpringWebFluxServerTest |
11 | 19 | extends AbstractImmediateHandlerSpringWebFluxServerTest { |
12 | | - // @Override |
13 | | - // protected Class<?> getApplicationClass() { |
14 | | - // return Application.class; |
15 | | - // } |
16 | | - // |
17 | | - // @Configuration |
18 | | - // @EnableAutoConfiguration |
19 | | - // static class Application { |
20 | | - // @Bean |
21 | | - // RouterFunction<ServerResponse> router() { |
22 | | - // return new RouteFactory().createRoutes(); |
23 | | - // } |
24 | | - // |
25 | | - // @Bean |
26 | | - // NettyReactiveWebServerFactory nettyFactory() { |
27 | | - // return new NettyReactiveWebServerFactory(); |
28 | | - // } |
29 | | - // } |
30 | | - // |
31 | | - // static class RouteFactory extends ServerTestRouteFactory { |
32 | | - // |
33 | | - // @Override |
34 | | - // protected Mono<ServerResponse> wrapResponse( |
35 | | - // ServerEndpoint endpoint, Mono<ServerResponse> response, Runnable spanAction) { |
36 | | - // return controller( |
37 | | - // endpoint, |
38 | | - // () -> { |
39 | | - // spanAction.run(); |
40 | | - // return response; |
41 | | - // }); |
42 | | - // } |
43 | | - // } |
44 | | - // |
45 | | - // @Test |
46 | | - // void nestedPath() { |
47 | | - // assumeTrue(Boolean.getBoolean("testLatestDeps")); |
48 | | - // |
49 | | - // String method = "GET"; |
50 | | - // AggregatedHttpRequest request = request(NESTED_PATH, method); |
51 | | - // AggregatedHttpResponse response = client.execute(request).aggregate().join(); |
52 | | - // assertThat(response.status().code()).isEqualTo(NESTED_PATH.getStatus()); |
53 | | - // assertThat(response.contentUtf8()).isEqualTo(NESTED_PATH.getBody()); |
54 | | - // assertResponseHasCustomizedHeaders(response, NESTED_PATH, null); |
55 | | - // |
56 | | - // assertTheTraces(1, null, null, null, method, NESTED_PATH); |
57 | | - // } |
| 20 | + @Override |
| 21 | + protected Class<?> getApplicationClass() { |
| 22 | + return Application.class; |
| 23 | + } |
| 24 | + |
| 25 | + @Configuration |
| 26 | + @EnableAutoConfiguration |
| 27 | + static class Application { |
| 28 | + @Bean |
| 29 | + RouterFunction<ServerResponse> router() { |
| 30 | + return new RouteFactory().createRoutes(); |
| 31 | + } |
| 32 | + |
| 33 | + @Bean |
| 34 | + NettyReactiveWebServerFactory nettyFactory() { |
| 35 | + return new NettyReactiveWebServerFactory(); |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + static class RouteFactory extends ServerTestRouteFactory { |
| 40 | + |
| 41 | + @Override |
| 42 | + protected Mono<ServerResponse> wrapResponse( |
| 43 | + ServerEndpoint endpoint, Mono<ServerResponse> response, Runnable spanAction) { |
| 44 | + return controller( |
| 45 | + endpoint, |
| 46 | + () -> { |
| 47 | + spanAction.run(); |
| 48 | + return response; |
| 49 | + }); |
| 50 | + } |
| 51 | + } |
58 | 52 | } |
0 commit comments