Search in sources :

Example 1 with AbstractProxyInvoker

use of com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker 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);
}
Also used : RpcException(com.alibaba.dubbo.rpc.RpcException) Method(java.lang.reflect.Method) AbstractProxyInvoker(com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Example 2 with AbstractProxyInvoker

use of com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker 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);
}
Also used : RpcException(com.alibaba.dubbo.rpc.RpcException) Method(java.lang.reflect.Method) AbstractProxyInvoker(com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Aggregations

RpcException (com.alibaba.dubbo.rpc.RpcException)2 AbstractProxyInvoker (com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker)2 PluginTestVerifier (com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier)2 Method (java.lang.reflect.Method)2 Test (org.junit.Test)2