|
5 | 5 |
|
6 | 6 | package io.opentelemetry.javaagent.instrumentation.spring.webflux.v5_0.server.base; |
7 | 7 |
|
8 | | -import static org.assertj.core.api.Assertions.assertThat; |
9 | | -import static org.junit.jupiter.api.Assumptions.assumeTrue; |
10 | | - |
11 | | -import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint; |
12 | | -import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpRequest; |
13 | | -import io.opentelemetry.testing.internal.armeria.common.AggregatedHttpResponse; |
14 | | -import org.junit.jupiter.api.Test; |
15 | | -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
16 | | -import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; |
17 | | -import org.springframework.context.annotation.Bean; |
18 | | -import org.springframework.context.annotation.Configuration; |
19 | | -import org.springframework.web.reactive.function.server.RouterFunction; |
20 | | -import org.springframework.web.reactive.function.server.ServerResponse; |
21 | | -import reactor.core.publisher.Mono; |
22 | | - |
23 | | -/** |
24 | | - * Tests the case where "controller" span is created within the route handler method scope, and the |
25 | | - * |
26 | | - * <p>{@code Mono<ServerResponse>} from a handler is already a fully constructed response with no |
27 | | - * deferred actions. For exception endpoint, the exception is thrown within route handler method |
28 | | - * scope. |
29 | | - */ |
30 | | -class ImmediateHandlerSpringWebFluxServerTest extends HandlerSpringWebFluxServerTest { |
31 | | - @Override |
32 | | - protected Class<?> getApplicationClass() { |
33 | | - return Application.class; |
34 | | - } |
35 | | - |
36 | | - @Configuration |
37 | | - @EnableAutoConfiguration |
38 | | - static class Application { |
39 | | - @Bean |
40 | | - RouterFunction<ServerResponse> router() { |
41 | | - return new RouteFactory().createRoutes(); |
42 | | - } |
43 | | - |
44 | | - @Bean |
45 | | - NettyReactiveWebServerFactory nettyFactory() { |
46 | | - return new NettyReactiveWebServerFactory(); |
47 | | - } |
48 | | - } |
49 | | - |
50 | | - static class RouteFactory extends ServerTestRouteFactory { |
51 | | - |
52 | | - @Override |
53 | | - protected Mono<ServerResponse> wrapResponse( |
54 | | - ServerEndpoint endpoint, Mono<ServerResponse> response, Runnable spanAction) { |
55 | | - return controller( |
56 | | - endpoint, |
57 | | - () -> { |
58 | | - spanAction.run(); |
59 | | - return response; |
60 | | - }); |
61 | | - } |
62 | | - } |
63 | | - |
64 | | - @Test |
65 | | - void nestedPath() { |
66 | | - assumeTrue(Boolean.getBoolean("testLatestDeps")); |
67 | | - |
68 | | - String method = "GET"; |
69 | | - AggregatedHttpRequest request = request(NESTED_PATH, method); |
70 | | - AggregatedHttpResponse response = client.execute(request).aggregate().join(); |
71 | | - assertThat(response.status().code()).isEqualTo(NESTED_PATH.getStatus()); |
72 | | - assertThat(response.contentUtf8()).isEqualTo(NESTED_PATH.getBody()); |
73 | | - assertResponseHasCustomizedHeaders(response, NESTED_PATH, null); |
74 | | - |
75 | | - assertTheTraces(1, null, null, null, method, NESTED_PATH); |
76 | | - } |
| 8 | +import io.opentelemetry.instrumentation.spring.webflux.server.AbstractImmediateHandlerSpringWebFluxServerTest; |
| 9 | + |
| 10 | +class ImmediateHandlerSpringWebFluxServerTest |
| 11 | + 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 | + // } |
77 | 58 | } |
0 commit comments