use of org.apache.cxf.systest.jaxrs.tracing.BookStore in project cxf by apache.
the class OpenTracingTracingTest method testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleAsyncClients.
@Test
public void testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleAsyncClients() throws Exception {
final WebClient client = createWebClient("/bookstore/books", new OpenTracingClientProvider(tracer));
// The intention is to make a calls one after another, not in parallel, to ensure the
// thread have trace contexts cleared out.
IntStream.range(0, 4).mapToObj(index -> client.async().get()).map(this::get).forEach(r -> assertEquals(Status.OK.getStatusCode(), r.getStatus()));
assertThat(REPORTER.getSpans().size(), equalTo(12));
IntStream.range(0, 4).map(index -> index * 3).forEach(index -> {
assertThat(REPORTER.getSpans().get(index).getOperationName(), equalTo("Get Books"));
assertThat(REPORTER.getSpans().get(index + 1).getOperationName(), equalTo("GET /bookstore/books"));
assertThat(REPORTER.getSpans().get(index + 2).getOperationName(), equalTo("GET " + client.getCurrentURI()));
});
}
Aggregations