diff --git a/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java b/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java index c22ad94649..fc6f6a9508 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java @@ -22,19 +22,14 @@ import static org.junit.Assume.assumeNotNull; import java.net.MalformedURLException; import java.util.Set; -import javax.management.MBeanServerConnection; import javax.management.ObjectInstance; import javax.management.ObjectName; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXServiceURL; import org.apache.activemq.broker.BrokerService; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.junit.Test; - public class DuplexNetworkMBeanTest { protected static final Logger LOG = LoggerFactory.getLogger(DuplexNetworkMBeanTest.class); @@ -44,10 +39,10 @@ public class DuplexNetworkMBeanTest { BrokerService broker = new BrokerService(); broker.setBrokerName("broker"); broker.addConnector("tcp://localhost:61617?transport.reuseAddress=true"); - + return broker; } - + protected BrokerService createNetworkedBroker() throws Exception { BrokerService broker = new BrokerService(); broker.setBrokerName("networkedBroker"); @@ -56,65 +51,72 @@ public class DuplexNetworkMBeanTest { networkConnector.setDuplex(true); return broker; } - + @Test public void testMbeanPresenceOnNetworkBrokerRestart() throws Exception { BrokerService broker = createBroker(); - broker.start(); - assertEquals(1, countMbeans(broker, "Connector", 30000)); - assertEquals(0, countMbeans(broker, "Connection")); - BrokerService networkedBroker = null; - for (int i=0; i System.currentTimeMillis()); - + // If port 1099 is in use when the Broker starts, starting the jmx // connector will fail. So, if we have no mbsc to query, skip the // test. if (timeout > 0) { assumeNotNull(mbeans); } - + return count; }