use of org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan in project incubator-skywalking by apache.
the class TransportClientHandlerInterceptorTest method testConsumer.
@Test
public void testConsumer() throws Throwable {
nextInterceptor.beforeMethod(enhancedInstance, null, allArguments, argumentsType, null);
nextInterceptor.afterMethod(enhancedInstance, null, allArguments, argumentsType, null);
Assert.assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertCombSpan(spans.get(0));
verify(invocation, times(1)).getContext();
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan in project incubator-skywalking by apache.
the class InterceptorTest method assertSyncExecute.
@Test
public void assertSyncExecute() throws Throwable {
executeInterceptor.beforeMethod(null, null, allArguments, null, null);
sendEvent("ds_0", "select * from t_order_0");
executeInterceptor.afterMethod(null, null, allArguments, null, null);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment segment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
assertNotNull(spans);
assertThat(spans.size(), is(2));
assertSpan(spans.get(0), 0);
assertThat(spans.get(1).getOperationName(), is("/SJDBC/TRUNK/DQL"));
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan in project incubator-skywalking by apache.
the class OnSuccessInterceptorTest method testOnSuccess.
@Test
public void testOnSuccess() throws Throwable {
successInterceptor.beforeMethod(enhancedInstance, null, new Object[] { sendResult }, null, null);
successInterceptor.afterMethod(enhancedInstance, null, new Object[] { sendResult }, null, null);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertThat(spans.size(), is(1));
AbstractTracingSpan successSpan = spans.get(0);
SpanAssert.assertComponent(successSpan, ComponentsDefine.ROCKET_MQ);
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan in project incubator-skywalking by apache.
the class OnSuccessInterceptorTest method testOnSuccessWithErrorStatus.
@Test
public void testOnSuccessWithErrorStatus() throws Throwable {
when(sendResult.getSendStatus()).thenReturn(SendStatus.FLUSH_SLAVE_TIMEOUT);
successInterceptor.beforeMethod(enhancedInstance, null, new Object[] { sendResult }, null, null);
successInterceptor.afterMethod(enhancedInstance, null, new Object[] { sendResult }, null, null);
assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertThat(spans.size(), is(1));
AbstractTracingSpan successSpan = spans.get(0);
SpanAssert.assertComponent(successSpan, ComponentsDefine.ROCKET_MQ);
SpanAssert.assertOccurException(successSpan, true);
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan in project incubator-skywalking by apache.
the class TransportClientHandlerInterceptorTest method testConsumer.
@Test
public void testConsumer() throws Throwable {
nextInterceptor.beforeMethod(enhancedInstance, null, allArguments, argumentsType, null);
nextInterceptor.afterMethod(enhancedInstance, null, allArguments, argumentsType, null);
Assert.assertThat(segmentStorage.getTraceSegments().size(), is(1));
TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0);
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
assertCombSpan(spans.get(0));
verify(invocation, times(1)).getContext();
}
Aggregations