Search in sources :

Example 96 with PluginTestVerifier

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

the class SqlSessionTestBase method testAndVerifyDelete.

protected final void testAndVerifyDelete() throws Exception {
    // Given
    final String deleteId = "deleteId";
    SqlSession sqlSession = getSqlSession();
    // When
    sqlSession.delete(deleteId);
    sqlSession.delete(deleteId, new Object());
    // Then
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method delete1 = sqlSession.getClass().getDeclaredMethod("delete", String.class);
    Method delete2 = sqlSession.getClass().getDeclaredMethod("delete", String.class, Object.class);
    verifier.verifyTrace(event("MYBATIS", delete1, Expectations.cachedArgs(deleteId)));
    verifier.verifyTrace(event("MYBATIS", delete2, Expectations.cachedArgs(deleteId)));
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)

Example 97 with PluginTestVerifier

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

the class SqlSessionTestBase method testAndVerifyInsert.

protected final void testAndVerifyInsert() throws Exception {
    // Given
    final String insertId = "insertId";
    SqlSession sqlSession = getSqlSession();
    // When
    sqlSession.insert(insertId);
    sqlSession.insert(insertId, new Object());
    // Then
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method insert1 = sqlSession.getClass().getDeclaredMethod("insert", String.class);
    Method insert2 = sqlSession.getClass().getDeclaredMethod("insert", String.class, Object.class);
    verifier.verifyTrace(event("MYBATIS", insert1, Expectations.cachedArgs(insertId)));
    verifier.verifyTrace(event("MYBATIS", insert2, Expectations.cachedArgs(insertId)));
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)

Example 98 with PluginTestVerifier

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

the class SqlSessionTestBase method testAndVerifySelect.

protected final void testAndVerifySelect() throws Exception {
    // Given
    final String selectId = "selectId";
    SqlSession sqlSession = getSqlSession();
    // When
    sqlSession.select(selectId, new DefaultResultHandler());
    sqlSession.select(selectId, new Object(), new DefaultResultHandler());
    sqlSession.select(selectId, new Object(), RowBounds.DEFAULT, new DefaultResultHandler());
    // Then
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method select1 = sqlSession.getClass().getDeclaredMethod("select", String.class, ResultHandler.class);
    verifier.verifyTrace(event("MYBATIS", select1, Expectations.cachedArgs(selectId)));
    Method select2 = sqlSession.getClass().getDeclaredMethod("select", String.class, Object.class, ResultHandler.class);
    verifier.verifyTrace(event("MYBATIS", select2, Expectations.cachedArgs(selectId)));
    Method select3 = sqlSession.getClass().getDeclaredMethod("select", String.class, Object.class, RowBounds.class, ResultHandler.class);
    verifier.verifyTrace(event("MYBATIS", select3, Expectations.cachedArgs(selectId)));
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) DefaultResultHandler(org.apache.ibatis.executor.result.DefaultResultHandler)

Example 99 with PluginTestVerifier

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

the class SqlSessionTestBase method testAndVerifyInsertWithNullParameter.

protected final void testAndVerifyInsertWithNullParameter() throws Exception {
    // Given
    SqlSession sqlSession = getSqlSession();
    // When
    sqlSession.insert(null);
    // Then
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method insert = sqlSession.getClass().getDeclaredMethod("insert", String.class);
    verifier.verifyTrace(event("MYBATIS", insert));
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)

Example 100 with PluginTestVerifier

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

the class SqlSessionTestBase method testAndVerifyUpdate.

protected final void testAndVerifyUpdate() throws Exception {
    // Given
    final String updateId = "updateId";
    SqlSession sqlSession = getSqlSession();
    // When
    sqlSession.update(updateId);
    sqlSession.update(updateId, new Object());
    // Then
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method update1 = sqlSession.getClass().getDeclaredMethod("update", String.class);
    Method update2 = sqlSession.getClass().getDeclaredMethod("update", String.class, Object.class);
    verifier.verifyTrace(event("MYBATIS", update1, Expectations.cachedArgs(updateId)));
    verifier.verifyTrace(event("MYBATIS", update2, Expectations.cachedArgs(updateId)));
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) 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