Search in sources :

Example 1 with Invocation

use of com.alibaba.dubbo.rpc.Invocation in project uavstack by uavorg.

the class DubboProviderAdapter method afterPreCap.

@Override
public void afterPreCap(InvokeChainContext context, Object[] args) {
    String url = (String) context.get(CaptureConstants.INFO_APPSERVER_CONNECTOR_REQUEST_URL);
    Span span = this.spanFactory.getSpanFromContext(url);
    if (UAVServer.instance().isExistSupportor("com.creditease.uav.apm.supporters.SlowOperSupporter")) {
        SlowOperContext slowOperContext = new SlowOperContext();
        // dubbo虽属于rpc,但从其使用方式上属于方法级
        Invocation invocation = (Invocation) args[1];
        slowOperContext.put(SlowOperConstants.PROTOCOL_METHOD_PARAMS, parseParams(invocation.getArguments()));
        Object[] params = { span, slowOperContext };
        UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.SlowOperSupporter", "runCap", span.getEndpointInfo().split(",")[0], InvokeChainConstants.CapturePhase.PRECAP, context, params);
    }
}
Also used : SlowOperContext(com.creditease.uav.apm.slowoper.spi.SlowOperContext) Invocation(com.alibaba.dubbo.rpc.Invocation) Span(com.creditease.uav.apm.invokechain.span.Span)

Example 2 with Invocation

use of com.alibaba.dubbo.rpc.Invocation in project dubbo by alibaba.

the class AccessLogFilterTest method testInvokeException.

// Test filter won't throw an exception
@Test
public void testInvokeException() {
    Invoker<AccessLogFilterTest> invoker = new MyInvoker<AccessLogFilterTest>(null);
    Invocation invocation = new MockInvocation();
    LogUtil.start();
    accessLogFilter.invoke(invoker, invocation);
    assertEquals(1, LogUtil.findMessage("Exception in AcessLogFilter of service"));
    LogUtil.stop();
}
Also used : MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) Invocation(com.alibaba.dubbo.rpc.Invocation) MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) MyInvoker(com.alibaba.dubbo.rpc.support.MyInvoker) Test(org.junit.Test)

Example 3 with Invocation

use of com.alibaba.dubbo.rpc.Invocation in project dubbo by alibaba.

the class AccessLogFilterTest method testCustom.

@Test
public void testCustom() {
    URL url = URL.valueOf("test://test:11/test?accesslog=alibaba");
    Invoker<AccessLogFilterTest> invoker = new MyInvoker<AccessLogFilterTest>(url);
    Invocation invocation = new MockInvocation();
    accessLogFilter.invoke(invoker, invocation);
}
Also used : MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) Invocation(com.alibaba.dubbo.rpc.Invocation) MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) MyInvoker(com.alibaba.dubbo.rpc.support.MyInvoker) URL(com.alibaba.dubbo.common.URL) Test(org.junit.Test)

Example 4 with Invocation

use of com.alibaba.dubbo.rpc.Invocation in project dubbo by alibaba.

the class AccessLogFilterTest method testDefault.

// TODO how to assert thread action
@Test
public void testDefault() {
    URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1");
    Invoker<AccessLogFilterTest> invoker = new MyInvoker<AccessLogFilterTest>(url);
    Invocation invocation = new MockInvocation();
    accessLogFilter.invoke(invoker, invocation);
}
Also used : MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) Invocation(com.alibaba.dubbo.rpc.Invocation) MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) MyInvoker(com.alibaba.dubbo.rpc.support.MyInvoker) URL(com.alibaba.dubbo.common.URL) Test(org.junit.Test)

Example 5 with Invocation

use of com.alibaba.dubbo.rpc.Invocation in project dubbo by alibaba.

the class ActiveLimitFilterTest method testInvokeLessActives.

@Test
public void testInvokeLessActives() {
    URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=10");
    Invoker<ActiveLimitFilterTest> invoker = new MyInvoker<ActiveLimitFilterTest>(url);
    Invocation invocation = new MockInvocation();
    activeLimitFilter.invoke(invoker, invocation);
}
Also used : MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) Invocation(com.alibaba.dubbo.rpc.Invocation) MockInvocation(com.alibaba.dubbo.rpc.support.MockInvocation) MyInvoker(com.alibaba.dubbo.rpc.support.MyInvoker) BlockMyInvoker(com.alibaba.dubbo.rpc.support.BlockMyInvoker) URL(com.alibaba.dubbo.common.URL) Test(org.junit.Test)

Aggregations

Invocation (com.alibaba.dubbo.rpc.Invocation)47 URL (com.alibaba.dubbo.common.URL)31 Test (org.junit.Test)30 Result (com.alibaba.dubbo.rpc.Result)15 Invoker (com.alibaba.dubbo.rpc.Invoker)14 RpcInvocation (com.alibaba.dubbo.rpc.RpcInvocation)14 RpcResult (com.alibaba.dubbo.rpc.RpcResult)12 DemoService (com.alibaba.dubbo.rpc.support.DemoService)11 MockInvocation (com.alibaba.dubbo.rpc.support.MockInvocation)11 MyInvoker (com.alibaba.dubbo.rpc.support.MyInvoker)10 RpcException (com.alibaba.dubbo.rpc.RpcException)9 ArrayList (java.util.ArrayList)4 Router (com.alibaba.dubbo.rpc.cluster.Router)3 BlockMyInvoker (com.alibaba.dubbo.rpc.support.BlockMyInvoker)3 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 Test (org.junit.jupiter.api.Test)3 Cache (com.alibaba.dubbo.cache.Cache)2 CacheFactory (com.alibaba.dubbo.cache.CacheFactory)2 MonitorService (com.alibaba.dubbo.monitor.MonitorService)2