activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1050372 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/jmx/ManagementContext.java test/java/org/apache/activemq/usecases/DurableSubscriptionUnsubscribeTest.java
Date Fri, 17 Dec 2010 13:10:42 GMT
Author: dejanb
Date: Fri Dec 17 13:10:41 2010
New Revision: 1050372

URL: http://svn.apache.org/viewvc?rev=1050372&view=rev
Log:
tidying up jmx test to behave better in CI environments

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionUnsubscribeTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java?rev=1050372&r1=1050371&r2=1050372&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
Fri Dec 17 13:10:41 2010
@@ -305,7 +305,7 @@ public class ManagementContext implement
         return getMBeanServer().queryNames(name, query);
     }
     
-    public ObjectInstance getObjectInstance(ObjectName name) throws Exception {
+    public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException
{
         return getMBeanServer().getObjectInstance(name);
     }
     

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionUnsubscribeTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionUnsubscribeTest.java?rev=1050372&r1=1050371&r2=1050372&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionUnsubscribeTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionUnsubscribeTest.java
Fri Dec 17 13:10:41 2010
@@ -21,6 +21,9 @@ import org.apache.activemq.TestSupport;
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.ConnectionContext;
+import org.apache.activemq.broker.jmx.DurableSubscriptionViewMBean;
+import org.apache.activemq.broker.jmx.SubscriptionView;
+import org.apache.activemq.broker.jmx.SubscriptionViewMBean;
 import org.apache.activemq.broker.region.Destination;
 import org.apache.activemq.broker.region.DurableTopicSubscription;
 import org.apache.activemq.broker.region.Subscription;
@@ -77,12 +80,12 @@ public class DurableSubscriptionUnsubscr
             assertCount(100, 0);
         }
 
-        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
         ObjectName[] subs = broker.getAdminView().getInactiveDurableTopicSubscribers();
 
         for (int i = 0; i < subs.length; i++) {
-            ObjectName sub = subs[i];
-            mbs.invoke(sub, "destroy", null, null);
+            ObjectName subName = subs[i];
+            DurableSubscriptionViewMBean sub = (DurableSubscriptionViewMBean)broker.getManagementContext().newProxyInstance(subName,
DurableSubscriptionViewMBean.class, true);
+            sub.destroy();
 
             if (i % 20 == 0) {
                 Thread.sleep(1000);
@@ -226,12 +229,11 @@ public class DurableSubscriptionUnsubscr
 
     private int countMBean() throws MalformedObjectNameException, InstanceNotFoundException
{
         int count = 0;
-        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
         for (int i = 0; i < 100; i++) {
             String name = "org.apache.activemq:BrokerName=" + getName() + ",Type=Subscription,active=false,name="
+ getName() + "_SubsId" + i;
             ObjectName sub = new ObjectName(name);
             try {
-                ObjectInstance oi = mbs.getObjectInstance(sub);
+                broker.getManagementContext().getObjectInstance(sub);
                 count++;
             }
             catch (InstanceNotFoundException ignore) {



Mime
View raw message