Search in sources :

Example 81 with PluginTestVerifier

use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.

the class MariaDB_1_4_x_IT method testCallableStatement.

@Test
public void testCallableStatement() throws Exception {
    super.executeCallableStatement();
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();
    verifier.verifyTraceCount(6);
    // 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)));
    // AbstractCallableProcedureStatement#registerOutParameter
    Class<?> abstractCallableProcedureStatementClass = Class.forName("org.mariadb.jdbc.AbstractCallableProcedureStatement");
    Method registerOutParameter = abstractCallableProcedureStatementClass.getMethod("registerOutParameter", int.class, int.class);
    verifier.verifyTrace(event("MARIADB", registerOutParameter, null, URL, DATABASE_NAME, args(2, CALLABLE_STATMENT_OUTPUT_PARAM_TYPE)));
    // 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(CALLABLE_STATEMENT_QUERY, null, CALLABLE_STATEMENT_INPUT_PARAM)));
    // MariaDbConnection#prepareStatement(String)
    Method prepareStatement = mariaDbConnectionClass.getDeclaredMethod("prepareStatement", String.class);
    verifier.verifyTrace(event("MARIADB", prepareStatement, null, URL, DATABASE_NAME, sql(CALLABLE_QUERY_META_INFOS_QUERY, null)));
    // MariaDbServerPreparedStatement#executeQuery
    verifier.verifyTrace(event("MARIADB_EXECUTE_QUERY", executeQuery, null, URL, DATABASE_NAME, sql(CALLABLE_QUERY_META_INFOS_QUERY, null, PROCEDURE_NAME)));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Example 82 with PluginTestVerifier

use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.

the class SqlMapExecutorTestBase method testAndVerifyInsert.

protected final void testAndVerifyInsert(SqlMapExecutor executor) throws Exception {
    final String insertId = "insertId";
    executor.insert(insertId);
    executor.insert(insertId, new Object());
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method insert = executor.getClass().getDeclaredMethod("insert", String.class);
    Method insertWithParameter = executor.getClass().getDeclaredMethod("insert", String.class, Object.class);
    verifier.verifyTrace(event("IBATIS", insert, Expectations.cachedArgs(insertId)));
    verifier.verifyTrace(event("IBATIS", insertWithParameter, Expectations.cachedArgs(insertId)));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)

Example 83 with PluginTestVerifier

use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.

the class SqlMapExecutorTestBase method testAndVerifyQueryForList.

protected final void testAndVerifyQueryForList(SqlMapExecutor executor) throws Exception {
    final String queryForListId = "queryForListId";
    executor.queryForList(queryForListId);
    executor.queryForList(queryForListId, new Object());
    executor.queryForList(queryForListId, 0, 1);
    executor.queryForList(queryForListId, new Object(), 0, 1);
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method queryForList1 = executor.getClass().getDeclaredMethod("queryForList", String.class);
    Method queryForList2 = executor.getClass().getDeclaredMethod("queryForList", String.class, Object.class);
    Method queryForList3 = executor.getClass().getDeclaredMethod("queryForList", String.class, int.class, int.class);
    Method queryForList4 = executor.getClass().getDeclaredMethod("queryForList", String.class, Object.class, int.class, int.class);
    verifier.verifyTrace(event("IBATIS", queryForList1, Expectations.cachedArgs(queryForListId)));
    verifier.verifyTrace(event("IBATIS", queryForList2, Expectations.cachedArgs(queryForListId)));
    verifier.verifyTrace(event("IBATIS", queryForList3, Expectations.cachedArgs(queryForListId)));
    verifier.verifyTrace(event("IBATIS", queryForList4, Expectations.cachedArgs(queryForListId)));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)

Example 84 with PluginTestVerifier

use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.

the class SqlMapExecutorTestBase method testAndVerifyUpdate.

protected final void testAndVerifyUpdate(SqlMapExecutor executor) throws Exception {
    final String updateId = "updateId";
    executor.update(updateId);
    executor.update(updateId, new Object());
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method update = executor.getClass().getDeclaredMethod("update", String.class);
    Method updateWithParameter = executor.getClass().getDeclaredMethod("update", String.class, Object.class);
    verifier.verifyTrace(event("IBATIS", update, Expectations.cachedArgs(updateId)));
    verifier.verifyTrace(event("IBATIS", updateWithParameter, Expectations.cachedArgs(updateId)));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)

Example 85 with PluginTestVerifier

use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.

the class SqlMapExecutorTestBase method testAndVerifyDelete.

protected final void testAndVerifyDelete(SqlMapExecutor executor) throws Exception {
    final String deleteId = "deleteId";
    executor.delete(deleteId);
    executor.delete(deleteId, new Object());
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();
    Method delete = executor.getClass().getDeclaredMethod("delete", String.class);
    Method deleteWithParameter = executor.getClass().getDeclaredMethod("delete", String.class, Object.class);
    verifier.verifyTrace(event("IBATIS", delete, Expectations.cachedArgs(deleteId)));
    verifier.verifyTrace(event("IBATIS", deleteWithParameter, Expectations.cachedArgs(deleteId)));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)

Aggregations

PluginTestVerifier (com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)101 Method (java.lang.reflect.Method)80 Test (org.junit.Test)80 SqlSession (org.apache.ibatis.session.SqlSession)8 SqlMapClientTemplate (org.springframework.orm.ibatis.SqlMapClientTemplate)8 IOException (java.io.IOException)5 RpcException (com.alibaba.dubbo.rpc.RpcException)4 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)3 Gson (com.google.gson.Gson)3 ExpectedTrace (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace)3 HttpURLConnection (java.net.HttpURLConnection)3 URI (java.net.URI)3 URL (java.net.URL)3 FailoverClusterInvoker (com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker)2 AbstractProxyInvoker (com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectReader (com.fasterxml.jackson.databind.ObjectReader)2 GenericUrl (com.google.api.client.http.GenericUrl)2 HttpRequest (com.google.api.client.http.HttpRequest)2 HttpRequestFactory (com.google.api.client.http.HttpRequestFactory)2