Search in sources :

Example 6 with SpanId

use of org.apache.cxf.systest.brave.BraveTestSupport.SpanId in project cxf by apache.

the class BraveTracingTest method testThatNewInnerSpanIsCreatedUsingAsyncInvocation.

@Test
public void testThatNewInnerSpanIsCreatedUsingAsyncInvocation() {
    final SpanId spanId = fromRandom();
    final Response r = withTrace(createWebClient("/bookstore/books/async"), spanId).get();
    assertEquals(Status.OK.getStatusCode(), r.getStatus());
    assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
    assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get /bookstore/books/async"));
    assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("processing books"));
    assertThat(TestSpanReporter.getAllSpans().get(0).parentId, not(nullValue()));
    assertThat(TestSpanReporter.getAllSpans().get(0).parentId, equalTo(TestSpanReporter.getAllSpans().get(1).id));
    assertThatTraceIsPresent(r, spanId);
}
Also used : Response(javax.ws.rs.core.Response) SpanId(org.apache.cxf.systest.brave.BraveTestSupport.SpanId) Test(org.junit.Test)

Example 7 with SpanId

use of org.apache.cxf.systest.brave.BraveTestSupport.SpanId in project cxf by apache.

the class BraveTracingTest method testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation.

@Test
public void testThatInnerSpanIsCreatedUsingPseudoAsyncInvocation() {
    final SpanId spanId = fromRandom();
    final Response r = withTrace(createWebClient("/bookstore/books/pseudo-async"), spanId).get();
    assertEquals(Status.OK.getStatusCode(), r.getStatus());
    assertThat(TestSpanReporter.getAllSpans().size(), equalTo(2));
    assertThat(TestSpanReporter.getAllSpans().get(1).name, equalTo("get /bookstore/books/pseudo-async"));
    assertThat(TestSpanReporter.getAllSpans().get(0).name, equalTo("processing books"));
    assertThatTraceIsPresent(r, spanId);
}
Also used : Response(javax.ws.rs.core.Response) SpanId(org.apache.cxf.systest.brave.BraveTestSupport.SpanId) Test(org.junit.Test)

Aggregations

SpanId (org.apache.cxf.systest.brave.BraveTestSupport.SpanId)7 Test (org.junit.Test)7 Response (javax.ws.rs.core.Response)6 HashMap (java.util.HashMap)1 List (java.util.List)1 Random (java.util.Random)1 BookStoreService (org.apache.cxf.systest.jaxws.tracing.BookStoreService)1