use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class ActiveMQClientITBase method verifyConsumerPushEvent.
/**
* Verifies spans and span events for when {@link ActiveMQMessageConsumer} receives the message and invokes it's
* {@link javax.jms.MessageListener MessageListener}. (trace count : 1)
*
* @param destination the destination from which the consumer is receiving the message
* @throws Exception
*/
private void verifyConsumerPushEvent(ActiveMQDestination destination) throws Exception {
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
URI consumerBrokerUri = new URI(getConsumerBrokerUrl());
verifier.verifyDiscreteTrace(root(// serviceType
ACTIVEMQ_CLIENT, // method
"ActiveMQ Consumer Invocation", // rpc
destination.getQualifiedName(), // endPoint (collected but there's no easy way to retrieve local address so skip check)
null, // remoteAddress
consumerBrokerUri.getHost() + ":" + consumerBrokerUri.getPort()));
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class ActiveMQClientITBase method awaitAndVerifyTraceCount.
protected final void awaitAndVerifyTraceCount(int expectedTraceCount, long maxWaitMs) throws InterruptedException {
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
final long waitIntervalMs = 100L;
long maxWaitTime = maxWaitMs;
if (maxWaitMs < waitIntervalMs) {
maxWaitTime = waitIntervalMs;
}
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() - startTime < maxWaitTime) {
try {
verifier.verifyTraceCount(expectedTraceCount);
return;
} catch (AssertionError e) {
// ignore and retry
Thread.sleep(waitIntervalMs);
}
}
verifier.printCache();
verifier.verifyTraceCount(expectedTraceCount);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class SpringWebMvcIT method testRequest.
@Test
public void testRequest() throws Exception {
MockServletConfig config = new MockServletConfig();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
config.addInitParameter("contextConfigLocation", "classpath:spring-web-test.xml");
req.setMethod("GET");
req.setRequestURI("/");
req.setRemoteAddr("1.2.3.4");
DispatcherServlet servlet = new DispatcherServlet();
servlet.init(config);
servlet.service(req, res);
Method method = FrameworkServlet.class.getDeclaredMethod("doGet", HttpServletRequest.class, HttpServletResponse.class);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(Expectations.event(SPRING_MVC, method));
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class JsonLibJSONObjectIT method mapToJsonTest.
@Test
public void mapToJsonTest() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "pinpoint");
map.put("lib", "json-lib");
JSONObject jsonObject = JSONObject.fromObject(map);
String json = jsonObject.toString();
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method fromObject = JSONObject.class.getMethod("fromObject", Object.class);
Method toString = JSONObject.class.getMethod("toString");
verifier.verifyTrace(event(SERVICE_TYPE, fromObject));
verifier.verifyTrace(event(SERVICE_TYPE, toString, annotation(ANNOTATION_KEY, json.length())));
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class JsonLibJSONObjectIT method jsonToBeanTest.
@Test
public void jsonToBeanTest() throws Exception {
String json = "{'string':'JSON'}";
JSONObject jsonObject = JSONObject.fromObject(json);
JSONObject.toBean(jsonObject);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method fromObject = JSONObject.class.getMethod("fromObject", Object.class);
Method toBean = JSONObject.class.getMethod("toBean", JSONObject.class);
verifier.verifyTrace(event(SERVICE_TYPE, fromObject, annotation(ANNOTATION_KEY, json.length())));
verifier.verifyTrace(event(SERVICE_TYPE, toBean));
verifier.verifyTraceCount(0);
}
Aggregations