From 4673dbf1541b460fc385d5b6c29cc1d030f78f07 Mon Sep 17 00:00:00 2001 From: OrDTesters <44483852+OrDTesters@users.noreply.github.com> Date: Wed, 21 Nov 2018 18:00:03 -0800 Subject: [PATCH] [Dubbo-2758] Adding dependency on dubbo-remoting-mina for tests in dubbo-rpc-dubbo (#2797) * Adding dependency on dubbo-remoting-mina so DubboProtocolTest.testDubboProtocolWithMina is no longer flaky * Changing port number to ensure new server/client created for test --- dubbo-rpc/dubbo-rpc-dubbo/pom.xml | 6 ++++++ .../dubbo/rpc/protocol/dubbo/DubboProtocolTest.java | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml index 26915e458de1..2445399f5e03 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/pom.xml +++ b/dubbo-rpc/dubbo-rpc-dubbo/pom.xml @@ -60,6 +60,12 @@ ${project.parent.version} test + + org.apache.dubbo + dubbo-remoting-mina + ${project.parent.version} + test + io.netty netty-all diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java index b67112c40dfd..ef04a857bda0 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java @@ -96,8 +96,8 @@ public void testDubboProtocol() throws Exception { @Test public void testDubboProtocolWithMina() throws Exception { DemoService service = new DemoServiceImpl(); - protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter(Constants.SERVER_KEY, "mina"))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter(Constants.CLIENT_KEY, "mina").addParameter("timeout", 3000l))); + protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName()).addParameter(Constants.SERVER_KEY, "mina"))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName()).addParameter(Constants.CLIENT_KEY, "mina").addParameter("timeout", 3000l))); for (int i = 0; i < 10; i++) { assertEquals(service.enumlength(new Type[]{}), Type.Lower); assertEquals(service.getSize(null), -1); @@ -112,7 +112,7 @@ public void testDubboProtocolWithMina() throws Exception { service.invoke("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "", "invoke"); } - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); // test netty client StringBuffer buf = new StringBuffer(); for (int i = 0; i < 1024 * 32 + 32; i++) @@ -120,7 +120,7 @@ public void testDubboProtocolWithMina() throws Exception { System.out.println(service.stringLength(buf.toString())); // cast to EchoService - EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); + EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); for (int i = 0; i < 10; i++) { assertEquals(echo.$echo(buf.toString()), buf.toString()); assertEquals(echo.$echo("test"), "test");