You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by je...@apache.org on 2018/09/13 06:46:28 UTC
[incubator-dubbo] branch master updated: fix stable problem for
unit cases (#2497)
This is an automated email from the ASF dual-hosted git repository.
jerrick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 96eec3d fix stable problem for unit cases (#2497)
96eec3d is described below
commit 96eec3ddc42feacb9f749b75d6df97ba77c2b51b
Author: Jerrick Zhu <di...@gmail.com>
AuthorDate: Thu Sep 13 14:46:24 2018 +0800
fix stable problem for unit cases (#2497)
* fix stable problem for unit cases
* add cache
---
.travis.yml | 4 ++
.../apache/dubbo/common/utils/UrlUtilsTest.java | 18 ++++-----
.../apache/dubbo/config/GenericServiceTest.java | 10 ++---
.../org/apache/dubbo/config/cache/CacheTest.java | 4 +-
.../org/apache/dubbo/config/spring/ConfigTest.java | 2 +-
.../registry/support/AbstractRegistryTest.java | 46 +++++++++++-----------
.../transport/netty/ClientReconnectTest.java | 2 +-
.../transport/netty/NettyClientToServerTest.java | 2 +-
.../dubbo/telnet/PortTelnetHandlerTest.java | 12 +++---
.../webservice/WebserviceProtocolTest.java | 4 +-
10 files changed, 55 insertions(+), 49 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index acf5d48..2b617a3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,6 +6,10 @@ jdk:
- oraclejdk9
- oraclejdk8
+cache:
+ directories:
+ - $HOME/.m2
+
install: true
script:
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java
index 7141c96..3fc14c3 100644
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java
+++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java
@@ -98,9 +98,9 @@ public class UrlUtilsTest {
@Test
public void testParseUrl2() {
- String address = "127.0.0.1";
- String backupAddress1 = "127.0.0.2";
- String backupAddress2 = "127.0.0.3";
+ String address = "192.168.0.1";
+ String backupAddress1 = "192.168.0.2";
+ String backupAddress2 = "192.168.0.3";
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("username", "root");
@@ -108,25 +108,25 @@ public class UrlUtilsTest {
parameters.put("port", "10000");
parameters.put("protocol", "dubbo");
URL url = UrlUtils.parseURL(address + "," + backupAddress1 + "," + backupAddress2, parameters);
- assertEquals(localAddress + ":10000", url.getAddress());
+ assertEquals("192.168.0.1:10000", url.getAddress());
assertEquals("root", url.getUsername());
assertEquals("alibaba", url.getPassword());
assertEquals(10000, url.getPort());
assertEquals("dubbo", url.getProtocol());
- assertEquals("127.0.0.2" + "," + "127.0.0.3", url.getParameter("backup"));
+ assertEquals("192.168.0.2" + "," + "192.168.0.3", url.getParameter("backup"));
}
@Test
public void testParseUrls() {
- String addresses = "127.0.0.1|127.0.0.2|127.0.0.3";
+ String addresses = "192.168.0.1|192.168.0.2|192.168.0.3";
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("username", "root");
parameters.put("password", "alibaba");
parameters.put("port", "10000");
parameters.put("protocol", "dubbo");
List<URL> urls = UrlUtils.parseURLs(addresses, parameters);
- assertEquals(localAddress + ":10000", urls.get(0).getAddress());
- assertEquals("127.0.0.2" + ":10000", urls.get(1).getAddress());
+ assertEquals("192.168.0.1" + ":10000", urls.get(0).getAddress());
+ assertEquals("192.168.0.2" + ":10000", urls.get(1).getAddress());
}
@Test
@@ -330,7 +330,7 @@ public class UrlUtilsTest {
@Test
public void testIsServiceKeyMatch() throws Exception {
- URL url = URL.valueOf("test://127.0.0.0");
+ URL url = URL.valueOf("test://127.0.0.1");
URL pattern = url.addParameter(Constants.GROUP_KEY, "test")
.addParameter(Constants.INTERFACE_KEY, "test")
.addParameter(Constants.VERSION_KEY, "test");
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/GenericServiceTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/GenericServiceTest.java
index 6e746db..f996f41 100644
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/GenericServiceTest.java
+++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/GenericServiceTest.java
@@ -74,7 +74,7 @@ public class GenericServiceTest {
ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>();
reference.setApplication(new ApplicationConfig("generic-consumer"));
reference.setInterface(DemoService.class);
- reference.setUrl("dubbo://127.0.0.1:29581?generic=true");
+ reference.setUrl("dubbo://127.0.0.1:29581?generic=true&timeout=3000");
DemoService demoService = reference.get();
try {
// say name
@@ -113,7 +113,7 @@ public class GenericServiceTest {
ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
reference.setApplication(new ApplicationConfig("generic-consumer"));
reference.setInterface(DemoService.class);
- reference.setUrl("dubbo://127.0.0.1:29581?scope=remote");
+ reference.setUrl("dubbo://127.0.0.1:29581?scope=remote&timeout=3000");
reference.setGeneric(true);
GenericService genericService = reference.get();
try {
@@ -147,7 +147,7 @@ public class GenericServiceTest {
ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
reference.setApplication(new ApplicationConfig("generic-consumer"));
reference.setInterface(DemoService.class);
- reference.setUrl("dubbo://127.0.0.1:29581?scope=remote");
+ reference.setUrl("dubbo://127.0.0.1:29581?scope=remote&timeout=3000");
reference.setGeneric(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA);
GenericService genericService = reference.get();
try {
@@ -216,7 +216,7 @@ public class GenericServiceTest {
reference = new ReferenceConfig<GenericService>();
reference.setApplication(new ApplicationConfig("bean-consumer"));
reference.setInterface(DemoService.class);
- reference.setUrl("dubbo://127.0.0.1:29581?scope=remote");
+ reference.setUrl("dubbo://127.0.0.1:29581?scope=remote&timeout=3000");
reference.setGeneric(Constants.GENERIC_SERIALIZATION_BEAN);
GenericService genericService = reference.get();
User user = new User();
@@ -270,7 +270,7 @@ public class GenericServiceTest {
ref = new ReferenceConfig<DemoService>();
ref.setApplication(new ApplicationConfig("bean-consumer"));
ref.setInterface(DemoService.class);
- ref.setUrl("dubbo://127.0.0.1:29581?scope=remote&generic=bean");
+ ref.setUrl("dubbo://127.0.0.1:29581?scope=remote&generic=bean&timeout=3000");
DemoService demoService = ref.get();
User user = new User();
user.setName("zhangsan");
diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java
index 0cdcabd..d69eeb8 100644
--- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java
+++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/cache/CacheTest.java
@@ -46,7 +46,7 @@ public class CacheTest extends TestCase {
ServiceConfig<CacheService> service = new ServiceConfig<CacheService>();
service.setApplication(new ApplicationConfig("cache-provider"));
service.setRegistry(new RegistryConfig("N/A"));
- service.setProtocol(new ProtocolConfig("dubbo", 29582));
+ service.setProtocol(new ProtocolConfig("injvm"));
service.setInterface(CacheService.class.getName());
service.setRef(new CacheServiceImpl());
service.export();
@@ -54,7 +54,7 @@ public class CacheTest extends TestCase {
ReferenceConfig<CacheService> reference = new ReferenceConfig<CacheService>();
reference.setApplication(new ApplicationConfig("cache-consumer"));
reference.setInterface(CacheService.class);
- reference.setUrl("dubbo://127.0.0.1:29582?scope=remote&cache=true");
+ reference.setUrl("injvm://127.0.0.1?scope=remote&cache=true");
MethodConfig method = new MethodConfig();
method.setName("findCache");
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java
index 5698277..d9ac2f2 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java
@@ -96,7 +96,7 @@ public class ConfigTest {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/service-class.xml");
ctx.start();
try {
- DemoService demoService = refer("dubbo://127.0.0.1:20887");
+ DemoService demoService = refer("dubbo://127.0.0.1:30887");
String hello = demoService.sayName("hello");
assertEquals("welcome:hello", hello);
} finally {
diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java
index b1debab..16ffd85 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java
+++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java
@@ -47,9 +47,9 @@ public class AbstractRegistryTest {
@Before
public void init() {
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":2233");
- testUrl = URL.valueOf("http://1.2.3.4:9090/registry?check=false&file=N/A&interface=com.test");
- mockUrl = new URL("dubbo", "127.0.0.0", 2200);
+ URL url = URL.valueOf("dubbo://192.168.0.2:2233");
+ testUrl = URL.valueOf("http://192.168.0.3:9090/registry?check=false&file=N/A&interface=com.test");
+ mockUrl = new URL("dubbo", "192.168.0.1", 2200);
parametersConsumer.put("application", "demo-consumer");
parametersConsumer.put("category", "consumer");
@@ -115,7 +115,7 @@ public class AbstractRegistryTest {
@Test
public void testUnregister() throws Exception {
//test one unregister
- URL url = new URL("dubbo", "127.0.0.0", 2200);
+ URL url = new URL("dubbo", "192.168.0.1", 2200);
abstractRegistry.getRegistered().add(url);
abstractRegistry.unregister(url);
Assert.assertThat(false, Matchers.equalTo(abstractRegistry.getRegistered().contains(url)));
@@ -145,7 +145,7 @@ public class AbstractRegistryTest {
//test subscribe
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
- URL url = new URL("dubbo", "127.0.0.0", 2200);
+ URL url = new URL("dubbo", "192.168.0.1", 2200);
abstractRegistry.subscribe(url, listener);
Set<NotifyListener> subscribeListeners = abstractRegistry.getSubscribed().get(url);
Assert.assertThat(true, Matchers.equalTo(subscribeListeners.contains(listener)));
@@ -159,7 +159,7 @@ public class AbstractRegistryTest {
public void testSubscribeIfUrlNull() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
- URL url = new URL("dubbo", "127.0.0.0", 2200);
+ URL url = new URL("dubbo", "192.168.0.1", 2200);
abstractRegistry.subscribe(null, listener);
Assert.fail("subscribe url == null");
}
@@ -168,7 +168,7 @@ public class AbstractRegistryTest {
public void testSubscribeIfListenerNull() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
- URL url = new URL("dubbo", "127.0.0.0", 2200);
+ URL url = new URL("dubbo", "192.168.0.1", 2200);
abstractRegistry.subscribe(url, null);
Assert.fail("listener url == null");
}
@@ -184,7 +184,7 @@ public class AbstractRegistryTest {
@Test(expected = IllegalArgumentException.class)
public void testUnsubscribeIfNotifyNull() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
- URL url = new URL("dubbo", "127.0.0.0", 2200);
+ URL url = new URL("dubbo", "192.168.0.1", 2200);
abstractRegistry.unsubscribe(url, null);
Assert.fail("unsubscribe listener == null");
}
@@ -293,13 +293,13 @@ public class AbstractRegistryTest {
public void testNotify() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
- URL url1 = new URL("dubbo", "127.0.0.0", 2200, parametersConsumer);
+ URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
- URL url2 = new URL("dubbo", "127.0.0.1", 2201, parametersConsumer);
+ URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
- URL url3 = new URL("dubbo", "127.0.0.2", 2202, parametersConsumer);
+ URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
@@ -319,13 +319,13 @@ public class AbstractRegistryTest {
public void testNotifyList() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
- URL url1 = new URL("dubbo", "127.0.0.0", 2200, parametersConsumer);
+ URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
- URL url2 = new URL("dubbo", "127.0.0.1", 2201, parametersConsumer);
+ URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
- URL url3 = new URL("dubbo", "127.0.0.2", 2202, parametersConsumer);
+ URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
@@ -342,13 +342,13 @@ public class AbstractRegistryTest {
public void testNotifyIfURLNull() throws Exception {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
- URL url1 = new URL("dubbo", "127.0.0.0", 2200, parametersConsumer);
+ URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
- URL url2 = new URL("dubbo", "127.0.0.1", 2201, parametersConsumer);
+ URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
- URL url3 = new URL("dubbo", "127.0.0.2", 2202, parametersConsumer);
+ URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
@@ -362,13 +362,13 @@ public class AbstractRegistryTest {
public void testNotifyIfNotifyNull() {
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
NotifyListener listner1 = urls -> notified.set(Boolean.TRUE);
- URL url1 = new URL("dubbo", "127.0.0.0", 2200, parametersConsumer);
+ URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer);
abstractRegistry.subscribe(url1, listner1);
NotifyListener listner2 = urls -> notified.set(Boolean.TRUE);
- URL url2 = new URL("dubbo", "127.0.0.1", 2201, parametersConsumer);
+ URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer);
abstractRegistry.subscribe(url2, listner2);
NotifyListener listner3 = urls -> notified.set(Boolean.TRUE);
- URL url3 = new URL("dubbo", "127.0.0.2", 2202, parametersConsumer);
+ URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer);
abstractRegistry.subscribe(url3, listner3);
List<URL> urls = new ArrayList<>();
urls.add(url1);
@@ -507,9 +507,9 @@ public class AbstractRegistryTest {
private List<URL> getList() {
List<URL> list = new ArrayList<>();
- URL url1 = new URL("dubbo", "127.0.0.0", 1000);
- URL url2 = new URL("dubbo", "127.0.0.1", 1001);
- URL url3 = new URL("dubbo", "127.0.0.2", 1002);
+ URL url1 = new URL("dubbo", "192.168.0.1", 1000);
+ URL url2 = new URL("dubbo", "192.168.0.2", 1001);
+ URL url3 = new URL("dubbo", "192.168.0.3", 1002);
list.add(url1);
list.add(url2);
list.add(url3);
diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java
index b29b20c..1444f9b 100644
--- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java
+++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/ClientReconnectTest.java
@@ -80,7 +80,7 @@ public class ClientReconnectTest {
public void testReconnectWarnLog() throws RemotingException, InterruptedException {
int port = NetUtils.getAvailablePort();
DubboAppender.doStart();
- String url = "exchange://127.0.0.2:" + port + "/client.reconnect.test?check=false&client=netty3&"
+ String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test?check=false&client=netty3&"
+ Constants.RECONNECT_KEY + "=" + 1; //1ms reconnect, ensure that there is enough frequency to reconnect
try {
Exchangers.connect(url);
diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java
index 56a9882..a2cff1d 100644
--- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java
+++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/org/apache/dubbo/remoting/transport/netty/NettyClientToServerTest.java
@@ -33,7 +33,7 @@ public class NettyClientToServerTest extends ClientToServerTest {
}
protected ExchangeChannel newClient(int port) throws RemotingException {
- return Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty3"));
+ return Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty3&timeout=3000"));
}
}
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java
index 611008e..ff6ec43 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java
@@ -27,7 +27,9 @@ import org.apache.dubbo.rpc.protocol.dubbo.support.DemoService;
import org.apache.dubbo.rpc.protocol.dubbo.support.ProtocolUtils;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -41,11 +43,11 @@ import static org.mockito.Mockito.mock;
public class PortTelnetHandlerTest {
private static TelnetHandler port = new PortTelnetHandler();
- private Invoker<DemoService> mockInvoker;
+ private static Invoker<DemoService> mockInvoker;
@SuppressWarnings("unchecked")
- @Before
- public void before() {
+ @BeforeClass
+ public static void before() {
mockInvoker = mock(Invoker.class);
given(mockInvoker.getInterface()).willReturn(DemoService.class);
given(mockInvoker.getUrl()).willReturn(URL.valueOf("dubbo://127.0.0.1:20887/demo"));
@@ -53,8 +55,8 @@ public class PortTelnetHandlerTest {
DubboProtocol.getDubboProtocol().export(mockInvoker);
}
- @After
- public void after() {
+ @AfterClass
+ public static void after() {
ProtocolUtils.closeAll();
}
diff --git a/dubbo-rpc/dubbo-rpc-webservice/src/test/java/org/apache/dubbo/rpc/protocol/webservice/WebserviceProtocolTest.java b/dubbo-rpc/dubbo-rpc-webservice/src/test/java/org/apache/dubbo/rpc/protocol/webservice/WebserviceProtocolTest.java
index e668bcb..5763026 100644
--- a/dubbo-rpc/dubbo-rpc-webservice/src/test/java/org/apache/dubbo/rpc/protocol/webservice/WebserviceProtocolTest.java
+++ b/dubbo-rpc/dubbo-rpc-webservice/src/test/java/org/apache/dubbo/rpc/protocol/webservice/WebserviceProtocolTest.java
@@ -37,7 +37,7 @@ public class WebserviceProtocolTest {
public void testDemoProtocol() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("webservice://127.0.0.1:9019/" + DemoService.class.getName() + "?codec=exchange")));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("webservice://127.0.0.1:9019/" + DemoService.class.getName() + "?codec=exchange")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("webservice://127.0.0.1:9019/" + DemoService.class.getName() + "?codec=exchange&timeout=3000")));
assertEquals(service.getSize(new String[]{"", "", ""}), 3);
}
@@ -45,7 +45,7 @@ public class WebserviceProtocolTest {
public void testWebserviceProtocol() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("webservice://127.0.0.1:9019/" + DemoService.class.getName())));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("webservice://127.0.0.1:9019/" + DemoService.class.getName())));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("webservice://127.0.0.1:9019/" + DemoService.class.getName() + "?timeout=3000")));
assertEquals(service.create(1,"kk").getName(), "kk");
assertEquals(service.getSize(null), -1);
assertEquals(service.getSize(new String[]{"", "", ""}), 3);