You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2010/01/30 17:49:27 UTC

svn commit: r904812 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java

Author: gtully
Date: Sat Jan 30 16:49:27 2010
New Revision: 904812

URL: http://svn.apache.org/viewvc?rev=904812&view=rev
Log:
validate (wait for) mbean existance before returning an mbean view - get to the bottom of intermittent failure

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java?rev=904812&r1=904811&r2=904812&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java Sat Jan 30 16:49:27 2010
@@ -131,7 +131,7 @@
         assertTrue("all inflight messages expired ", Wait.waitFor(new Wait.Condition() {
             public boolean isSatisified() throws Exception {
                 return view.getInFlightCount() == 0;
-            }           
+            }        
         }));
         assertEquals("Wrong inFlightCount: ", 0, view.getInFlightCount());
         
@@ -321,8 +321,21 @@
             name = new ObjectName(domain + ":BrokerName=localhost,Type=Topic,Destination="
                     + destination.getPhysicalName());
         }
-        return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class,
-                true);
+        final DestinationViewMBean view = (DestinationViewMBean) 
+            broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class, true);
+        
+        assertTrue("validation: Mbean view for " + destination + " exists", Wait.waitFor(new Wait.Condition() {            
+            public boolean isSatisified() throws Exception {
+                boolean mbeanExists = false;
+                try {
+                    view.getConsumerCount();
+                    mbeanExists = true;
+                } catch (Exception notFoundExpectedOnSlowMachines) {
+                }
+                return mbeanExists;
+            }   
+        }));
+        return view;
     }
 
 	protected void tearDown() throws Exception {