Search in sources :

Example 36 with PluginTestVerifier

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

the class ObjectReaderIT method testWriteValue.

@Test
public void testWriteValue() throws Exception {
    __POJO pojo = new __POJO();
    pojo.setName("Jackson");
    ObjectWriter writer = mapper.writer();
    String jsonStr = writer.writeValueAsString(pojo);
    byte[] jsonByte = writer.writeValueAsBytes(pojo);
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();
    Method writeval1 = ObjectWriter.class.getMethod("writeValueAsString", Object.class);
    Method writeval2 = ObjectWriter.class.getMethod("writeValueAsBytes", Object.class);
    verifier.verifyTrace(event("JACKSON", writeval1, annotation("jackson.json.length", jsonStr.length())));
    verifier.verifyTrace(event("JACKSON", writeval2, annotation("jackson.json.length", jsonByte.length)));
    verifier.verifyTraceCount(0);
}
Also used : ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Example 37 with PluginTestVerifier

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

the class MariaDB_1_4_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")));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Example 38 with PluginTestVerifier

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

the class MariaDB_1_4_x_IT method testStatement.

@Test
public void testStatement() throws Exception {
    super.executeStatement();
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();
    // 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")));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Example 39 with PluginTestVerifier

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

the class OkHttpClientBackwardCompatibilityIT method execute.

@Test
public void execute() throws Exception {
    Request request = new Request.Builder().url("http://google.com").build();
    OkHttpClient client = new OkHttpClient();
    Response response = client.newCall(request).execute();
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();
    Method callMethod = Call.class.getDeclaredMethod("execute");
    verifier.verifyTrace(Expectations.event("OK_HTTP_CLIENT_INTERNAL", callMethod));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Example 40 with PluginTestVerifier

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

the class OkHttpClientIT method execute.

@Test
public void execute() throws Exception {
    Request request = new Request.Builder().url("http://google.com").build();
    OkHttpClient client = new OkHttpClient();
    Response response = client.newCall(request).execute();
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();
    Method callMethod = Call.class.getDeclaredMethod("execute");
    verifier.verifyTrace(Expectations.event("OK_HTTP_CLIENT_INTERNAL", callMethod));
}
Also used : Method(java.lang.reflect.Method) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

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