Package com.alibaba.dubbo.common

Examples of com.alibaba.dubbo.common.URL.addParameter()


        EasyMock.expect(invoker4.getInterface()).andReturn(IHelloService.class).anyTimes();
        EasyMock.expect(invoker4.getUrl()).andReturn(turl.addParameter("name", "invoker4")).anyTimes();
       
        EasyMock.expect(invoker5.isAvailable()).andReturn(false).anyTimes();
        EasyMock.expect(invoker5.getInterface()).andReturn(IHelloService.class).anyTimes();
        EasyMock.expect(invoker5.getUrl()).andReturn(turl.addParameter("name", "invoker5")).anyTimes();
       
        EasyMock.expect(mockedInvoker1.isAvailable()).andReturn(false).anyTimes();
        EasyMock.expect(mockedInvoker1.getInterface()).andReturn(IHelloService.class).anyTimes();
        EasyMock.expect(mockedInvoker1.getUrl()).andReturn(turl.setProtocol("mock")).anyTimes();
       
View Full Code Here


    }

    @Test
    public void testServerHeartbeat() throws Exception {
        URL serverURL = URL.valueOf("header://localhost:55555");
        serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
        TestHeartbeatHandler handler = new TestHeartbeatHandler();
        server = Exchangers.bind(serverURL, handler);
        System.out.println("Server bind successfully");

        FakeChannelHandlers.setTestingChannelHandlers();
View Full Code Here

    }

    @Test
    public void testHeartbeat() throws Exception {
        URL serverURL = URL.valueOf("header://localhost:55555");
        serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
        TestHeartbeatHandler handler = new TestHeartbeatHandler();
        server = Exchangers.bind(serverURL, handler);
        System.out.println("Server bind successfully");

        client = Exchangers.connect(serverURL);
View Full Code Here

        TestHeartbeatHandler handler = new TestHeartbeatHandler();
        server = Exchangers.bind(serverURL, handler);
        System.out.println("Server bind successfully");

        FakeChannelHandlers.resetChannelHandlers();
        serverURL = serverURL.addParameter(Constants.HEARTBEAT_KEY, 1000);
        client = Exchangers.connect(serverURL);
        Thread.sleep(10000);
        Assert.assertTrue(handler.connectCount > 0);
        System.out.println("connect count " + handler.connectCount);
    }
View Full Code Here

        URL providerURL = URL.valueOf("dubbo://localhost:55555");
        providerURL = providerURL.setPath("path")
            .setUsername("username")
            .setPassword("password");

        providerURL = providerURL.addParameter(Constants.GROUP_KEY, "dubbo")
            .addParameter(Constants.VERSION_KEY, "1.2.3")
            .addParameter(Constants.DUBBO_VERSION_KEY, "2.3.7")
            .addParameter(Constants.THREADPOOL_KEY, "fixed")
            .addParameter(Constants.THREADS_KEY, Integer.MAX_VALUE)
            .addParameter(Constants.THREAD_NAME_KEY, "test")
View Full Code Here

   * 测试mock策略是否正常-fail-mock
   */
  @Test
  public void testMockInvokerInvoke_normal(){
    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName());
    url = url.addParameter(Constants.MOCK_KEY, "fail" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
        URL mockUrl = URL.valueOf("mock://localhost/"+IHelloService.class.getName()
        +"?getSomething.mock=return aa");
   
    Protocol protocol = new MockProtocol();
View Full Code Here

   * 测试mock策略是否正常-force-mork
   */
  @Test
  public void testMockInvokerInvoke_forcemock(){
    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName());
    url = url.addParameter(Constants.MOCK_KEY, "force:return null" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
      URL mockUrl = URL.valueOf("mock://localhost/"+IHelloService.class.getName()
        +"?getSomething.mock=return aa&getSomething3xx.mock=return xx")
        .addParameters(url.getParameters());
   
View Full Code Here

  }
 
  @Test
  public void testMockInvokerInvoke_forcemock_defaultreturn(){
    URL url = URL.valueOf("remote://1.2.3.4/"+IHelloService.class.getName());
    url = url.addParameter(Constants.MOCK_KEY, "force" );
    Invoker<IHelloService> cluster = getClusterInvoker(url);       
      URL mockUrl = URL.valueOf("mock://localhost/"+IHelloService.class.getName()
        +"?getSomething.mock=return aa&getSomething3xx.mock=return xx&sayHello.mock=return ")
        .addParameters(url.getParameters());
   
View Full Code Here

    private TpsLimitFilter filter = new TpsLimitFilter();

    @Test
    public void testWithoutCount() throws Exception {
        URL url = URL.valueOf("test://test");
        url = url.addParameter(Constants.INTERFACE_KEY,
                               "com.alibaba.dubbo.rpc.file.TpsService");
        url = url.addParameter(Constants.TPS_LIMIT_RATE_KEY, 5);
        Invoker<TpsLimitFilterTest> invoker = new MyInvoker<TpsLimitFilterTest>(url);
        Invocation invocation = new MockInvocation();
        filter.invoke(invoker, invocation);
View Full Code Here

    @Test
    public void testWithoutCount() throws Exception {
        URL url = URL.valueOf("test://test");
        url = url.addParameter(Constants.INTERFACE_KEY,
                               "com.alibaba.dubbo.rpc.file.TpsService");
        url = url.addParameter(Constants.TPS_LIMIT_RATE_KEY, 5);
        Invoker<TpsLimitFilterTest> invoker = new MyInvoker<TpsLimitFilterTest>(url);
        Invocation invocation = new MockInvocation();
        filter.invoke(invoker, invocation);
    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.