activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r1425875 - in /activemq/trunk/activemq-core/src/test/java/org/apache/activemq: ./ broker/ broker/advisory/ broker/jmx/ broker/region/ bugs/ jmx/ usage/ usecases/ xbean/
Date Wed, 26 Dec 2012 10:58:31 GMT
Author: rajdavies
Date: Wed Dec 26 10:58:30 2012
New Revision: 1425875

URL: http://svn.apache.org/viewvc?rev=1425875&view=rev
Log:
Fix for https://issues.apache.org/jira/browse/AMQ-4237

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/advisory/AdvisoryJmxTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/HealthViewMBeanTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanOperationTimeoutTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3934Test.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jmx/OpenTypeSupportTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usage/CompositeMessageCursorUsageTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JMSConsumerTest.java Wed Dec 26 10:58:30 2012
@@ -35,12 +35,8 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
 import javax.management.ObjectName;
-
 import junit.framework.Test;
-
 import org.apache.activemq.broker.jmx.DestinationViewMBean;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
@@ -915,9 +911,9 @@ public class JMSConsumerTest extends Jms
          String domain = "org.apache.activemq";
          ObjectName name;
         if (destination.isQueue()) {
-            name = new ObjectName(domain + ":BrokerName=localhost,Type=Queue,Destination=test");
+            name = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=test");
         } else {
-            name = new ObjectName(domain + ":BrokerName=localhost,Type=Topic,Destination=test");
+            name = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=test");
         }
         return (DestinationViewMBean)broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class, true);
     }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java Wed Dec 26 10:58:30 2012
@@ -191,7 +191,7 @@ public class JmsQueueBrowserTest extends
             producer.send(outbound[i]);
         }
 
-        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:Type=Queue,Destination=TEST,BrokerName=localhost");
+        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=TEST");
 
         LOG.info("Create QueueView MBean...");
         QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java Wed Dec 26 10:58:30 2012
@@ -19,6 +19,7 @@ package org.apache.activemq.broker;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
+
 import javax.jms.JMSException;
 import javax.management.InstanceNotFoundException;
 import javax.management.MalformedObjectNameException;
@@ -27,20 +28,7 @@ import junit.framework.Test;
 import org.apache.activemq.broker.jmx.DestinationViewMBean;
 import org.apache.activemq.broker.jmx.RecoveredXATransactionViewMBean;
 import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.ActiveMQTopic;
-import org.apache.activemq.command.ConnectionInfo;
-import org.apache.activemq.command.ConsumerInfo;
-import org.apache.activemq.command.DataArrayResponse;
-import org.apache.activemq.command.Message;
-import org.apache.activemq.command.MessageAck;
-import org.apache.activemq.command.ProducerInfo;
-import org.apache.activemq.command.Response;
-import org.apache.activemq.command.SessionInfo;
-import org.apache.activemq.command.TransactionId;
-import org.apache.activemq.command.TransactionInfo;
-import org.apache.activemq.command.XATransactionId;
+import org.apache.activemq.command.*;
 import org.apache.activemq.util.JMXSupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -139,8 +127,8 @@ public class XARecoveryBrokerTest extend
 
     private RecoveredXATransactionViewMBean getProxyToPreparedTransactionViewMBean(TransactionId xid) throws MalformedObjectNameException, JMSException {
 
-        ObjectName objectName = new ObjectName("org.apache.activemq:Type=RecoveredXaTransaction,Xid=" +
-                JMXSupport.encodeObjectNamePart(xid.toString()) + ",BrokerName=localhost");
+        ObjectName objectName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,transactionType=RecoveredXaTransaction,Xid=" +
+                JMXSupport.encodeObjectNamePart(xid.toString()));
         RecoveredXATransactionViewMBean proxy = (RecoveredXATransactionViewMBean) broker.getManagementContext().newProxyInstance(objectName,
                 RecoveredXATransactionViewMBean.class, true);
         return proxy;
