zonghaishang closed pull request #2581: AbstractRegistryFactory Unit Test:
destroyAll method
URL: https://github.com/apache/incubator-dubbo/pull/2581
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/AbstractRegistryFactoryTest.java
b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryFactoryTest.java
index 79b875dc10..d0dd1cd068 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.junit.Assert;
import org.junit.Test;
+import java.util.Collection;
import java.util.List;
/**
@@ -102,4 +103,15 @@ public void testRegistryFactoryGroupCache() throws
Exception {
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));
+ }
}
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services