use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class DubboProviderIT method testDoNotTrace.
@Test
public void testDoNotTrace() throws Exception {
when(rpcInvocation.getAttachment(DubboConstants.META_DO_NOT_TRACE)).thenReturn("1");
AbstractProxyInvoker abstractProxyInvoker = new AbstractProxyInvoker(new String(), String.class, url) {
@Override
protected Object doInvoke(Object proxy, String methodName, Class[] parameterTypes, Object[] arguments) throws Throwable {
Method method = proxy.getClass().getMethod(methodName, parameterTypes);
return method.invoke(proxy, arguments);
}
};
try {
abstractProxyInvoker.invoke(rpcInvocation);
} catch (RpcException ignore) {
ignore.printStackTrace();
}
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class DubboProviderIT method testProvider.
@Test
public void testProvider() throws NoSuchMethodException {
AbstractProxyInvoker abstractProxyInvoker = new AbstractProxyInvoker(new String(), String.class, url) {
@Override
protected Object doInvoke(Object proxy, String methodName, Class[] parameterTypes, Object[] arguments) throws Throwable {
Method method = proxy.getClass().getMethod(methodName, parameterTypes);
return method.invoke(proxy, arguments);
}
};
try {
abstractProxyInvoker.invoke(rpcInvocation);
} catch (RpcException ignore) {
ignore.printStackTrace();
}
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTraceCount(1);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class GsonIT method testFromV1_6.
@Test
public void testFromV1_6() throws Exception {
if (!v1_6) {
return;
}
final Gson gson = new Gson();
final JsonElement jsonElement = getParseElements();
/**
* @see Gson#fromJson(JsonReader, InterceptPoint)
*/
gson.fromJson(new JsonReader(new StringReader(json)), String.class);
Method fromJson5 = Gson.class.getDeclaredMethod("fromJson", JsonReader.class, Type.class);
/**
* @see Gson#toJson(Object, InterceptPoint, JsonWriter)
* @see Gson#toJson(JsonElement, JsonWriter)
*/
gson.toJson(java, String.class, new JsonWriter(new StringWriter()));
gson.toJson(jsonElement, new JsonWriter(new StringWriter()));
Method toJson5 = Gson.class.getDeclaredMethod("toJson", Object.class, Type.class, JsonWriter.class);
Method toJson8 = Gson.class.getDeclaredMethod("toJson", JsonElement.class, JsonWriter.class);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(event(serviceType, fromJson5));
verifier.verifyTrace(event(serviceType, toJson5), event(serviceType, toJson8));
// No more traces
verifier.verifyTraceCount(0);
}
use of com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier in project pinpoint by naver.
the class HttpClientIT method test.
@Test
public void test() throws Exception {
HttpClient client = new HttpClient();
client.getParams().setConnectionManagerTimeout(CONNECTION_TIMEOUT);
client.getParams().setSoTimeout(SO_TIMEOUT);
GetMethod method = new GetMethod("http://google.com");
// Provide custom retry handler is necessary
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
method.setQueryString(new NameValuePair[] { new NameValuePair("key2", "value2") });
try {
// Execute the method.
client.executeMethod(method);
} catch (Exception ignored) {
} finally {
method.releaseConnection();
}
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
}
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 testSyncCall.
@Test
public void testSyncCall() throws Exception {
String name = "Pinpoint";
executeSayHelloCommand(name);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method queue = HystrixCommand.class.getMethod("queue");
Class<?> executionObservableClazz = Class.forName(EXECUTION_OBSERVABLE_INNER_CLASS);
Method executioObservableCallCmd = executionObservableClazz.getDeclaredMethod("call", Subscriber.class);
verifier.verifyTrace(Expectations.async(Expectations.event("HYSTRIX_COMMAND", queue, annotation("hystrix.command", SayHelloCommand.class.getSimpleName())), Expectations.event("ASYNC", "Asynchronous Invocation"), Expectations.event("HYSTRIX_COMMAND_INTERNAL", executioObservableCallCmd, annotation("hystrix.command.execution", "run"))));
// no more traces
verifier.verifyTraceCount(0);
}
Aggregations