activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1430266 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/network/ activemq-client/src/main/java/org/apache/activemq/transport/ activemq-core/src/test/java/org/apache/activemq/network/ activemq-core/src/test/java/org/...
Date Tue, 08 Jan 2013 13:13:27 GMT
Author: gtully
Date: Tue Jan  8 13:13:27 2013
New Revision: 1430266

URL: http://svn.apache.org/viewvc?rev=1430266&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-4237 - resolve unit test regressions for dynamic
networkBridge mbeans

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
    activemq/trunk/activemq-client/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java?rev=1430266&r1=1430265&r2=1430266&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
Tue Jan  8 13:13:27 2013
@@ -17,6 +17,7 @@
 package org.apache.activemq.network;
 
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.Map;
 
 import javax.management.MalformedObjectNameException;
@@ -82,18 +83,9 @@ public class MBeanNetworkListener implem
     }
 
     protected ObjectName createNetworkBridgeObjectName(NetworkBridge bridge) throws MalformedObjectNameException
{
-        Map<String, String> map = new HashMap<String, String>(connectorName.getKeyPropertyList());
-
-        StringBuilder objectNameStr = new StringBuilder();
-
-        objectNameStr.append(connectorName.getDomain()).append(":");
-        objectNameStr.append("type=Broker").append(",");
-        objectNameStr.append("brokerName=" + JMXSupport.encodeObjectNamePart(map.get("brokerName"))).append(",");
-        objectNameStr.append("service=NetworkBridge").append(",");
-        objectNameStr.append("networkConnectorName=" + JMXSupport.encodeObjectNamePart(map.get("networkConnectorName"))).append(",");
-        objectNameStr.append("networkBridgeName=" + JMXSupport.encodeObjectNamePart(bridge.getRemoteAddress()));
-
-        return new ObjectName(objectNameStr.toString());
+        Hashtable<String, String> map = new Hashtable<String, String>(connectorName.getKeyPropertyList());
+        map.put("networkBridge", JMXSupport.encodeObjectNamePart(bridge.getRemoteAddress()));
+        return new ObjectName(connectorName.getDomain(), map);
     }
 
     public void setCreatedByDuplex(boolean createdByDuplex) {

Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java?rev=1430266&r1=1430265&r2=1430266&view=diff
==============================================================================
--- activemq/trunk/activemq-client/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java
(original)
+++ activemq/trunk/activemq-client/src/main/java/org/apache/activemq/transport/AbstractInactivityMonitor.java
Tue Jan  8 13:13:27 2013
@@ -414,7 +414,6 @@ public abstract class AbstractInactivity
                     WRITE_CHECK_TIMER = null;
                     READ_CHECK_TIMER = null;
                     ThreadPoolUtils.shutdown(ASYNC_TASKS);
-                    ASYNC_TASKS = null;
                 }
             }
         }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java?rev=1430266&r1=1430265&r2=1430266&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java
Tue Jan  8 13:13:27 2013
@@ -64,18 +64,18 @@ public class DuplexNetworkMBeanTest {
                 networkedBroker = createNetworkedBroker();
                 try {
                     networkedBroker.start();
-                    assertEquals(1, countMbeans(networkedBroker, "service=NetworkBridge",
2000));
-                    assertEquals(1, countMbeans(broker, "service=NetworkBridge", 2000));
+                    assertEquals(1, countMbeans(networkedBroker, "networkBridge", 2000));
+                    assertEquals(1, countMbeans(broker, "networkBridge", 2000));
                     assertEquals(1, countMbeans(broker, "connectionName"));
                 } finally {
                     networkedBroker.stop();
                     networkedBroker.waitUntilStopped();
                 }
                 assertEquals(0, countMbeans(networkedBroker, "stopped"));
-                assertEquals(0, countMbeans(broker, "service=NetworkBridge"));
+                assertEquals(0, countMbeans(broker, "networkBridge"));
             }
 
-            assertEquals(0, countMbeans(networkedBroker, "service=NetworkBridge"));
+            assertEquals(0, countMbeans(networkedBroker, "networkBridge"));
             assertEquals(0, countMbeans(networkedBroker, "connector"));
             assertEquals(0, countMbeans(networkedBroker, "connectionName"));
             assertEquals(1, countMbeans(broker, "connector"));
