Package com.alibaba.dubbo.rpc

Examples of com.alibaba.dubbo.rpc.Result


        .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


        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getSomething");
        Result ret = cluster.invoke(invocation);
        Assert.assertTrue("result type must be String but was : " + ret.getValue().getClass(), ret.getValue() instanceof String);
        Assert.assertEquals("1688", (String)ret.getValue());
  }
View Full Code Here

        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getInt1");
        Result ret = cluster.invoke(invocation);
        Assert.assertTrue("result type must be integer but was : " + ret.getValue().getClass(), ret.getValue() instanceof Integer);
        Assert.assertEquals(new Integer(1688), (Integer)ret.getValue());
  }
View Full Code Here

        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getBoolean1");
        Result ret = cluster.invoke(invocation);
        Assert.assertTrue("result type must be Boolean but was : " + ret.getValue().getClass(), ret.getValue() instanceof Boolean);
        Assert.assertEquals(true, Boolean.parseBoolean(ret.getValue().toString()));
  }
View Full Code Here

        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getBoolean2");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals(true, Boolean.parseBoolean(ret.getValue().toString()));
  }
View Full Code Here

        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getListString");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals(0, ((List<String>)ret.getValue()).size());
  }
View Full Code Here

        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getListString");
        Result ret = cluster.invoke(invocation);
        List<String> rl = (List<String>)ret.getValue();
        Assert.assertEquals(2, rl.size());
        Assert.assertEquals("hi", rl.get(0));
  }
View Full Code Here

        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getUsers");
        Result ret = cluster.invoke(invocation);
        Assert.assertEquals(0, ((List<User>)ret.getValue()).size());
  }
View Full Code Here

        .addParameter("invoke_return_error", "true" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
    //方法配置了mock
        RpcInvocation invocation = new RpcInvocation();
    invocation.setMethodName("getUsers");
        Result ret = cluster.invoke(invocation);
        List<User> rl = (List<User>)ret.getValue();
        System.out.println(rl);
        Assert.assertEquals(2, rl.size());
        Assert.assertEquals("hi1", ((User)rl.get(0)).getName());
  }
View Full Code Here

        String arg = "Hello, World!";

        invocation.setArguments( new Object[] { arg } );

        Result result = invoker.invoke( invocation );

        System.out.println( result );

    }
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.