ARTEMIS-4174 Changing JMXRMIRegistryPortTest to extend ActiveMQTestBase
This way we ensure no thread leaks in tests
This commit is contained in:
parent
75c995198e
commit
98710fe032
|
@ -17,6 +17,7 @@
|
|||
package org.apache.activemq.artemis.core.server.management;
|
||||
|
||||
import org.apache.activemq.artemis.core.config.JMXConnectorConfiguration;
|
||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -24,7 +25,7 @@ import java.io.IOException;
|
|||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
|
||||
public class JMXRMIRegistryPortTest {
|
||||
public class JMXRMIRegistryPortTest extends ActiveMQTestBase {
|
||||
|
||||
@Test
|
||||
public void explicitLocalhostRegistry() throws IOException {
|
||||
|
@ -32,10 +33,10 @@ public class JMXRMIRegistryPortTest {
|
|||
registryFactory.setHost("localhost");
|
||||
registryFactory.setPort(1099);
|
||||
registryFactory.init();
|
||||
runAfter(registryFactory::destroy);
|
||||
try (ServerSocket testSocket = registryFactory.createTestSocket()) {
|
||||
Assert.assertEquals(InetAddress.getByName("localhost"), testSocket.getInetAddress());
|
||||
}
|
||||
registryFactory.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -44,10 +45,10 @@ public class JMXRMIRegistryPortTest {
|
|||
registryFactory.setHost(null);
|
||||
registryFactory.setPort(1099);
|
||||
registryFactory.init();
|
||||
runAfter(registryFactory::destroy);
|
||||
try (ServerSocket testSocket = registryFactory.createTestSocket()) {
|
||||
Assert.assertEquals(InetAddress.getByAddress(new byte[]{0, 0, 0, 0}), testSocket.getInetAddress());
|
||||
}
|
||||
registryFactory.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -57,9 +58,9 @@ public class JMXRMIRegistryPortTest {
|
|||
registryFactory.setHost(configuration.getConnectorHost());
|
||||
registryFactory.setPort(configuration.getConnectorPort());
|
||||
registryFactory.init();
|
||||
registryFactory.destroy();
|
||||
try (ServerSocket testSocket = registryFactory.createTestSocket()) {
|
||||
Assert.assertEquals(InetAddress.getByName("localhost"), testSocket.getInetAddress());
|
||||
}
|
||||
registryFactory.destroy();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue