activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r742443 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java
Date Mon, 09 Feb 2009 12:27:07 GMT
Author: gtully
Date: Mon Feb  9 12:27:07 2009
New Revision: 742443

URL: http://svn.apache.org/viewvc?rev=742443&view=rev
Log:
resolve npe if no mbeans found

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

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=742443&r1=742442&r2=742443&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
Mon Feb  9 12:27:07 2009
@@ -57,7 +57,7 @@
     public void testMbeanPresenceOnNetworkBrokerRestart() throws Exception {
         BrokerService broker = createBroker();
         broker.start();
-        assertEquals(1, countMbeans(broker, "Connector", 2000));
+        assertEquals(1, countMbeans(broker, "Connector", 5000));
         assertEquals(0, countMbeans(broker, "Connection"));
         BrokerService networkedBroker = null;
         for (int i=0; i<numRestarts; i++) {       
@@ -115,17 +115,21 @@
         final ObjectName beanName = new ObjectName("org.apache.activemq:BrokerName="
                 + broker.getBrokerName() + ",Type=" + type +",*");
         Set<?> mbeans = null;
-        
+        int count = 0;
         do {
             if (timeout > 0) {
                 Thread.sleep(100);
             }
             MBeanServerConnection mbsc = getMBeanServerConnection();
             if (mbsc != null) {
+                LOG.info("Query name: " + beanName);
                 mbeans = mbsc.queryMBeans(beanName, null);
+                if (mbeans != null) {
+                    count = mbeans.size();
+                }
             }
         } while ((mbeans == null || mbeans.isEmpty()) && expiryTime > System.currentTimeMillis());
-        return mbeans.size();
+        return count;
     }
 
     private MBeanServerConnection getMBeanServerConnection() throws MalformedURLException
{



Mime
View raw message