Package com.alibaba.dubbo.rpc

Examples of com.alibaba.dubbo.rpc.RpcInvocation


     * 预期:可以禁用指定的服务提供者。
     */
    @Test
    public void testNofity_To_Decrease_provider(){
        RegistryDirectory registryDirectory = getRegistryDirectory();
        invocation = new RpcInvocation();
       
        List<URL> durls = new ArrayList<URL>();
        durls.add(SERVICEURL.setHost("10.20.30.140"));
        durls.add(SERVICEURL.setHost("10.20.30.141"));
        registryDirectory.notify(durls);
View Full Code Here


     * 预期:可以禁用指定的服务提供者。
     */
    @Test
    public void testNofity_disabled_specifiedProvider(){
      RegistryDirectory registryDirectory = getRegistryDirectory();
        invocation = new RpcInvocation();
       
        // 初始就禁用
        List<URL> durls = new ArrayList<URL>();
        durls.add(SERVICEURL.setHost("10.20.30.140").addParameter(Constants.ENABLED_KEY, "false"));
        durls.add(SERVICEURL.setHost("10.20.30.141"));
View Full Code Here

        serviceUrls.add(SERVICEURL2.addParameter("methods", "getXXX1,getXXX2"));
        serviceUrls.add(SERVICEURL.setProtocol(Constants.MOCK_PROTOCOL));

        registryDirectory.notify(serviceUrls);
        Assert.assertEquals(true, registryDirectory.isAvailable());
        invocation = new RpcInvocation();

        List invokers = registryDirectory.list(invocation);
        Assert.assertEquals(2, invokers.size());
     
        RpcInvocation mockinvocation = new RpcInvocation();
        mockinvocation.setAttachment(Constants.INVOCATION_NEED_MOCK, "true");
        invokers = registryDirectory.list(mockinvocation);
        Assert.assertEquals(1, invokers.size());
    }
View Full Code Here

        URL dubbo2URL = URL.valueOf("injvm://127.0.0.1:9099?lazy=true&methods=getXXX");
        serviceUrls.add(dubbo1URL);
        serviceUrls.add(dubbo2URL);
        registryDirectory.notify(serviceUrls);

        invocation = new RpcInvocation();

        List<Invoker<DemoService>> invokers = registryDirectory.list(invocation);
        Assert.assertEquals(2, invokers.size());
    }
View Full Code Here

        URL dubbo2URL = URL.valueOf("injvm://127.0.0.1:9098?lazy=true&methods=getXXX");
        serviceUrls.add(dubbo1URL);
        serviceUrls.add(dubbo2URL);
        registryDirectory.notify(serviceUrls);

        invocation = new RpcInvocation();

        List<Invoker<DemoService>> invokers = registryDirectory.list(invocation);
        Assert.assertEquals(1, invokers.size());
    }
View Full Code Here

        URL dubbo2URL = URL.valueOf("injvm://127.0.0.1:9099?lazy=true&methods=getXXX");
        serviceUrls.add(dubbo1URL);
        serviceUrls.add(dubbo2URL);
        registryDirectory.notify(serviceUrls);

        invocation = new RpcInvocation();

        List<Invoker<DemoService>> invokers = registryDirectory.list(invocation);
        Assert.assertEquals(2, invokers.size());
    }
View Full Code Here

    Protocol protocol = new MockProtocol();
    Invoker<IHelloService> mInvoker1 = protocol.refer(IHelloService.class, mockUrl);
    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

    Protocol protocol = new MockProtocol();
    Invoker<IHelloService> mInvoker1 = protocol.refer(IHelloService.class, mockUrl);
    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

    Protocol protocol = new MockProtocol();
    Invoker<IHelloService> mInvoker1 = protocol.refer(IHelloService.class, mockUrl);
    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

   
    Protocol protocol = new MockProtocol();
    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.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.