Package com.alibaba.dubbo.rpc

Examples of com.alibaba.dubbo.rpc.RpcInvocation


        Router router = new ScriptRouterFactory().getRouter(getRouteUrl("function route(op1,op2){return op1} route(invokers)"));
        List<Invoker<String>> invokers = new ArrayList<Invoker<String>>();
        invokers.add(new MockInvoker<String>());
        invokers.add(new MockInvoker<String>());
        invokers.add(new MockInvoker<String>());
        List<Invoker<String>> fileredInvokers = router.route(invokers, invokers.get(0).getUrl(), new RpcInvocation());
        Assert.assertEquals(invokers, fileredInvokers);
    }
View Full Code Here


        Invoker<String> invoker2 = new MockInvoker<String>(true) ;
        Invoker<String> invoker3 = new MockInvoker<String>(true) ;
        invokers.add(invoker1);
        invokers.add(invoker2);
        invokers.add(invoker3);
        List<Invoker<String>> fileredInvokers = router.route(invokers, invokers.get(0).getUrl(), new RpcInvocation());
        Assert.assertEquals(2, fileredInvokers.size());
        Assert.assertEquals(invoker2, fileredInvokers.get(0));
        Assert.assertEquals(invoker3, fileredInvokers.get(1));
    }
View Full Code Here

      }
    };
    invoker1.setCallable(callable);
        invoker2.setCallable(callable);
       
        RpcInvocation inv = new RpcInvocation();
        inv.setMethodName("test");
       
        Directory<Demo> dic = new MockDirectory<Demo>(url, invokers);
       
        FailoverClusterInvoker<Demo> clusterinvoker = new FailoverClusterInvoker<Demo>(dic);
        clusterinvoker.invoke(inv);
View Full Code Here

        URL url = URL.valueOf(filename);
        return url;
    }

    private void initInvocation(String methodName) {
        invocation = new RpcInvocation();
        ((RpcInvocation)invocation).setMethodName(methodName);
    }
View Full Code Here

    Filter                    eventFilter = new FutureFilter();
    private static RpcInvocation invocation;

    @BeforeClass
    public static void setUp() {
        invocation = new RpcInvocation();
        invocation.setMethodName("echo");
        invocation.setParameterTypes(new Class<?>[] { Enum.class });
        invocation.setArguments(new Object[] { "hello" });
    }
View Full Code Here

    }

    @Before
    public void setUp() throws Exception {
        dic = EasyMock.createMock(Directory.class);
        invocation = new RpcInvocation();
       
        EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
        EasyMock.expect(dic.list(invocation)).andReturn(invokers).anyTimes();
        EasyMock.expect(dic.getInterface()).andReturn(StickyTest.class).anyTimes();
        EasyMock.replay(dic);
View Full Code Here

        obj = ( ( Request ) obj ).getData();

        Assert.assertTrue( obj instanceof RpcInvocation );

        RpcInvocation invocation = ( RpcInvocation ) obj;

        Assert.assertEquals( "echoString", invocation.getMethodName() );
        Assert.assertArrayEquals( new Class[] {String .class}, invocation.getParameterTypes() );
        Assert.assertArrayEquals( new Object[] { args.getArg() }, invocation.getArguments() );

    }
View Full Code Here

    }

    private Request createRequest() {

        RpcInvocation invocation = new RpcInvocation();

        invocation.setMethodName( "echoString" );

        invocation.setArguments( new Object[]{ "Hello, World!" } );

        invocation.setParameterTypes( new Class<?>[]{ String.class } );

        invocation.setAttachment( Constants.INTERFACE_KEY, Demo.Iface.class.getName() );

        Request request = new Request( 1L );

        request.setData( invocation );
View Full Code Here

   
    @Test
    public void testFilter() throws Exception {
        MonitorFilter monitorFilter = new MonitorFilter();
        monitorFilter.setMonitorFactory(monitorFactory);
        Invocation invocation = new RpcInvocation("aaa", new Class<?>[0], new Object[0]);
        RpcContext.getContext().setRemoteAddress(NetUtils.getLocalHost(), 20880).setLocalAddress(NetUtils.getLocalHost(), 2345);
        monitorFilter.invoke(serviceInvoker, invocation);
        while (lastStatistics == null) {
            Thread.sleep(10);
        }
View Full Code Here

    @Test
    public void testGenericFilter() throws Exception {
        MonitorFilter monitorFilter = new MonitorFilter();
        monitorFilter.setMonitorFactory(monitorFactory);
        Invocation invocation = new RpcInvocation("$invoke", new Class<?>[] { String.class, String[].class, Object[].class }, new Object[] { "xxx", new String[] {}, new Object[] {} } );
        RpcContext.getContext().setRemoteAddress(NetUtils.getLocalHost(), 20880).setLocalAddress(NetUtils.getLocalHost(), 2345);
        monitorFilter.invoke(serviceInvoker, invocation);
        while (lastStatistics == null) {
            Thread.sleep(10);
        }
View Full Code Here

TOP

Related Classes of com.alibaba.dubbo.rpc.RpcInvocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.