You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by yi...@apache.org on 2018/09/29 07:27:37 UTC

[incubator-dubbo] branch master updated: AbstractRegistryFactory Unit Test: destroyAll method (#2581)

This is an automated email from the ASF dual-hosted git repository.

yiji 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 9b7284f  AbstractRegistryFactory Unit Test: destroyAll method (#2581)
9b7284f is described below

commit 9b7284f4d5c7f48e5d164670eb512d16987e5e25
Author: tswstarplanet <ts...@163.com>
AuthorDate: Sat Sep 29 15:27:32 2018 +0800

    AbstractRegistryFactory Unit Test: destroyAll method (#2581)
---
 .../dubbo/registry/support/AbstractRegistryFactoryTest.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java
index 79b875d..d0dd1cd 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java
+++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java
@@ -25,6 +25,7 @@ import org.apache.dubbo.registry.RegistryFactory;
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -102,4 +103,15 @@ public class AbstractRegistryFactoryTest {
         Assert.assertNotSame(registry1, registry2);
     }
 
+    @Test
+    public void testDestroyAllRegistries() {
+        Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":8888?group=xxx"));
+        Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":9999?group=yyy"));
+        Collection<Registry> registries = AbstractRegistryFactory.getRegistries();
+        Assert.assertTrue(registries.contains(registry1));
+        Assert.assertTrue(registries.contains(registry2));
+        AbstractRegistryFactory.destroyAll();
+        Assert.assertFalse(registries.contains(registry1));
+        Assert.assertFalse(registries.contains(registry2));
+    }
 }