use of com.navercorp.pinpoint.bootstrap.context.TraceContext in project pinpoint by naver.
the class InvokeMethodInterceptorTest method spyTraceContext.
private TraceContext spyTraceContext() {
ProfilerConfig profilerConfig = new DefaultProfilerConfig();
TraceContext traceContext = MockTraceContextFactory.newTestTraceContext(profilerConfig);
return spy(traceContext);
}
use of com.navercorp.pinpoint.bootstrap.context.TraceContext in project pinpoint by naver.
the class SpanSimpleAroundInterceptorTest method traceCreateFail.
@Test
public void traceCreateFail() {
TraceContext context = mock(TraceContext.class);
when(context.newTraceObject()).thenReturn(null);
TestSpanSimpleAroundInterceptor interceptor = new TestSpanSimpleAroundInterceptor(context);
checkTraceCreateFailInterceptor(context, interceptor);
}
use of com.navercorp.pinpoint.bootstrap.context.TraceContext in project pinpoint by naver.
the class SpanSimpleAroundInterceptorTest method afterExceptionLifeCycle.
@Test
public void afterExceptionLifeCycle() throws Exception {
Trace trace = newTrace();
TraceContext context = newTraceContext(trace);
TestSpanSimpleAroundInterceptor interceptor = new TestSpanSimpleAroundInterceptor(context) {
@Override
protected void doInAfterTrace(SpanRecorder trace, Object target, Object[] args, Object result, Throwable throwable) {
touchAfter();
throw new RuntimeException();
}
};
checkSpanInterceptor(context, interceptor);
}
use of com.navercorp.pinpoint.bootstrap.context.TraceContext in project pinpoint by naver.
the class SpanSimpleAroundInterceptorTest method lifeCycle.
@Test
public void lifeCycle() throws Exception {
Trace trace = newTrace();
TraceContext context = newTraceContext(trace);
TestSpanSimpleAroundInterceptor interceptor = new TestSpanSimpleAroundInterceptor(context);
checkSpanInterceptor(context, interceptor);
}
use of com.navercorp.pinpoint.bootstrap.context.TraceContext in project pinpoint by naver.
the class DriverConnectInterceptorTest method driverConnect.
@Test
public void driverConnect() throws SQLException {
TraceContext traceContext = mock(TraceContext.class);
MethodDescriptor methodDescriptor = mock(MethodDescriptor.class);
JdbcUrlParser parser = mock(JdbcUrlParser.class);
when(parser.parse(anyString())).thenReturn(UnKnownDatabaseInfo.INSTANCE);
String invalidJdbcUrl = "invalidUrl";
Driver driver = mock(Driver.class);
DatabaseInfoAccessor setAccessor = mock(DatabaseInfoAccessor.class);
DatabaseInfoAccessor getAccessor = mock(DatabaseInfoAccessor.class);
SpanEventRecorder spanEventRecorder = mock(SpanEventRecorder.class);
DriverConnectInterceptor driverConnectInterceptor = new DriverConnectInterceptor(traceContext, methodDescriptor, parser);
driverConnectInterceptor.prepareAfterTrace(driver, va(invalidJdbcUrl), setAccessor, null);
driverConnectInterceptor.doInAfterTrace(spanEventRecorder, driver, va(invalidJdbcUrl), getAccessor, null);
verify(setAccessor, times(1))._$PINPOINT$_setDatabaseInfo(UnKnownDatabaseInfo.INSTANCE);
verify(getAccessor, times(1))._$PINPOINT$_getDatabaseInfo();
}
Aggregations