This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 98710fe032 ARTEMIS-4174 Changing JMXRMIRegistryPortTest to extend
ActiveMQTestBase
98710fe032 is described below
commit 98710fe0320c391631626736291962df3639de7f
Author: Clebert Suconic <[email protected]>
AuthorDate: Fri Sep 1 15:26:12 2023 -0400
ARTEMIS-4174 Changing JMXRMIRegistryPortTest to extend ActiveMQTestBase
This way we ensure no thread leaks in tests
---
.../core/server/management/JMXRMIRegistryPortTest.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/JMXRMIRegistryPortTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/JMXRMIRegistryPortTest.java
index b6713c8797..c5e7f6002a 100644
---
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/JMXRMIRegistryPortTest.java
+++
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/JMXRMIRegistryPortTest.java
@@ -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();
}
-}
+}
\ No newline at end of file