@@ -148,8 +136,10 @@ public class XARecoveryBrokerTest extend
 
     private DestinationViewMBean getProxyToDestination(ActiveMQDestination destination) throws MalformedObjectNameException, JMSException {
 
-        ObjectName objectName = new ObjectName("org.apache.activemq:Type=" + (destination.isQueue() ? "Queue" : "Topic") + ",Destination=" +
-                JMXSupport.encodeObjectNamePart(destination.getPhysicalName()) + ",BrokerName=localhost");
+        final ObjectName objectName = new ObjectName("org.apache.activemq:type=Broker,brokerName="+broker.getBrokerName()+",destinationType="
+                + JMXSupport.encodeObjectNamePart(destination.getDestinationTypeAsString())
+                + ",destinationName=" + JMXSupport.encodeObjectNamePart(destination.getPhysicalName()));
+
         DestinationViewMBean proxy = (DestinationViewMBean) broker.getManagementContext().newProxyInstance(objectName,
                 DestinationViewMBean.class, true);
         return proxy;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/advisory/AdvisoryJmxTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/advisory/AdvisoryJmxTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/advisory/AdvisoryJmxTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/advisory/AdvisoryJmxTest.java Wed Dec 26 10:58:30 2012
@@ -48,7 +48,7 @@ public class AdvisoryJmxTest extends Emb
         JMXConnector connector = JMXConnectorFactory.connect(url, null);
         connector.connect();
         MBeanServerConnection connection = connector.getMBeanServerConnection();
-        ObjectName name = new ObjectName("org.apache.activemq:Type=Broker,BrokerName=localhost");
+        ObjectName name = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost");
         BrokerViewMBean brokerMbean = (BrokerViewMBean) MBeanServerInvocationHandler.newProxyInstance(connection, name, BrokerViewMBean.class, true);
         Connection conn = createConnection();
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/HealthViewMBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/HealthViewMBeanTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/HealthViewMBeanTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/HealthViewMBeanTest.java Wed Dec 26 10:58:30 2012
@@ -88,7 +88,10 @@ public class HealthViewMBeanTest extends
             }
             Thread.sleep(1000);
 
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Health,BrokerName=localhost");
+        String objectNameStr = broker.getBrokerObjectName().toString();
+        objectNameStr += ",service=Health";
+        ObjectName brokerName = assertRegisteredObjectName(objectNameStr
+        );
         HealthViewMBean health =  MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, HealthViewMBean.class, true);
         List<HealthStatus> list = health.healthList();
         assertTrue("There should be at least two statuses", list.size() >= 2);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanOperationTimeoutTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanOperationTimeoutTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanOperationTimeoutTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanOperationTimeoutTest.java Wed Dec 26 10:58:30 2012
@@ -16,9 +16,6 @@
  */
 package org.apache.activemq.broker.jmx;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
@@ -31,7 +28,6 @@ import javax.management.MBeanServer;
 import javax.management.MBeanServerInvocationHandler;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.junit.After;
