activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1149349 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/JMXRemoveQueueThenSendIgnoredTest.java
Date Thu, 21 Jul 2011 20:36:44 GMT
Author: tabish
Date: Thu Jul 21 20:36:44 2011
New Revision: 1149349

URL: http://svn.apache.org/viewvc?rev=1149349&view=rev
Log:
fix failing test.

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/JMXRemoveQueueThenSendIgnoredTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/JMXRemoveQueueThenSendIgnoredTest.java?rev=1149349&r1=1149348&r2=1149349&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/JMXRemoveQueueThenSendIgnoredTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/JMXRemoveQueueThenSendIgnoredTest.java
Thu Jul 21 20:36:44 2011
@@ -18,8 +18,6 @@ package org.apache.activemq.usecases;
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.List;
-
 import javax.jms.DeliveryMode;
 import javax.jms.JMSException;
 import javax.jms.Message;
@@ -31,6 +29,7 @@ import javax.jms.QueueSession;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
 import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
@@ -38,6 +37,7 @@ import javax.management.remote.JMXServic
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.jmx.QueueViewMBean;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 public class JMXRemoveQueueThenSendIgnoredTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(JMXRemoveQueueThenSendIgnoredTest.class);
+    private static final String domain = "org.apache.activemq";
 
     private BrokerService brokerService;
     private MessageProducer producer;
@@ -132,10 +133,13 @@ public class JMXRemoveQueueThenSendIgnor
     private int numberOfMessages() throws Exception {
         JMXConnector jmxConnector = JMXConnectorFactory.connect(new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi"));
         MBeanServerConnection mbeanServerConnection = jmxConnector.getMBeanServerConnection();
-        String beanId = "org.apache.activemq:BrokerName=dev,Type=Queue,Destination=myqueue";
-        List<?> object = (List<?>) mbeanServerConnection.invoke(new ObjectName(beanId),
"browseMessages", null, null);
+        ObjectName queueViewMBeanName = new ObjectName(
+            domain + ":Type=Queue,Destination=myqueue,BrokerName=dev");
+        QueueViewMBean queue = (QueueViewMBean)MBeanServerInvocationHandler.newProxyInstance(
+                mbeanServerConnection, queueViewMBeanName, QueueViewMBean.class, true);
+        long size = queue.getQueueSize();
         jmxConnector.close();
-        return object.size();
+        return (int)size;
     }
 
     private void removeQueue() throws Exception {



Mime
View raw message