Package com.alibaba.dubbo.rpc

Examples of com.alibaba.dubbo.rpc.RpcInvocation


    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName())
        .addParameter("getSomething.mock","fail:return x")
        .addParameter("getSomething2.mock","force:return y");
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了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("getSomething2");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("y", ret.getValue());
       
      //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething3");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("something3", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
        ret = cluster.invoke(invocation);
        Assert.assertEquals(null, ret.getValue());
  }
View Full Code Here


        .addParameter("getSomething.mock","fail:return x")
        .addParameter("getSomething2.mock","force:return y")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething2");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("y", ret.getValue());
       
      //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething3");
    try {
      ret = cluster.invoke(invocation);
      Assert.fail();
    }catch (RpcException e) {
     
View Full Code Here

        .addParameter("getSomething.mock","fail:return x")
        .addParameter("getSomething2.mock","force:return y")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething2");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("y", ret.getValue());
       
      //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething3");
        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

        .addParameter("getSomething.mock","fail:return x")
        .addParameter("getSomething2.mock","force:return y")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething2");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("y", ret.getValue());
       
      //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething3");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("z", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("z", ret.getValue());
  }
View Full Code Here

        .addParameter("getSomething.mock","fail:return x")
        .addParameter("getSomething2.mock","force:return y")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething2");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("y", ret.getValue());
       
      //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething3");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("z", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("z", ret.getValue());
  }
View Full Code Here

    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName())
        .addParameter("mock","fail:return x")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething2");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
       
      //如d
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("sayHello");
        ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
  }
View Full Code Here

    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName())
        .addParameter("getSomething.mock","return x")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("x", ret.getValue());
       
        //如果没有配置mock,则直接返回null
        invocation = new RpcInvocation();
    invocation.setMethodName("getSomething3");
    try{
      ret = cluster.invoke(invocation);
      Assert.fail("fail invoke");
    }catch(RpcException e){
     
View Full Code Here

    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName())
        .addParameter("mock","true")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("somethingmock", ret.getValue());
  }
View Full Code Here

    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName())
        .addParameter("mock","fail")
        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("somethingmock", ret.getValue());
  }
View Full Code Here

  public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock3(){
    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName())
        .addParameter("mock","force");
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals("somethingmock", ret.getValue());
  }
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.