@@ -39,6 +35,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 public class MBeanOperationTimeoutTest {
     private static final Logger LOG = LoggerFactory.getLogger(MBeanOperationTimeoutTest.class);
@@ -61,7 +59,10 @@ public class MBeanOperationTimeoutTest {
         LOG.info("Produced " + messageCount + " messages to the broker.");
 
         // Now get the QueueViewMBean and purge
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + destinationName + ",BrokerName=localhost");
+        String objectNameStr = broker.getBrokerObjectName().toString();
+        objectNameStr += ",destinationType=Queue,destinationName="+destinationName;
+
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(objectNameStr);
         QueueViewMBean proxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         long count = proxy.getQueueSize();

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java Wed Dec 26 10:58:30 2012
@@ -39,9 +39,7 @@ import javax.management.MalformedObjectN
 import javax.management.ObjectName;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.TabularData;
-
 import junit.textui.TestRunner;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.ActiveMQSession;
 import org.apache.activemq.BlobMessage;
@@ -90,7 +88,7 @@ public class MBeanTest extends EmbeddedB
     }
 
     public void testConnectors() throws Exception{
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
         assertEquals("openwire URL port doesn't equal bind Address",
@@ -115,7 +113,7 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnection(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
@@ -142,7 +140,7 @@ public class MBeanTest extends EmbeddedB
 
         String newDestination = getSecondDestinationString();
         for (String messageID : messageIDs) {
-            echo("Moving message: " + messageID);
+            //echo("Moving message: " + messageID);
             queue.moveMessageTo(messageID, newDestination);
         }
 
@@ -154,7 +152,7 @@ public class MBeanTest extends EmbeddedB
 
         echo("Now browsing the second queue");
 
-        queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + newDestination + ",BrokerName=localhost");
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + newDestination );
         QueueViewMBean queueNew = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         long newQueuesize = queueNew.getQueueSize();
@@ -169,13 +167,13 @@ public class MBeanTest extends EmbeddedB
     }
 
     public void testRemoveMessages() throws Exception {
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
-        BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
+        BrokerViewMBean broker = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
         broker.addQueue(getDestinationString());
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
-        QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
+        QueueViewMBean queue = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
         String msg1 = queue.sendTextMessage("message 1");
         String msg2 = queue.sendTextMessage("message 2");
 
@@ -214,7 +212,7 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnection(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         long initialQueueSize = queue.getQueueSize();
@@ -236,7 +234,7 @@ public class MBeanTest extends EmbeddedB
         // now lets get the dead letter queue
         Thread.sleep(1000);
 
-        ObjectName dlqQueueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + SharedDeadLetterStrategy.DEFAULT_DEAD_LETTER_QUEUE_NAME + ",BrokerName=localhost");
+        ObjectName dlqQueueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + SharedDeadLetterStrategy.DEFAULT_DEAD_LETTER_QUEUE_NAME );
         QueueViewMBean dlq = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, dlqQueueViewMBeanName, QueueViewMBean.class, true);
 
         long initialDlqSize = dlq.getQueueSize();
@@ -288,14 +286,14 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnection(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString() );
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         String newDestination = getSecondDestinationString();
         queue.moveMatchingMessagesTo("counter > 2", newDestination);
 
-        queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + newDestination + ",BrokerName=localhost");
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + newDestination);
 
         queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
         int movedSize = MESSAGE_COUNT-3;
@@ -312,18 +310,18 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnection(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
-        QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
+        QueueViewMBean queue = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         String newDestination = getSecondDestinationString();
         long queueSize = queue.getQueueSize();
         assertTrue(queueSize > 0);
         queue.copyMatchingMessagesTo("counter > 2", newDestination);
 
-        queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + newDestination + ",BrokerName=localhost");
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + newDestination);
 
-        queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
+        queue = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         LOG.info("Queue: " + queueViewMBeanName + " now has: " + queue.getQueueSize() + " message(s)");
         assertEquals("Expected messages in a queue: " + queueViewMBeanName, MESSAGE_COUNT-3, queue.getQueueSize());
@@ -335,25 +333,26 @@ public class MBeanTest extends EmbeddedB
     }
 
     public void testCreateDestinationWithSpacesAtEnds() throws Exception {
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
-        BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
+        BrokerViewMBean broker = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
         // create 2 topics
         broker.addTopic(getDestinationString() + "1 ");
         broker.addTopic(" " + getDestinationString() + "2");
         broker.addTopic(" " + getDestinationString() + "3 ");
 
-        assertNotRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "1 ");
-        assertNotRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination= " + getDestinationString() + "2");
-        assertNotRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination= " + getDestinationString() + "3 ");
-
-        ObjectName topicObjName1 = assertRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "1");
-        ObjectName topicObjName2 = assertRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "2");
-        ObjectName topicObjName3 = assertRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "3");
 
-        TopicViewMBean topic1 = (TopicViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName1, TopicViewMBean.class, true);
-        TopicViewMBean topic2 = (TopicViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName2, TopicViewMBean.class, true);
-        TopicViewMBean topic3 = (TopicViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName3, TopicViewMBean.class, true);
+        assertNotRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "1 ");
+        assertNotRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName= " + getDestinationString() + "2");
+        assertNotRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName= " + getDestinationString() + "3 ");
+
+        ObjectName topicObjName1 = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "1");
+        ObjectName topicObjName2 = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "2");
+        ObjectName topicObjName3 = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "3");
+
+        TopicViewMBean topic1 = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName1, TopicViewMBean.class, true);
+        TopicViewMBean topic2 = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName2, TopicViewMBean.class, true);
+        TopicViewMBean topic3 = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName3, TopicViewMBean.class, true);
 
         assertEquals("topic1 Durable subscriber count", 0, topic1.getConsumerCount());
         assertEquals("topic2 Durable subscriber count", 0, topic2.getConsumerCount());
