Search in sources :

Example 11 with DemoService

use of com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoService in project dubbo by alibaba.

the class RpcFilterTest method testRpcFilter.

public void testRpcFilter() throws Exception {
    DemoService service = new DemoServiceImpl();
    URL url = URL.valueOf("dubbo://127.0.0.1:9010/com.alibaba.dubbo.rpc.DemoService?service.filter=echo");
    protocol.export(proxy.getInvoker(service, DemoService.class, url));
    service = proxy.getProxy(protocol.refer(DemoService.class, url));
    assertEquals("123", service.echo("123"));
    // cast to EchoService
    EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, url));
    assertEquals(echo.$echo("test"), "test");
    assertEquals(echo.$echo("abcdefg"), "abcdefg");
    assertEquals(echo.$echo(1234), 1234);
}
Also used : EchoService(com.alibaba.dubbo.rpc.service.EchoService) DemoService(com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoService) URL(com.alibaba.dubbo.common.URL) DemoServiceImpl(com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoServiceImpl)

Aggregations

DemoService (com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoService)11 DemoServiceImpl (com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoServiceImpl)9 Test (org.junit.Test)9 EchoService (com.alibaba.dubbo.rpc.service.EchoService)4 URL (com.alibaba.dubbo.common.URL)3 RpcException (com.alibaba.dubbo.rpc.RpcException)2 RpcResult (com.alibaba.dubbo.rpc.RpcResult)2 Type (com.alibaba.dubbo.rpc.protocol.dubbo.support.Type)2 HashMap (java.util.HashMap)2 Result (com.alibaba.dubbo.rpc.Result)1 NonSerialized (com.alibaba.dubbo.rpc.protocol.dubbo.support.NonSerialized)1 RemoteService (com.alibaba.dubbo.rpc.protocol.dubbo.support.RemoteService)1 RemoteServiceImpl (com.alibaba.dubbo.rpc.protocol.dubbo.support.RemoteServiceImpl)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1