activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r938823 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
Date Wed, 28 Apr 2010 08:59:46 GMT
Author: dejanb
Date: Wed Apr 28 08:59:46 2010
New Revision: 938823

URL: http://svn.apache.org/viewvc?rev=938823&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2323 - make test JMX independent

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java?rev=938823&r1=938822&r2=938823&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java
Wed Apr 28 08:59:46 2010
@@ -21,16 +21,13 @@ import javax.jms.Destination;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.Topic;
-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 org.apache.activemq.broker.BrokerRegistry;
 import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.jmx.QueueViewMBean;
+import org.apache.activemq.broker.region.Queue;
+import org.apache.activemq.broker.region.RegionBroker;
 import org.apache.activemq.command.ActiveMQDestination;
+import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.test.JmsTopicSendReceiveTest;
 
 
@@ -105,15 +102,13 @@ public class JmsQueueCompositeSendReceiv
             }
             producer.send(queue, message);
         }
-        JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi");
-        JMXConnector connector = JMXConnectorFactory.connect(url, null);
-        connector.connect();
-        MBeanServerConnection connection = connector.getMBeanServerConnection();
-        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:Type=Queue,Destination=TEST,BrokerName=localhost");
         
-        QueueViewMBean queueMbean = (QueueViewMBean) MBeanServerInvocationHandler.newProxyInstance(connection,
queueViewMBeanName, QueueViewMBean.class, true);
-        assertEquals(data.length, queueMbean.getQueueSize());
-        queueMbean.purge();
-        assertEquals(0, queueMbean.getQueueSize());
+        Thread.sleep(200); // wait for messages to be queued
+        
+        BrokerService broker = BrokerRegistry.getInstance().lookup("localhost");
+        Queue dest = (Queue)((RegionBroker)broker.getRegionBroker()).getQueueRegion().getDestinationMap().get(new
ActiveMQQueue("TEST"));
+        assertEquals(data.length, dest.getDestinationStatistics().getMessages().getCount());
+        dest.purge();
+        assertEquals(0, dest.getDestinationStatistics().getMessages().getCount());
     }
 }



Mime
View raw message