@@ -376,12 +375,12 @@ public class MBeanTest extends EmbeddedB
     protected void assertSendViaMBean() throws Exception {
         String queueName = getDestinationString() + ".SendMBBean";
 
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         echo("Create QueueView MBean...");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
         broker.addQueue(queueName);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + queueName + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queueName);
 
         echo("Create QueueView MBean...");
         QueueViewMBean proxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
@@ -457,7 +456,7 @@ public class MBeanTest extends EmbeddedB
         Integer mbeancnt = mbeanServer.getMBeanCount();
         echo("Mbean count :" + mbeancnt);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
         echo("Create QueueView MBean...");
         QueueViewMBean proxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
@@ -508,7 +507,7 @@ public class MBeanTest extends EmbeddedB
 
     protected void assertCreateAndDestroyDurableSubscriptions() throws Exception {
         // lets create a new topic
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         echo("Create QueueView MBean...");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
@@ -532,15 +531,15 @@ public class MBeanTest extends EmbeddedB
     }
 
     protected void assertConsumerCounts() throws Exception {
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
         // create 2 topics
         broker.addTopic(getDestinationString() + "1");
         broker.addTopic(getDestinationString() + "2");
 
-        ObjectName topicObjName1 = assertRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "1");
-        ObjectName topicObjName2 = assertRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "2");
+        ObjectName topicObjName1 = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "1");
+        ObjectName topicObjName2 = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "2");
         TopicViewMBean topic1 = (TopicViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName1, TopicViewMBean.class, true);
         TopicViewMBean topic2 = (TopicViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName2, TopicViewMBean.class, true);
 
@@ -583,15 +582,15 @@ public class MBeanTest extends EmbeddedB
     }
 
     protected void assertProducerCounts() throws Exception {
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
         // create 2 topics
         broker.addTopic(getDestinationString() + "1");
         broker.addTopic(getDestinationString() + "2");
 
-        ObjectName topicObjName1 = assertRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "1");
-        ObjectName topicObjName2 = assertRegisteredObjectName(domain + ":Type=Topic,BrokerName=localhost,Destination=" + getDestinationString() + "2");
+        ObjectName topicObjName1 = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "1");
+        ObjectName topicObjName2 = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=" + getDestinationString() + "2");
         TopicViewMBean topic1 = (TopicViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName1, TopicViewMBean.class, true);
         TopicViewMBean topic2 = (TopicViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, topicObjName2, TopicViewMBean.class, true);
 
