validate (wait for) mbean existance before returning an mbean view - get to the bottom of intermittent failure

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@904812 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-01-30 16:49:27 +00:00
parent 7a7ac1313b
commit 7b700ee7a2
1 changed files with 16 additions and 3 deletions

View File

@ -131,7 +131,7 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
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 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
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 {