diff --git a/.travis.yml b/.travis.yml index d928330aa4e..5aaa1ba63da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,12 @@ jdk: cache: directories: - - '$HOME/.m2/repository' + - $HOME/.m2 -install: - - ./mvnw clean install -DskipTests=true -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true +install: true script: - - travis_wait 30 ./mvnw test + - travis_wait 30 ./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true after_success: - - bash <(curl -s https://codecov.io/bash) + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/dubbo-common/src/test/java/com/alibaba/dubbo/common/utils/UrlUtilsTest.java b/dubbo-common/src/test/java/com/alibaba/dubbo/common/utils/UrlUtilsTest.java index c20643e42b3..cc475c187ec 100644 --- a/dubbo-common/src/test/java/com/alibaba/dubbo/common/utils/UrlUtilsTest.java +++ b/dubbo-common/src/test/java/com/alibaba/dubbo/common/utils/UrlUtilsTest.java @@ -90,9 +90,9 @@ public void testParseFromParameter() { @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 parameters = new HashMap(); parameters.put("username", "root"); @@ -100,25 +100,25 @@ public void testParseUrl2() { 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 parameters = new HashMap(); parameters.put("username", "root"); parameters.put("password", "alibaba"); parameters.put("port", "10000"); parameters.put("protocol", "dubbo"); List 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 @@ -322,7 +322,7 @@ public void testIsItemMatch() throws Exception { @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/com/alibaba/dubbo/config/GenericServiceTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GenericServiceTest.java index 64bc6adbd6e..9981cb19be6 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GenericServiceTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GenericServiceTest.java @@ -74,7 +74,7 @@ public void testGenericServiceException() { ReferenceConfig reference = new ReferenceConfig(); 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 void testGenericReferenceException() { ReferenceConfig reference = new ReferenceConfig(); 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 void testGenericSerializationJava() throws Exception { ReferenceConfig reference = new ReferenceConfig(); 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 void testGenericInvokeWithBeanSerialization() throws Exception { reference = new ReferenceConfig(); 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 void testGenericImplementationWithBeanSerialization() throws Exception { ref = new ReferenceConfig(); 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/com/alibaba/dubbo/config/cache/CacheTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheTest.java index ebda6ba532a..2d652e893e7 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheTest.java @@ -46,7 +46,7 @@ private void testCache(String type) throws Exception { ServiceConfig service = new ServiceConfig(); 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 @@ private void testCache(String type) throws Exception { ReferenceConfig reference = new ReferenceConfig(); 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/com/alibaba/dubbo/config/spring/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java index 86c37be085d..eb36627098e 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java @@ -96,7 +96,7 @@ public void testServiceClass() { 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-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java index 7a5f238d130..823b3709e9a 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/NettyClientToServerTest.java @@ -33,7 +33,7 @@ protected ExchangeServer newServer(int port, Replier receiver) throws Remotin } protected ExchangeChannel newClient(int port) throws RemotingException { - return Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty")); + return Exchangers.connect(URL.valueOf("exchange://localhost:" + port + "?client=netty&timeout=3000")); } } \ No newline at end of file diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/ClientReconnectTest.java b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/ClientReconnectTest.java index 59597bb1620..28d00cbec5f 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/ClientReconnectTest.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/com/alibaba/dubbo/remoting/transport/netty4/ClientReconnectTest.java @@ -72,7 +72,7 @@ public void testReconnect() throws RemotingException, InterruptedException { public Client startClient(int port, int reconnectPeriod) throws RemotingException { - final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test?client=netty4&check=false&" + Constants.RECONNECT_KEY + "=" + reconnectPeriod; + final String url = "exchange://127.0.0.1:" + port + "/client.reconnect.test?timeout=3000&client=netty4&check=false&" + Constants.RECONNECT_KEY + "=" + reconnectPeriod; return Exchangers.connect(url); } diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java index 5e46f54056e..2051eba1f41 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/telnet/PortTelnetHandlerTest.java @@ -26,8 +26,8 @@ import com.alibaba.dubbo.rpc.protocol.dubbo.support.DemoService; import com.alibaba.dubbo.rpc.protocol.dubbo.support.ProtocolUtils; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -41,11 +41,11 @@ public class PortTelnetHandlerTest { private static TelnetHandler port = new PortTelnetHandler(); - private Invoker mockInvoker; + private static Invoker 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 +53,8 @@ public void before() { 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/com/alibaba/dubbo/rpc/protocol/webservice/WebserviceProtocolTest.java b/dubbo-rpc/dubbo-rpc-webservice/src/test/java/com/alibaba/dubbo/rpc/protocol/webservice/WebserviceProtocolTest.java index 98e77385f9b..a2b8c3f331f 100644 --- a/dubbo-rpc/dubbo-rpc-webservice/src/test/java/com/alibaba/dubbo/rpc/protocol/webservice/WebserviceProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-webservice/src/test/java/com/alibaba/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 void testDemoProtocol() throws Exception { 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);