@@ -99,7 +99,7 @@ public class DuplexNetworkMBeanTest {
                 broker = createBroker();
                 try {
                     broker.start();
-                    assertEquals(1, countMbeans(networkedBroker, "service=NetworkBridge",
5000));
+                    assertEquals(1, countMbeans(networkedBroker, "networkBridge", 5000));
                     assertEquals("restart number: " + i, 1, countMbeans(broker, "connectionName",
10000));
                 } finally {
                     broker.stop();

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java?rev=1430266&r1=1430265&r2=1430266&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java
Tue Jan  8 13:13:27 2013
@@ -191,8 +191,8 @@ public class FailoverStaticNetworkTest {
     private Set<String> getNetworkBridgeMBeanName(BrokerService brokerB) throws Exception
{
         Set<String> names = new HashSet<String>();
         for (ObjectName objectName : brokerB.getManagementContext().queryNames(null, null))
{
-            if ("NetworkBridge".equals(objectName.getKeyProperty("service"))) {
-                names.add(objectName.getKeyProperty("networkBridgeName"));
+            if (objectName.getKeyProperty("networkBridge") != null) {
+                names.add(objectName.getKeyProperty("networkBridge"));
             }
         }
         return names;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java?rev=1430266&r1=1430265&r2=1430266&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java
Tue Jan  8 13:13:27 2013
@@ -75,12 +75,11 @@ public class DiscoveryNetworkReconnectTe
             ObjectName mine = (ObjectName) name;
             LOG.info("Match: " + mine + " vs: " + other);
 
-            if (other.getKeyProperty("service") == null) {
+            if (!"networkConnectors".equals(other.getKeyProperty("connector"))) {
                 return false;
             }
-
-            return other.getKeyProperty("service").equals(mine.getKeyProperty("service"))
&&
-                other.getKeyProperty("networkConnectorName").equals(mine.getKeyProperty("networkConnectorName"));
+            return other.getKeyProperty("connector").equals(mine.getKeyProperty("connector"))
&&
+                   other.getKeyProperty("networkBridge") != null && mine.getKeyProperty("networkBridge")
!= null;
         }
 
         @Override
@@ -129,17 +128,17 @@ public class DiscoveryNetworkReconnectTe
                     new ObjectName("Test:type=Broker,brokerName=BrokerNC,service=jobScheduler,jobSchedulerName=JMS"))));
 
             atLeast(maxReconnects - 1).of (managementContext).registerMBean(with(any(Object.class)),
with(new NetworkBridgeObjectNameMatcher<ObjectName>(
-                        new ObjectName("Test:type=Broker,brokerName=BrokerNC,service=NetworkBridge,networkConnectorName=NC,networkBridgeName=localhost/127.0.0.1_"
+                        new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_"
                             + proxy.getUrl().getPort())))); will(new CustomAction("signal
register network mbean") {
                                 @Override
                                 public Object invoke(Invocation invocation) throws Throwable
{
                                     LOG.info("Mbean Registered: " + invocation.getParameter(0));
                                     mbeanRegistered.release();
-                                    return new ObjectInstance((ObjectName)invocation.getParameter(1),
"dscription");
+                                    return new ObjectInstance((ObjectName)invocation.getParameter(1),
"discription");
                                 }
                             });
             atLeast(maxReconnects - 1).of (managementContext).unregisterMBean(with(new NetworkBridgeObjectNameMatcher<ObjectName>(
-                    new ObjectName("Test:type=Broker,brokerName=BrokerNC,service=NetworkBridge,networkConnectorName=NC,networkBridgeName=localhost/127.0.0.1_"
+                    new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_"
                             + proxy.getUrl().getPort())))); will(new CustomAction("signal
unregister network mbean") {
                                 @Override
                                 public Object invoke(Invocation invocation) throws Throwable
{
@@ -186,21 +185,22 @@ public class DiscoveryNetworkReconnectTe
     @Test
     public void testMulicastReconnect() throws Exception {
 
+        brokerB.addNetworkConnector(discoveryAddress + "&discovered.trace=true&discovered.wireFormat.maxInactivityDuration=1000&discovered.wireFormat.maxInactivityDurationInitalDelay=1000");
+        brokerB.start();
+        brokerB.waitUntilStarted();
+
         // control multicast advertise agent to inject proxy
         agent = MulticastDiscoveryAgentFactory.createDiscoveryAgent(new URI(discoveryAddress));
         agent.registerService(proxy.getUrl().toString());
         agent.start();
 
-        brokerB.addNetworkConnector(discoveryAddress + "&wireFormat.maxInactivityDuration=1000&wireFormat.maxInactivityDurationInitalDelay=1000");
-        brokerB.start();
-        brokerB.waitUntilStarted();
         doReconnect();
     }
 
     @Test
     public void testSimpleReconnect() throws Exception {
         brokerB.addNetworkConnector("simple://(" + proxy.getUrl()
-                + ")?useExponentialBackOff=false&initialReconnectDelay=500&wireFormat.maxInactivityDuration=1000&wireFormat.maxInactivityDurationInitalDelay=1000");
+                + ")?useExponentialBackOff=false&initialReconnectDelay=500&discovered.wireFormat.maxInactivityDuration=1000&discovered.wireFormat.maxInactivityDurationInitalDelay=1000");
         brokerB.start();
         brokerB.waitUntilStarted();
         doReconnect();



Mime
View raw message