Search in sources :

Example 6 with ExpectedTrace

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

the class AsyncEchoTestClient method verifyTraces.

@Override
public void verifyTraces(PluginTestVerifier verifier, String expectedMessage) throws Exception {
    final InetSocketAddress actualServerAddress = this.environment.getServerAddress();
    // ********** Asynchronous Traces
    // SpanEvent - Asynchronous Invocation
    ExpectedTrace asyncInvocationTrace = event("ASYNC", "Asynchronous Invocation");
    // SpanEvent - TAsyncMethodCall.cleanUpAndFireCallback
    Method cleanUpAndFireCallback = TAsyncMethodCall.class.getDeclaredMethod("cleanUpAndFireCallback", SelectionKey.class);
    ExpectedTrace cleanUpAndFireCallbackTrace = event("THRIFT_CLIENT_INTERNAL", cleanUpAndFireCallback);
    // SpanEvent - TServiceClient.receiveBase
    Method receiveBase = TServiceClient.class.getDeclaredMethod("receiveBase", TBase.class, String.class);
    ExpectedAnnotation thriftResult = Expectations.annotation("thrift.result", "echo_result(success:" + expectedMessage + ")");
    ExpectedTrace receiveBaseTrace = event(// ServiceType
    "THRIFT_CLIENT_INTERNAL", // Method
    receiveBase, // Annotation("thrift.result")
    thriftResult);
    // ********** Root trace for Asynchronous traces
    // SpanEvent - TAsyncClientManager.call
    Method call = TAsyncClientManager.class.getDeclaredMethod("call", TAsyncMethodCall.class);
    ExpectedAnnotation thriftUrl = Expectations.annotation("thrift.url", actualServerAddress.getHostName() + ":" + actualServerAddress.getPort() + "/com/navercorp/pinpoint/plugin/thrift/dto/EchoService/echo_call");
    ExpectedTrace callTrace = event(// ServiceType
    "THRIFT_CLIENT", // Method
    call, // rpc
    null, // endPoint
    null, // destinationId
    actualServerAddress.getHostName() + ":" + actualServerAddress.getPort(), // Annotation("thrift.url")
    thriftUrl);
    verifier.verifyTrace(async(callTrace, asyncInvocationTrace, cleanUpAndFireCallbackTrace, receiveBaseTrace));
}
Also used : ExpectedTrace(com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace) ExpectedAnnotation(com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation) InetSocketAddress(java.net.InetSocketAddress) Method(java.lang.reflect.Method)

Aggregations

ExpectedTrace (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace)6 Method (java.lang.reflect.Method)4 PluginTestVerifier (com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)3 Test (org.junit.Test)2 ExpectedAnnotation (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation)1 InetSocketAddress (java.net.InetSocketAddress)1 URI (java.net.URI)1