@@ -781,7 +780,7 @@ public class MBeanTest extends EmbeddedB
     }
 
     protected void echo(String text) {
-        LOG.info(text);
+        //LOG.info(text);
     }
 
     protected String getSecondDestinationString() {
@@ -791,7 +790,7 @@ public class MBeanTest extends EmbeddedB
     public void testDynamicProducerView() throws Exception {
         connection = connectionFactory.createConnection();
 
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
         assertEquals(0, broker.getDynamicDestinationProducers().length);
@@ -849,9 +848,13 @@ public class MBeanTest extends EmbeddedB
         Session session = connection.createSession(transacted, authMode);
         ActiveMQTempQueue tQueue = (ActiveMQTempQueue) session.createTemporaryQueue();
         Thread.sleep(1000);
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type="+  JMXSupport.encodeObjectNamePart(tQueue.getDestinationTypeAsString())+",Destination=" + JMXSupport.encodeObjectNamePart(tQueue.getPhysicalName()) + ",BrokerName=localhost");
 
-        // should not throw an exception
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType="
+                + JMXSupport.encodeObjectNamePart(tQueue.getDestinationTypeAsString())
+                + ",destinationName=" + JMXSupport.encodeObjectNamePart(tQueue.getPhysicalName()));
+
+                        // should not throw an exception
+
         mbeanServer.getObjectInstance(queueViewMBeanName);
 
         tQueue.delete();
@@ -871,7 +874,7 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnectionWithBlobMessage(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
@@ -897,7 +900,7 @@ public class MBeanTest extends EmbeddedB
     }
 
     public void testDestinationOptionsAreVisible() throws Exception {
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + QUEUE_WITH_OPTIONS + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + QUEUE_WITH_OPTIONS );
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
@@ -924,7 +927,7 @@ public class MBeanTest extends EmbeddedB
         MessageConsumer queueConsumer = session.createConsumer(queue);
         MessageProducer producer = session.createProducer(queue);
 
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
         Thread.sleep(100);
@@ -935,7 +938,7 @@ public class MBeanTest extends EmbeddedB
         LOG.info("Looking for Subscription: " + subscriptionName);
 
         SubscriptionViewMBean subscriberView =
-            (SubscriptionViewMBean)MBeanServerInvocationHandler.newProxyInstance(
+            MBeanServerInvocationHandler.newProxyInstance(
                     mbeanServer, subscriptionName, SubscriptionViewMBean.class, true);
         assertNotNull(subscriberView);
 
@@ -943,7 +946,7 @@ public class MBeanTest extends EmbeddedB
         LOG.info("Looking for Connection: " + connectionName);
         assertNotNull(connectionName);
         ConnectionViewMBean connectionView =
-            (ConnectionViewMBean)MBeanServerInvocationHandler.newProxyInstance(
+            MBeanServerInvocationHandler.newProxyInstance(
                     mbeanServer, connectionName, ConnectionViewMBean.class, true);
         assertNotNull(connectionView);
 
@@ -982,7 +985,7 @@ public class MBeanTest extends EmbeddedB
         String topicName = getDestinationString() + ".DurableTopic";
         Topic topic = session.createTopic(topicName);
 
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         echo("Create QueueView MBean...");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
@@ -1038,7 +1041,7 @@ public class MBeanTest extends EmbeddedB
         MessageConsumer topicConsumer = session.createConsumer(topic);
         MessageConsumer durable = session.createDurableSubscriber(topic, "Durable");
 
-        ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
 
         Thread.sleep(100);
@@ -1074,12 +1077,12 @@ public class MBeanTest extends EmbeddedB
                 assertNull(subscriberView.getUserName());
             }
         }
+        ObjectName query = new ObjectName(domain + ":type=Broker,brokerName=localhost,connector=*," + "connectorName=*,connectionName=MBeanTest");
 
-        Set<ObjectName> names = mbeanServer.queryNames(null, null);
+        Set<ObjectName> names = mbeanServer.queryNames(query, null);
         boolean found = false;
         for (ObjectName name : names) {
-            if (name.toString().startsWith(domain + ":BrokerName=localhost,Type=Connection,ConnectorName=tcp") &&
-                name.toString().endsWith("Connection=MBeanTest")) {
+            if (name.toString().endsWith("connectionName=MBeanTest")) {
 
                 ConnectionViewMBean connectionView =
                     (ConnectionViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, name, ConnectionViewMBean.class, true);
@@ -1103,14 +1106,14 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnection(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         String newDestination = getSecondDestinationString();
         queue.moveMatchingMessagesTo("", newDestination);
 
-        queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + newDestination + ",BrokerName=localhost");
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + newDestination);
 
         queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
         int movedSize = MESSAGE_COUNT;
@@ -1142,14 +1145,14 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnection(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         String newDestination = getSecondDestinationString();
         queue.copyMatchingMessagesTo("", newDestination);
 
-        queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + newDestination + ",BrokerName=localhost");
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + newDestination );
 
         queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
         int movedSize = MESSAGE_COUNT;
@@ -1181,7 +1184,7 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnection(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
@@ -1217,7 +1220,7 @@ public class MBeanTest extends EmbeddedB
         connection = connectionFactory.createConnection();
         useConnectionWithByteMessage(connection);
 
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
 
         QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/PurgeTest.java Wed Dec 26 10:58:30 2012
@@ -16,21 +16,23 @@
  */
 package org.apache.activemq.broker.jmx;
 
-import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerInvocationHandler;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-
 import junit.framework.Test;
 import junit.textui.TestRunner;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.EmbeddedBrokerTestSupport;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.store.PersistenceAdapter;
-import org.apache.activemq.store.amq.AMQPersistenceAdapter;
-import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
+import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
 import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -73,7 +75,9 @@ public class PurgeTest extends EmbeddedB
         }
 
         // Now get the QueueViewMBean and purge
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        String objectNameStr = broker.getBrokerObjectName().toString();
+        objectNameStr += ",destinationType=Queue,destinationName="+getDestinationString();
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(objectNameStr);
         QueueViewMBean proxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         long count = proxy.getQueueSize();
@@ -104,7 +108,7 @@ public class PurgeTest extends EmbeddedB
     }
 
     public void initCombosForTestDelete() {
-        addCombinationValues("persistenceAdapter", new Object[] {new MemoryPersistenceAdapter(), new AMQPersistenceAdapter(), new JDBCPersistenceAdapter()});
+        addCombinationValues("persistenceAdapter", new Object[] {new MemoryPersistenceAdapter(), new KahaDBPersistenceAdapter()});
     }
 
     public void testDeleteSameProducer() throws Exception {
@@ -122,7 +126,7 @@ public class PurgeTest extends EmbeddedB
         Message received = consumer.receive(1000);
         assertEquals(message, received);
 
-        ObjectName brokerViewMBeanName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean brokerProxy = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerViewMBeanName, BrokerViewMBean.class, true);
 
         brokerProxy.removeQueue(getDestinationString());
@@ -144,10 +148,11 @@ public class PurgeTest extends EmbeddedB
         sendMessages(session, messageCount);
 
         // Now get the QueueViewMBean and purge
-        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+
+        ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
         QueueViewMBean queueProxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
-        ObjectName brokerViewMBeanName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
+        ObjectName brokerViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
         BrokerViewMBean brokerProxy = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerViewMBeanName, BrokerViewMBean.class, true);
 
         long count = queueProxy.getQueueSize();
