use of org.apache.cxf.systest.jaxrs.tracing.BookStore in project cxf by apache.
the class HTraceTracingTest method testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleAsyncClients.
@Test
public void testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleAsyncClients() throws Exception {
final WebClient client = createWebClient("/bookstore/books", htraceClientProvider);
// The intention is to make a calls one after another, not in parallel, to ensure the
// thread have trace contexts cleared out.
final Collection<Response> responses = IntStream.range(0, 4).mapToObj(index -> client.async().get()).map(this::get).collect(Collectors.toList());
for (final Response r : responses) {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertTrue(r.getHeaders().containsKey(TracerHeaders.DEFAULT_HEADER_SPAN_ID));
}
assertThat(TestSpanReceiver.getAllSpans().size(), equalTo(12));
IntStream.range(0, 4).map(index -> index * 3).forEach(index -> {
assertThat(TestSpanReceiver.getAllSpans().get(index).getDescription(), equalTo("Get Books"));
assertThat(TestSpanReceiver.getAllSpans().get(index + 1).getDescription(), equalTo("GET bookstore/books"));
assertThat(TestSpanReceiver.getAllSpans().get(index + 2).getDescription(), equalTo("GET " + client.getCurrentURI()));
});
}
use of org.apache.cxf.systest.jaxrs.tracing.BookStore in project cxf by apache.
the class HTraceTracingTest method testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleClients.
@Test
public void testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleClients() throws Exception {
final WebClient client = createWebClient("/bookstore/books", htraceClientProvider);
// The intention is to make a calls one after another, not in parallel, to ensure the
// thread have trace contexts cleared out.
final Collection<Response> responses = IntStream.range(0, 4).mapToObj(index -> client.get()).collect(Collectors.toList());
for (final Response r : responses) {
assertEquals(Status.OK.getStatusCode(), r.getStatus());
assertTrue(r.getHeaders().containsKey(TracerHeaders.DEFAULT_HEADER_SPAN_ID));
}
assertThat(TestSpanReceiver.getAllSpans().size(), equalTo(12));
IntStream.range(0, 4).map(index -> index * 3).forEach(index -> {
assertThat(TestSpanReceiver.getAllSpans().get(index).getDescription(), equalTo("Get Books"));
assertThat(TestSpanReceiver.getAllSpans().get(index + 1).getDescription(), equalTo("GET bookstore/books"));
assertThat(TestSpanReceiver.getAllSpans().get(index + 2).getDescription(), equalTo("GET " + client.getCurrentURI()));
});
}
use of org.apache.cxf.systest.jaxrs.tracing.BookStore in project cxf by apache.
the class BraveTracingTest method testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleClients.
@Test
public void testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleClients() throws Exception {
final WebClient client = createWebClient("/bookstore/books", new BraveClientProvider(brave));
// 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.get()).forEach(r -> assertEquals(Status.OK.getStatusCode(), r.getStatus()));
assertThat(TestSpanReporter.getAllSpans().size(), equalTo(12));
IntStream.range(0, 4).map(index -> index * 3).forEach(index -> {
assertThat(TestSpanReporter.getAllSpans().get(index).name(), equalTo("get books"));
assertThat(TestSpanReporter.getAllSpans().get(index + 1).name(), equalTo("get /bookstore/books"));
assertThat(TestSpanReporter.getAllSpans().get(index + 2).name(), equalTo("get " + client.getCurrentURI()));
});
}
use of org.apache.cxf.systest.jaxrs.tracing.BookStore in project cxf by apache.
the class OpenTracingTracingTest method testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleClients.
@Test
public void testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleClients() 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.get()).forEach(r -> assertEquals(Status.OK.getStatusCode(), r.getStatus()));
assertEquals(REPORTER.getSpans().toString(), 12, REPORTER.getSpans().size());
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()));
});
}
use of org.apache.cxf.systest.jaxrs.tracing.BookStore in project cxf by apache.
the class BraveTracingTest method testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleAsyncClients.
@Test
public void testThatNewSpansAreCreatedWhenNotProvidedUsingMultipleAsyncClients() throws Exception {
final WebClient client = createWebClient("/bookstore/books", new BraveClientProvider(brave));
// 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(TestSpanReporter.getAllSpans().toString(), TestSpanReporter.getAllSpans().size(), equalTo(12));
IntStream.range(0, 4).map(index -> index * 3).forEach(index -> {
assertThat(TestSpanReporter.getAllSpans().get(index).name(), equalTo("get books"));
assertThat(TestSpanReporter.getAllSpans().get(index + 1).name(), equalTo("get /bookstore/books"));
assertThat(TestSpanReporter.getAllSpans().get(index + 2).name(), equalTo("get " + client.getCurrentURI()));
});
}
Aggregations