Stop DiscoveryNodeManager in tests
@@ -91,6 +91,7 @@ public class TestDiscoveryNodeManager
public void testGetAllNodes()
{
DiscoveryNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion, testHttpClient, internalCommunicationConfig);
+ try {
AllNodes allNodes = manager.getAllNodes();
Set<Node> activeNodes = allNodes.getActiveNodes();
@@ -115,6 +116,10 @@ public class TestDiscoveryNodeManager
assertEqualsIgnoreOrder(inactiveNodes, manager.getNodes(INACTIVE));
}
+ finally {
+ manager.stop();
+ }
+ }
@Test
public void testGetCurrentNode()
@@ -126,16 +131,25 @@ public class TestDiscoveryNodeManager
.setNodeId(expected.getNodeIdentifier()));
DiscoveryNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion, testHttpClient, internalCommunicationConfig);
-
+ try {
assertEquals(manager.getCurrentNode(), expected);
}
+ finally {
+ manager.stop();
+ }
+ }
@Test
public void testGetCoordinators()
{
- InternalNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion, testHttpClient, internalCommunicationConfig);
+ DiscoveryNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion, testHttpClient, internalCommunicationConfig);
+ try {
assertEquals(manager.getCoordinators(), ImmutableSet.of(coordinator));
}
+ finally {
+ manager.stop();
+ }
+ }
@SuppressWarnings("ResultOfObjectAllocationIgnored")
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = ".* current node not returned .*")
