use of com.navercorp.pinpoint.bootstrap.plugin.jdbc.JdbcUrlParser 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();
}
use of com.navercorp.pinpoint.bootstrap.plugin.jdbc.JdbcUrlParser in project pinpoint by naver.
the class DriverConnectInterceptorTest method driverConnect_return_Null_NPEtest.
@Test
public void driverConnect_return_Null_NPEtest() 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";
final Driver driver = mock(Driver.class);
SpanEventRecorder spanEventRecorder = mock(SpanEventRecorder.class);
DriverConnectInterceptor driverConnectInterceptor = new DriverConnectInterceptor(traceContext, methodDescriptor, parser);
driverConnectInterceptor.prepareAfterTrace(driver, va(invalidJdbcUrl), null, null);
driverConnectInterceptor.doInAfterTrace(spanEventRecorder, driver, va(invalidJdbcUrl), null, null);
}
Aggregations