use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class JsonLibJSONSerializerIT method test.
@Test
public void test() throws Exception {
Method toJSON = JSONSerializer.class.getMethod("toJSON", Object.class);
Method toJava = JSONSerializer.class.getMethod("toJava", JSON.class);
String test = "{'string':'JSON'}";
JSON json = JSONSerializer.toJSON(test);
if (Modifier.isStatic(toJava.getModifiers())) {
toJava.invoke(null, json);
} else {
// JSONSerializer.toJava(JSON) of json-lib 2.0 and below is instance method.
toJava.invoke(new JSONSerializer(), json);
}
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(event(SERVICE_TYPE, toJSON, annotation(ANNOTATION_KEY, test.length())));
verifier.verifyTrace(event("JSON-LIB", toJava));
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class SqlSessionTestBase method testAndVerifySelectMap.
protected final void testAndVerifySelectMap() throws Exception {
// Given
final String selectMapId = "selectListId";
SqlSession sqlSession = getSqlSession();
// When
sqlSession.selectMap(selectMapId, "key");
sqlSession.selectMap(selectMapId, new Object(), "key");
sqlSession.selectMap(selectMapId, new Object(), "key", RowBounds.DEFAULT);
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method selectMap1 = sqlSession.getClass().getDeclaredMethod("selectMap", String.class, String.class);
Method selectMap2 = sqlSession.getClass().getDeclaredMethod("selectMap", String.class, Object.class, String.class);
Method selectMap3 = sqlSession.getClass().getDeclaredMethod("selectMap", String.class, Object.class, String.class, RowBounds.class);
verifier.verifyTrace(event("MYBATIS", selectMap1, Expectations.cachedArgs(selectMapId)));
verifier.verifyTrace(event("MYBATIS", selectMap2, Expectations.cachedArgs(selectMapId)));
verifier.verifyTrace(event("MYBATIS", selectMap3, Expectations.cachedArgs(selectMapId)));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class SqlSessionTestBase method testAndVerifySelectList.
protected final void testAndVerifySelectList() throws Exception {
// Given
final String selectListId = "selectListId";
SqlSession sqlSession = getSqlSession();
// When
sqlSession.selectList(selectListId);
sqlSession.selectList(selectListId, new Object());
sqlSession.selectList(selectListId, new Object(), RowBounds.DEFAULT);
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method selectList1 = sqlSession.getClass().getDeclaredMethod("selectList", String.class);
Method selectList2 = sqlSession.getClass().getDeclaredMethod("selectList", String.class, Object.class);
Method selectList3 = sqlSession.getClass().getDeclaredMethod("selectList", String.class, Object.class, RowBounds.class);
verifier.verifyTrace(event("MYBATIS", selectList1, Expectations.cachedArgs(selectListId)));
verifier.verifyTrace(event("MYBATIS", selectList2, Expectations.cachedArgs(selectListId)));
verifier.verifyTrace(event("MYBATIS", selectList3, Expectations.cachedArgs(selectListId)));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class SqlSessionTestBase method testAndVerifySelectOne.
protected final void testAndVerifySelectOne() throws Exception {
// Given
final String selectOneId = "selectOneId";
SqlSession sqlSession = getSqlSession();
// When
sqlSession.selectOne(selectOneId);
sqlSession.selectOne(selectOneId, new Object());
// Then
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
Method selectOne1 = sqlSession.getClass().getDeclaredMethod("selectOne", String.class);
Method selectOne2 = sqlSession.getClass().getDeclaredMethod("selectOne", String.class, Object.class);
verifier.verifyTrace(event("MYBATIS", selectOne1, Expectations.cachedArgs(selectOneId)));
verifier.verifyTrace(event("MYBATIS", selectOne2, Expectations.cachedArgs(selectOneId)));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class ObjectReaderIT method testReadValue.
@Test
public void testReadValue() throws Exception {
String json_str = "{\"name\" : \"Jackson\"}";
byte[] json_b = json_str.getBytes("UTF-8");
ObjectReader reader = mapper.reader(__POJO.class);
__POJO pojo = reader.readValue(json_str);
pojo = reader.readValue(json_b);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method readval1 = ObjectReader.class.getMethod("readValue", String.class);
Method readval2 = ObjectReader.class.getMethod("readValue", byte[].class);
verifier.verifyTrace(event("JACKSON", readval1, Expectations.annotation("jackson.json.length", json_str.length())));
verifier.verifyTrace(event("JACKSON", readval2, Expectations.annotation("jackson.json.length", json_b.length)));
verifier.verifyTraceCount(0);
}
Aggregations