use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class SqlMapClientTemplateIT method updateShouldBeTraced.
@Test
public void updateShouldBeTraced() throws Exception {
// Given
final String updateId = "updateId";
SqlMapClientTemplate clientTemplate = new SqlMapClientTemplate(this.mockDataSource, this.sqlMapClient);
// When
clientTemplate.update(updateId);
clientTemplate.update(updateId, new Object());
clientTemplate.update(updateId, new Object(), 0);
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method update1 = SqlMapClientTemplate.class.getDeclaredMethod("update", String.class);
Method update2 = SqlMapClientTemplate.class.getDeclaredMethod("update", String.class, Object.class);
Method update3 = SqlMapClientTemplate.class.getDeclaredMethod("update", String.class, Object.class, int.class);
verifier.verifyTrace(event("IBATIS_SPRING", update1, Expectations.cachedArgs(updateId)));
verifier.verifyTrace(event("IBATIS_SPRING", update2, Expectations.cachedArgs(updateId)));
verifier.verifyTrace(event("IBATIS_SPRING", update3, Expectations.cachedArgs(updateId)));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class SqlMapExecutorTestBase method testAndVerifyQueryForObject.
protected final void testAndVerifyQueryForObject(SqlMapExecutor executor) throws Exception {
final String queryForObjectId = "queryForObjectId";
executor.queryForObject(queryForObjectId);
executor.queryForObject(queryForObjectId, new Object());
executor.queryForObject(queryForObjectId, new Object(), new Object());
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method queryForObject1 = executor.getClass().getDeclaredMethod("queryForObject", String.class);
Method queryForObject2 = executor.getClass().getDeclaredMethod("queryForObject", String.class, Object.class);
Method queryForObject3 = executor.getClass().getDeclaredMethod("queryForObject", String.class, Object.class, Object.class);
verifier.verifyTrace(event("IBATIS", queryForObject1, Expectations.cachedArgs(queryForObjectId)));
verifier.verifyTrace(event("IBATIS", queryForObject2, Expectations.cachedArgs(queryForObjectId)));
verifier.verifyTrace(event("IBATIS", queryForObject3, Expectations.cachedArgs(queryForObjectId)));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class SqlMapExecutorTestBase method testAndVerifyInsertWithNullSqlId.
protected final void testAndVerifyInsertWithNullSqlId(SqlMapExecutor executor) throws Exception {
executor.insert(null);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method insert = executor.getClass().getDeclaredMethod("insert", String.class);
verifier.verifyTrace(event("IBATIS", insert));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class HystrixCommand_1_4_1_to_1_4_2_IT method testExecutionException.
@Test
public void testExecutionException() throws Exception {
Exception expectedException = new RuntimeException("expected");
executeThrowExceptionCommand(expectedException);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method queue = HystrixCommand.class.getMethod("queue");
Class<?> executionObservableClazz = Class.forName(EXECUTION_OBSERVABLE_INNER_CLASS);
Method executionObservableCallCmd = executionObservableClazz.getDeclaredMethod("call", Subscriber.class);
Class<?> fallbackObservableClazz = Class.forName(FALLBACK_OBSERVABLE_INNER_CLASS);
Method fallbackObservableCallCmd = fallbackObservableClazz.getDeclaredMethod("call", Subscriber.class);
verifier.verifyTrace(Expectations.async(Expectations.event("HYSTRIX_COMMAND", queue, annotation("hystrix.command", ThrowExceptionCommand.class.getSimpleName())), Expectations.event("ASYNC", "Asynchronous Invocation"), Expectations.event("HYSTRIX_COMMAND_INTERNAL", executionObservableCallCmd, annotation("hystrix.command.execution", "run")), Expectations.event("HYSTRIX_COMMAND_INTERNAL", fallbackObservableCallCmd, annotation("hystrix.command.execution", "fallback"))));
// no more traces
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class HystrixCommand_1_4_3_to_1_5_2_IT method testExecutionException.
@Test
public void testExecutionException() throws Exception {
Exception expectedException = new RuntimeException("expected");
executeThrowExceptionCommand(expectedException);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method queue = HystrixCommand.class.getMethod("queue");
Class<?> executionObservableClazz = Class.forName(EXECUTION_OBSERVABLE_INNER_CLASS);
Method executionObservableCallCmd = executionObservableClazz.getDeclaredMethod("call", Subscriber.class);
Class<?> fallbackObservableClazz = Class.forName(FALLBACK_OBSERVABLE_INNER_CLASS);
Method fallbackObservableCallCmd = fallbackObservableClazz.getDeclaredMethod("call", Subscriber.class);
ExpectedTrace expectedFallbackTrace;
try {
// We record the cause of the fallback by invoking AbstractCommand.getExecutionException() added in 1.4.22
HystrixCommand.class.getMethod("getExecutionException");
expectedFallbackTrace = Expectations.event("HYSTRIX_COMMAND_INTERNAL", fallbackObservableCallCmd, annotation("hystrix.command.execution", "fallback"), annotation("hystrix.command.fallback.cause", expectedException.toString()));
} catch (NoSuchMethodException e) {
// pre 1.4.22
expectedFallbackTrace = Expectations.event("HYSTRIX_COMMAND_INTERNAL", fallbackObservableCallCmd, annotation("hystrix.command.execution", "fallback"));
}
verifier.verifyTrace(Expectations.async(Expectations.event("HYSTRIX_COMMAND", queue, annotation("hystrix.command", ThrowExceptionCommand.class.getSimpleName())), Expectations.event("ASYNC", "Asynchronous Invocation"), Expectations.event("HYSTRIX_COMMAND_INTERNAL", executionObservableCallCmd, annotation("hystrix.command.execution", "run")), expectedFallbackTrace));
// no more traces
verifier.verifyTraceCount(0);
}
Aggregations