Package com.alibaba.dubbo.rpc

Examples of com.alibaba.dubbo.rpc.Result


    public void testInvokeNoExceptoin() {
       
        resetInvoker1ToNoException();
       
        FailfastClusterInvoker<FailfastClusterInvokerTest> invoker = new FailfastClusterInvoker<FailfastClusterInvokerTest>(dic);
        Result ret = invoker.invoke(invocation);
        Assert.assertSame(result, ret);
    }
View Full Code Here


        resetInvokerToNoException();

        FailbackClusterInvoker<FailbackClusterInvokerTest> invoker = new FailbackClusterInvoker<FailbackClusterInvokerTest>(
                                                                                                                            dic);
        Result ret = invoker.invoke(invocation);
        Assert.assertSame(result, ret);
    }
View Full Code Here

        EasyMock.expect(invoker2.getInterface()).andReturn(FailoverClusterInvokerTest.class).anyTimes();
        EasyMock.replay(invoker2);
       
        FailoverClusterInvoker<FailoverClusterInvokerTest> invoker = new FailoverClusterInvoker<FailoverClusterInvokerTest>(dic);
        for(int i=0;i<100;i++){
            Result ret = invoker.invoke(invocation);
            assertSame(result, ret);
        }
    }
View Full Code Here

        EasyMock.expect(invoker2.getInterface()).andReturn(FailoverClusterInvokerTest.class).anyTimes();
        EasyMock.replay(invoker2);
       
        FailoverClusterInvoker<FailoverClusterInvokerTest> invoker = new FailoverClusterInvoker<FailoverClusterInvokerTest>(dic);
        try{
            Result ret = invoker.invoke(invocation);
            assertSame(result, ret);
            fail();
        }catch (RpcException expected) {
            assertTrue(expected.isTimeout());
            assertTrue(expected.getMessage().indexOf((retries+1)+" times")>0);
View Full Code Here

    public void testInvokeNoExceptoin() {
       
        resetInvokerToNoException();
       
        FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
        Result ret = invoker.invoke(invocation);
        Assert.assertSame(result, ret);
    }
View Full Code Here

    @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());
    }
View Full Code Here

    invokers.add(mInvoker1);
       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("something", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
        ret = cluster.invoke(invocation);
        Assert.assertEquals(null, ret.getValue());
  }
View Full Code Here

    invokers.add(mInvoker1);
       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("aa", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething2");
        ret = cluster.invoke(invocation);
        Assert.assertEquals(null, ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
        ret = cluster.invoke(invocation);
        Assert.assertEquals(null, ret.getValue());
  }
View Full Code Here

    invokers.add(mInvoker1);
     
    //方法配置了mock
      RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
      Result ret = cluster.invoke(invocation);
      Assert.assertEquals("aa", ret.getValue());
     
    //如果没有配置mock,则直接返回null
      invocation = new RpcInvocation();
    invocation.setMethodName("getSomething2");
      ret = cluster.invoke(invocation);
      Assert.assertEquals(null, ret.getValue());
     
      //如果没有配置mock,则直接返回null
      invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
      ret = cluster.invoke(invocation);
      Assert.assertEquals(null, ret.getValue());
  }
View Full Code Here

    Invoker<IHelloService> mInvoker1 = protocol.refer(IHelloService.class, mockUrl);
    invokers.add(mInvoker1);
     
      RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
      Result ret = cluster.invoke(invocation);
      Assert.assertEquals(null, ret.getValue());
  }
View Full Code Here

TOP

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

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.