You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/09/19 09:28:46 UTC

[GitHub] carryxyh closed pull request #2409: [Dubbo-2348 ] AbstractRegistry util test enhancement

carryxyh closed pull request #2409: [Dubbo-2348 ] AbstractRegistry util test enhancement
URL: https://github.com/apache/incubator-dubbo/pull/2409
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 16ffd8579d..a6b688fad9 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
@@ -30,6 +30,7 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -48,6 +49,8 @@
     @Before
     public void init() {
         URL url = URL.valueOf("dubbo://192.168.0.2:2233");
+        //sync update cache file
+        url = url.addParameter("save.file",true);
         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);
 
@@ -515,4 +518,19 @@ public void allTest() throws Exception {
         list.add(url3);
         return list;
     }
+
+    @Test
+    public void getCacheUrlsTest(){
+        List<URL> urls = new ArrayList<>();
+        urls.add(testUrl);
+        // check if notify successfully
+        Assert.assertFalse(notifySuccess);
+        abstractRegistry.notify(testUrl, listener, urls);
+        Assert.assertTrue(notifySuccess);
+        List<URL> cacheUrl = abstractRegistry.getCacheUrls(testUrl);
+        Assert.assertTrue(cacheUrl.size() == 1);
+        URL nullUrl = URL.valueOf("http://1.2.3.4:9090/registry?check=false&file=N/A&interface=com.testa");
+        cacheUrl = abstractRegistry.getCacheUrls(nullUrl);
+        Assert.assertTrue(Objects.isNull(cacheUrl));
+    }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org