use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class HystrixCommand_1_5_4_to_1_5_x_IT method testExecutionExceptionWithFallback.
@Test
public void testExecutionExceptionWithFallback() throws Exception {
Exception expectedException = new RuntimeException("expected");
String fallbackMessage = "Fallback";
executeThrowExceptionWithFallbackCommand(expectedException, fallbackMessage);
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");
Class<?> fallbackObservableClazz = Class.forName(FALLBACK_OBSERVABLE_INNER_CLASS);
Method fallbackObservableCallCmd = fallbackObservableClazz.getDeclaredMethod("call");
verifier.verifyTrace(Expectations.async(Expectations.event("HYSTRIX_COMMAND", queue, annotation("hystrix.command", ThrowExceptionCommandWithFallback.class.getSimpleName())), Expectations.event("ASYNC", "Asynchronous Invocation"), Expectations.event("HYSTRIX_COMMAND_INTERNAL", executionObservableCallCmd, annotation("hystrix.command.execution", "run")), Expectations.event("ASYNC", "Asynchronous Invocation"), Expectations.event("HYSTRIX_COMMAND_INTERNAL", fallbackObservableCallCmd, annotation("hystrix.command.execution", "fallback"), annotation("hystrix.command.fallback.cause", expectedException.toString()))));
// no more traces
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class HystrixCommand_1_5_4_to_1_5_x_IT method testAsyncCall.
@Test
public void testAsyncCall() throws Exception {
String name = "Pinpoint";
queueAndGetSayHelloCommand(name);
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");
verifier.verifyTrace(Expectations.async(Expectations.event("HYSTRIX_COMMAND", queue, annotation("hystrix.command", SayHelloCommand.class.getSimpleName())), Expectations.event("ASYNC", "Asynchronous Invocation"), Expectations.event("HYSTRIX_COMMAND_INTERNAL", executionObservableCallCmd, annotation("hystrix.command.execution", "run"))));
// no more traces
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class MariaDB_1_3_x_IT method testStatement.
@Test
public void testStatement() throws Exception {
super.executeStatement();
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTraceCount(2);
// Driver#connect(String, Properties)
Class<?> driverClass = Class.forName("org.mariadb.jdbc.Driver");
Method connect = driverClass.getDeclaredMethod("connect", String.class, Properties.class);
verifier.verifyTrace(event("MARIADB", connect, null, URL, DATABASE_NAME, cachedArgs(JDBC_URL)));
// MariaDbStatement#executeQuery(String)
Class<?> mariaDbStatementClass = Class.forName("org.mariadb.jdbc.MariaDbStatement");
Method executeQuery = mariaDbStatementClass.getDeclaredMethod("executeQuery", String.class);
verifier.verifyTrace(event("MARIADB_EXECUTE_QUERY", executeQuery, null, URL, DATABASE_NAME, sql(STATEMENT_NORMALIZED_QUERY, "1")));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class MariaDB_1_3_x_IT method testPreparedStatement.
@Test
public void testPreparedStatement() throws Exception {
super.executePreparedStatement();
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTraceCount(3);
// Driver#connect(String, Properties)
Class<?> driverClass = Class.forName("org.mariadb.jdbc.Driver");
Method connect = driverClass.getDeclaredMethod("connect", String.class, Properties.class);
verifier.verifyTrace(event("MARIADB", connect, null, URL, DATABASE_NAME, cachedArgs(JDBC_URL)));
// MariaDbConnection#prepareStatement(String)
Class<?> mariaDbConnectionClass = Class.forName("org.mariadb.jdbc.MariaDbConnection");
Method prepareStatement = mariaDbConnectionClass.getDeclaredMethod("prepareStatement", String.class);
verifier.verifyTrace(event("MARIADB", prepareStatement, null, URL, DATABASE_NAME, sql(PREPARED_STATEMENT_QUERY, null)));
// MariaDbServerPreparedStatement#executeQuery
Class<?> mariaDbServerPreparedStatementClass = Class.forName("org.mariadb.jdbc.MariaDbServerPreparedStatement");
Method executeQuery = mariaDbServerPreparedStatementClass.getDeclaredMethod("executeQuery");
verifier.verifyTrace(event("MARIADB_EXECUTE_QUERY", executeQuery, null, URL, DATABASE_NAME, sql(PREPARED_STATEMENT_QUERY, null, "3")));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class MariaDB_1_3_x_IT method testCallableStatement.
@Test
public void testCallableStatement() throws Exception {
super.executeCallableStatement();
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTraceCount(5);
// Driver#connect(String, Properties)
Class<?> driverClass = Class.forName("org.mariadb.jdbc.Driver");
Method connect = driverClass.getDeclaredMethod("connect", String.class, Properties.class);
verifier.verifyTrace(event("MARIADB", connect, null, URL, DATABASE_NAME, cachedArgs(JDBC_URL)));
// MariaDbConnection#prepareCall(String)
Class<?> mariaDbConnectionClass = Class.forName("org.mariadb.jdbc.MariaDbConnection");
Method prepareCall = mariaDbConnectionClass.getDeclaredMethod("prepareCall", String.class);
verifier.verifyTrace(event("MARIADB", prepareCall, null, URL, DATABASE_NAME, sql(CALLABLE_STATEMENT_QUERY, null)));
// MariaDbClientCallableStatement#registerOutParameter(int, int)
Class<?> mariaDbClientCallableStatementClass = Class.forName("org.mariadb.jdbc.MariaDbCallableStatement");
Method registerOutParameter = mariaDbClientCallableStatementClass.getDeclaredMethod("registerOutParameter", int.class, int.class);
verifier.verifyTrace(event("MARIADB", registerOutParameter, null, URL, DATABASE_NAME, args(2, CALLABLE_STATMENT_OUTPUT_PARAM_TYPE)));
// MariaDbCallableStatement#executeQuery
Class<?> mariaDbCallableStatementClass = Class.forName("org.mariadb.jdbc.MariaDbCallableStatement");
Method callableStatementExecuteQuery = mariaDbCallableStatementClass.getDeclaredMethod("executeQuery");
verifier.verifyTrace(event("MARIADB_EXECUTE_QUERY", callableStatementExecuteQuery, null, URL, DATABASE_NAME, sql(CALLABLE_STATEMENT_QUERY, null, CALLABLE_STATEMENT_INPUT_PARAM)));
// MariaDbStatement#executeQuery
Class<?> mariaDbStatementClass = Class.forName("org.mariadb.jdbc.MariaDbStatement");
Method statementExecuteQuery = mariaDbStatementClass.getDeclaredMethod("executeQuery", String.class);
verifier.verifyTrace(event("MARIADB_EXECUTE_QUERY", statementExecuteQuery, null, URL, DATABASE_NAME, sql(CALLABLE_QUERY_META_INFOS_QUERY, PROCEDURE_NAME)));
}
Aggregations