Search in sources :

Example 6 with MyInvoker

use of org.apache.dubbo.rpc.support.MyInvoker in project dubbo by alibaba.

the class AbstractProxyTest method testGetProxy.

@Test
public void testGetProxy() throws Exception {
    URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1");
    Invoker<DemoService> invoker = new MyInvoker<>(url);
    DemoService proxy = factory.getProxy(invoker);
    Assertions.assertNotNull(proxy);
    Assertions.assertTrue(Arrays.asList(proxy.getClass().getInterfaces()).contains(DemoService.class));
    // Not equal
    // Assertions.assertEquals(proxy.toString(), invoker.toString());
    // Assertions.assertEquals(proxy.hashCode(), invoker.hashCode());
    Assertions.assertEquals(invoker.invoke(new RpcInvocation("echo", DemoService.class.getName(), DemoService.class.getName() + ":dubbo", new Class[] { String.class }, new Object[] { "aa" })).getValue(), proxy.echo("aa"));
}
Also used : RpcInvocation(org.apache.dubbo.rpc.RpcInvocation) DemoService(org.apache.dubbo.rpc.support.DemoService) MyInvoker(org.apache.dubbo.rpc.support.MyInvoker) URL(org.apache.dubbo.common.URL) Test(org.junit.jupiter.api.Test)

Example 7 with MyInvoker

use of org.apache.dubbo.rpc.support.MyInvoker in project dubbo by alibaba.

the class ActiveLimitFilterTest method testInvokeNoActives.

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

Example 8 with MyInvoker

use of org.apache.dubbo.rpc.support.MyInvoker in project dubbo by alibaba.

the class ContextFilterTest method testWithAttachments.

@Test
public void testWithAttachments() {
    URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1");
    Invoker<DemoService> invoker = new MyInvoker<DemoService>(url);
    Invocation invocation = new MockInvocation();
    Result result = contextFilter.invoke(invoker, invocation);
    assertNull(RpcContext.getContext().getInvoker());
}
Also used : Invocation(org.apache.dubbo.rpc.Invocation) MockInvocation(org.apache.dubbo.rpc.support.MockInvocation) DemoService(org.apache.dubbo.rpc.support.DemoService) MockInvocation(org.apache.dubbo.rpc.support.MockInvocation) MyInvoker(org.apache.dubbo.rpc.support.MyInvoker) URL(org.apache.dubbo.common.URL) Result(org.apache.dubbo.rpc.Result) Test(org.junit.jupiter.api.Test)

Example 9 with MyInvoker

use of org.apache.dubbo.rpc.support.MyInvoker in project dubbo by alibaba.

the class TpsLimitFilterTest method testWithoutCount.

@Test
public void testWithoutCount() throws Exception {
    URL url = URL.valueOf("test://test");
    url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService");
    url = url.addParameter(TPS_LIMIT_RATE_KEY, 5);
    Invoker<TpsLimitFilterTest> invoker = new MyInvoker<TpsLimitFilterTest>(url);
    Invocation invocation = new MockInvocation();
    filter.invoke(invoker, invocation);
}
Also used : Invocation(org.apache.dubbo.rpc.Invocation) MockInvocation(org.apache.dubbo.rpc.support.MockInvocation) MockInvocation(org.apache.dubbo.rpc.support.MockInvocation) MyInvoker(org.apache.dubbo.rpc.support.MyInvoker) URL(org.apache.dubbo.common.URL) Test(org.junit.jupiter.api.Test)

Example 10 with MyInvoker

use of org.apache.dubbo.rpc.support.MyInvoker in project dubbo by alibaba.

the class AccessLogFilterTest method testCustom.

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

Aggregations

MyInvoker (org.apache.dubbo.rpc.support.MyInvoker)10 Test (org.junit.jupiter.api.Test)10 URL (org.apache.dubbo.common.URL)9 Invocation (org.apache.dubbo.rpc.Invocation)9 MockInvocation (org.apache.dubbo.rpc.support.MockInvocation)8 DemoService (org.apache.dubbo.rpc.support.DemoService)3 BlockMyInvoker (org.apache.dubbo.rpc.support.BlockMyInvoker)2 Field (java.lang.reflect.Field)1 URLClassLoader (java.net.URLClassLoader)1 Map (java.util.Map)1 Queue (java.util.Queue)1 Invoker (org.apache.dubbo.rpc.Invoker)1 Result (org.apache.dubbo.rpc.Result)1 RpcException (org.apache.dubbo.rpc.RpcException)1 RpcInvocation (org.apache.dubbo.rpc.RpcInvocation)1 AccessLogData (org.apache.dubbo.rpc.support.AccessLogData)1