use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class HystrixCommand_1_4_1_to_1_4_2_IT method testTraceContinuation.
@Test
public void testTraceContinuation() throws Exception {
String name = "Pinpoint";
executeInvokeSayHelloCommand(name);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
// If the trace is propagated properly to a HystrixCommand's run() method, there should be 6 total traces.
// 3 for InvokeSayHelloCommand, 3 for SayHelloCommand.
verifier.verifyTraceCount(6);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class ObjectMapperIT method testReadValue.
@Test
public void testReadValue() throws Exception {
String json_str = "{\"name\" : \"Jackson\"}";
byte[] json_b = json_str.getBytes("UTF-8");
mapper.readValue(json_str, __POJO.class);
mapper.readValue(json_b, __POJO.class);
ObjectReader reader = mapper.reader(__POJO.class);
reader.readValue(json_str);
reader.readValue(json_b);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method mapperReadValueString = ObjectMapper.class.getMethod("readValue", String.class, Class.class);
Method mapperReadValueBytes = ObjectMapper.class.getMethod("readValue", byte[].class, Class.class);
Method readerReadValueString = ObjectReader.class.getMethod("readValue", String.class);
Method readerReadValueBytes = ObjectReader.class.getMethod("readValue", byte[].class);
verifier.verifyTrace(event(SERVICE_TYPE, mapperReadValueString, annotation(ANNOTATION_KEY, json_str.length())));
verifier.verifyTrace(event(SERVICE_TYPE, mapperReadValueBytes, annotation(ANNOTATION_KEY, json_b.length)));
verifier.verifyTrace(event(SERVICE_TYPE, readerReadValueString, annotation(ANNOTATION_KEY, json_str.length())));
verifier.verifyTrace(event(SERVICE_TYPE, readerReadValueBytes, annotation(ANNOTATION_KEY, json_b.length)));
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class ObjectMapper_1_x_IT method testWriteValue.
@Test()
public void testWriteValue() throws Exception {
__POJO pojo = new __POJO();
pojo.setName("Jackson");
Method mapperWriteValueAsString = getMethod(ObjectMapper.class, "writeValueAsString", Object.class);
Method mapperWriteValueAsBytes = getMethod(ObjectMapper.class, "writeValueAsBytes", Object.class);
Method mapperWriteValue = getMethod(ObjectMapper.class, "writeValue", Writer.class, Object.class);
mapper.writeValue(new OutputStreamWriter(new ByteArrayOutputStream()), pojo);
String jsonString = mapperWriteValueAsString == null ? null : (String) mapperWriteValueAsString.invoke(mapper, pojo);
byte[] jsonBytes = mapperWriteValueAsBytes == null ? null : (byte[]) mapperWriteValueAsBytes.invoke(mapper, pojo);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(event(SERVICE_TYPE, mapperWriteValue));
if (mapperWriteValueAsString != null) {
verifier.verifyTrace(event(SERVICE_TYPE, mapperWriteValueAsString, annotation(ANNOTATION_KEY, jsonString.length())));
}
if (mapperWriteValueAsBytes != null) {
verifier.verifyTrace(event(SERVICE_TYPE, mapperWriteValueAsBytes, annotation(ANNOTATION_KEY, jsonBytes.length)));
}
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class ObjectMapper_1_x_IT method testConstructor.
@Test
public void testConstructor() throws Exception {
ObjectMapper mapper1 = new ObjectMapper();
ObjectMapper mapper2 = new ObjectMapper(new JsonFactory());
Constructor<?> omConstructor1 = ObjectMapper.class.getConstructor();
Constructor<?> omConstructor2 = ObjectMapper.class.getConstructor(JsonFactory.class);
Constructor<?> omConstructor3 = ObjectMapper.class.getConstructor(JsonFactory.class, SerializerProvider.class, DeserializerProvider.class);
Class<?> serializationConfig = null;
Class<?> deserializationConfig = null;
try {
serializationConfig = Class.forName("org.codehaus.jackson.map.SerializationConfig");
deserializationConfig = Class.forName("org.codehaus.jackson.map.DeserializationConfig");
} catch (ClassNotFoundException ignored) {
}
Constructor<?> omConstructor4 = null;
if (serializationConfig != null && deserializationConfig != null) {
omConstructor4 = ObjectMapper.class.getConstructor(JsonFactory.class, SerializerProvider.class, DeserializerProvider.class, serializationConfig, deserializationConfig);
}
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
if (omConstructor4 != null) {
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor4));
}
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor3), event(SERVICE_TYPE, omConstructor1));
if (omConstructor4 != null) {
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor4));
}
verifier.verifyTrace(event(SERVICE_TYPE, omConstructor3), event(SERVICE_TYPE, omConstructor2));
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class PluginDisableIT method test.
@Test
public void test() throws Exception {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "jackson");
mapper.writeValueAsString(map);
mapper.writeValueAsBytes(map);
ObjectWriter writer = mapper.writer();
writer.writeValueAsString(map);
writer.writeValueAsBytes(map);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTraceCount(0);
}
Aggregations