Skip to content

Commit

Permalink
AbstractRegistryFactory Unit Test: destroyAll method (apache#2581)
Browse files Browse the repository at this point in the history
  • Loading branch information
tswstarplanet authored and zonghaishang committed Sep 29, 2018
1 parent be51a11 commit 9b7284f
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Assert;
import org.junit.Test;

import java.util.Collection;
import java.util.List;

/**
Expand Down Expand Up @@ -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));
}
}

0 comments on commit 9b7284f

Please sign in to comment.