@@ -157,7 +162,7 @@ public class PurgeTest extends EmbeddedB
 
         sendMessages(session, messageCount);
 
-        queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
         queueProxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         count = queueProxy.getQueueSize();
@@ -165,7 +170,7 @@ public class PurgeTest extends EmbeddedB
 
         queueProxy.purge();
 
-        // Queues have a special case once there are more than a thousand
+        // Queue have a special case once there are more than a thousand
         // dead messages, make sure we hit that.
         messageCount += 1000;
         sendMessages(session, messageCount);
@@ -177,7 +182,7 @@ public class PurgeTest extends EmbeddedB
 
         sendMessages(session, messageCount);
 
-        queueViewMBeanName = assertRegisteredObjectName(domain + ":Type=Queue,Destination=" + getDestinationString() + ",BrokerName=localhost");
+        queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + getDestinationString());
         queueProxy = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
 
         count = queueProxy.getQueueSize();

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueuePurgeTest.java Wed Dec 26 10:58:30 2012
@@ -29,13 +29,9 @@ import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-
-import junit.framework.TestCase;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.CombinationTestSupport;
 import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.BrokerTestSupport;
 import org.apache.activemq.broker.jmx.QueueViewMBean;
 import org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy;
 import org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy;
@@ -142,9 +138,9 @@ public class QueuePurgeTest extends Comb
 
     private QueueViewMBean getProxyToQueueViewMBean()
             throws MalformedObjectNameException, JMSException {
-        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq"
-                + ":Type=Queue,Destination=" + queue.getQueueName()
-                + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName =
+                new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName="
+                + queue.getQueueName());
         QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext()
                 .newProxyInstance(queueViewMBeanName,
                         QueueViewMBean.class, true);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3934Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3934Test.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3934Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3934Test.java Wed Dec 26 10:58:30 2012
@@ -17,9 +17,6 @@
 
 package org.apache.activemq.bugs;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
 import javax.jms.Connection;
 import javax.jms.Destination;
 import javax.jms.JMSException;
@@ -29,7 +26,6 @@ import javax.jms.Session;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.openmbean.CompositeData;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.jmx.QueueViewMBean;
@@ -39,6 +35,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 public class AMQ3934Test {
 
@@ -99,8 +97,7 @@ public class AMQ3934Test {
 
     private QueueViewMBean getProxyToQueueViewMBean() throws MalformedObjectNameException, NullPointerException,
             JMSException {
-        final ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:Type=Queue,Destination="
-                + queue.getQueueName() + ",BrokerName=localhost");
+        final ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queue.getQueueName());
         final QueueViewMBean proxy = (QueueViewMBean) brokerService.getManagementContext().newProxyInstance(
                 queueViewMBeanName, QueueViewMBean.class, true);
         return proxy;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java Wed Dec 26 10:58:30 2012
@@ -16,9 +16,6 @@
  */
 package org.apache.activemq.bugs;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
@@ -33,7 +30,6 @@ import javax.jms.MessageListener;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.management.ObjectName;
-
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.ActiveMQPrefetchPolicy;
@@ -46,6 +42,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 public class AMQ4083Test {
 
@@ -113,8 +111,6 @@ public class AMQ4083Test {
         assertEquals(101, queueView.getInFlightCount());
 
         consumer.setMessageListener(new MessageListener() {
-
-            @Override
             public void onMessage(Message message) {
                 try {
                     message.acknowledge();
@@ -133,7 +129,6 @@ public class AMQ4083Test {
 
         assertTrue("Inflight count should reach zero, currently: " + queueView.getInFlightCount(), Wait.waitFor(new Wait.Condition() {
 
-            @Override
             public boolean isSatisified() throws Exception {
                 return queueView.getInFlightCount() == 0;
             }
@@ -177,8 +172,6 @@ public class AMQ4083Test {
         assertEquals(101, queueView.getInFlightCount());
 
         consumer.setMessageListener(new MessageListener() {
-
-            @Override
             public void onMessage(Message message) {
                 try {
                     session.commit();
@@ -507,8 +500,7 @@ public class AMQ4083Test {
     }
 
     private QueueViewMBean getProxyToQueueViewMBean() throws Exception {
-        final ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:Type=Queue,Destination="
-                + queue.getQueueName() + ",BrokerName=localhost");
+        final ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queue.getQueueName());
         final QueueViewMBean proxy = (QueueViewMBean) brokerService.getManagementContext().newProxyInstance(
                 queueViewMBeanName, QueueViewMBean.class, true);
         return proxy;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jmx/OpenTypeSupportTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jmx/OpenTypeSupportTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jmx/OpenTypeSupportTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/jmx/OpenTypeSupportTest.java Wed Dec 26 10:58:30 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.activemq.jmx;
 
-import static org.junit.Assert.assertEquals;
-
 import javax.jms.BytesMessage;
 import javax.jms.Connection;
 import javax.jms.Destination;
@@ -27,7 +25,6 @@ import javax.jms.Session;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.openmbean.CompositeData;
-
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.jmx.CompositeDataConstants;
@@ -40,6 +37,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
 
 public class OpenTypeSupportTest {
     private static final Logger LOG = LoggerFactory.getLogger(OpenTypeSupportTest.class);
@@ -109,9 +107,7 @@ public class OpenTypeSupportTest {
     }
 
     private QueueViewMBean getProxyToQueueViewMBean() throws MalformedObjectNameException, JMSException {
-        ObjectName queueViewMBeanName = new ObjectName(
-                "org.apache.activemq" + ":Type=Queue,Destination=" +
-                queue.getQueueName() + ",BrokerName=localhost");
+        final ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queue.getQueueName());
         QueueViewMBean proxy = (QueueViewMBean)
             brokerService.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
         return proxy;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usage/CompositeMessageCursorUsageTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usage/CompositeMessageCursorUsageTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usage/CompositeMessageCursorUsageTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usage/CompositeMessageCursorUsageTest.java Wed Dec 26 10:58:30 2012
@@ -84,7 +84,7 @@ public class CompositeMessageCursorUsage
     }
     
     public QueueViewMBean getQueueView(String queueName) throws Exception {
-        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq" + ":Type=Queue,Destination=" + queueName + ",BrokerName=localhost");
+        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq" + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queueName);
         return (QueueViewMBean) broker.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
     }
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java Wed Dec 26 10:58:30 2012
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.util.Date;
 import java.util.Vector;
+
 import javax.jms.Connection;
 import javax.jms.DeliveryMode;
 import javax.jms.JMSException;
@@ -145,8 +146,12 @@ public class TopicDurableConnectStatsTes
 
         DurableSubscriptionViewMBean subscriber1 = null;
 
-        ObjectName subscriberObjName1 = assertRegisteredObjectName(domain + ":BrokerName=" + getName(true) + ",Type=Subscription,persistentMode=Durable,subscriptionID=SubsId,destinationType=Topic,destinationName=" + topic.getTopicName() + ",clientId=cliId1");
-        subscriber1 = (DurableSubscriptionViewMBean) MBeanServerInvocationHandler.newProxyInstance(mbeanServer, subscriberObjName1, DurableSubscriptionViewMBean.class, true);
+        ObjectName query = new ObjectName(domain + ":type=Broker,brokerName=" + getName(true) + ",destinationType=Topic,destinationName=" + topic.getTopicName() + ",endpoint=Consumer,clientId=cliId1,consumerId=*");
+
+        java.util.Set<ObjectName>set = mbeanServer.queryNames(query,null);
+
+        ObjectName subscriberObjName1 = set.iterator().next();
+        subscriber1 = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, subscriberObjName1, DurableSubscriptionViewMBean.class, true);
 
         LOG.info("Beginning Pending Queue Size count: " + subscriber1.getPendingQueueSize());
         LOG.info("Prefetch Limit: " + subscriber1.getPrefetchSize());
@@ -196,7 +201,6 @@ public class TopicDurableConnectStatsTes
         consumer2.setMessageListener(listener);
 
         assertTrue("received all sent", Wait.waitFor(new Wait.Condition() {
-            @Override
             public boolean isSatisified() throws Exception {
                 return numMessages == listener.count;
             }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java?rev=1425875&r1=1425874&r2=1425875&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java Wed Dec 26 10:58:30 2012
@@ -16,22 +16,22 @@
  */
 package org.apache.activemq.xbean;
 
-import org.apache.activemq.broker.BrokerFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.jmx.BrokerViewMBean;
-import org.apache.activemq.util.JMXSupport;
 import java.net.URI;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
+
 import javax.management.MBeanServerConnection;
 import javax.management.MBeanServerInvocationHandler;
 import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
-
 import junit.framework.TestCase;
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.jmx.BrokerViewMBean;
+import org.apache.activemq.util.JMXSupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,8 +48,8 @@ public class ManagementContextXBeanConfi
         assertEquals("test.domain", brokerService.getManagementContext().getJmxDomainName());
         // Make sure the broker is registered in the right jmx domain.
         Hashtable<String, String> map = new Hashtable<String, String>();
-        map.put("Type", "Broker");
-        map.put("BrokerName", JMXSupport.encodeObjectNamePart("localhost"));
+        map.put("type", "Broker");
+        map.put("brokerName", JMXSupport.encodeObjectNamePart("localhost"));
         ObjectName on = new ObjectName("test.domain", map);
         Object value = brokerService.getManagementContext().getAttribute(on, "TotalEnqueueCount");
         assertNotNull(value);
@@ -77,7 +77,7 @@ public class ManagementContextXBeanConfi
     public void assertAuthentication(JMXConnector connector) throws Exception {
         connector.connect();
         MBeanServerConnection connection = connector.getMBeanServerConnection();
-        ObjectName name = new ObjectName("test.domain:BrokerName=localhost,Type=Broker");
+        ObjectName name = new ObjectName("test.domain:type=Broker,brokerName=localhost");
         BrokerViewMBean mbean = (BrokerViewMBean) MBeanServerInvocationHandler
                 .newProxyInstance(connection, name, BrokerViewMBean.class, true);
         LOG.info("Broker " + mbean.getBrokerId() + " - " + mbean.getBrokerName());



Mime
View raw message