fix brokerSerivce instances left running if assertions fail

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1404354 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-10-31 21:13:45 +00:00
parent 0ad3cfc11e
commit 5207f02e6a
1 changed files with 9 additions and 6 deletions

View File

@ -62,12 +62,15 @@ public class DuplexNetworkMBeanTest {
BrokerService networkedBroker = null;
for (int i=0; i<numRestarts; i++) {
networkedBroker = createNetworkedBroker();
networkedBroker.start();
assertEquals(1, countMbeans(networkedBroker, "NetworkBridge", 2000));
assertEquals(1, countMbeans(broker, "NetworkBridge", 2000));
assertEquals(1, countMbeans(broker, "Connection"));
networkedBroker.stop();
networkedBroker.waitUntilStopped();
try {
networkedBroker.start();
assertEquals(1, countMbeans(networkedBroker, "NetworkBridge", 2000));
assertEquals(1, countMbeans(broker, "NetworkBridge", 2000));
assertEquals(1, countMbeans(broker, "Connection"));
} finally {
networkedBroker.stop();
networkedBroker.waitUntilStopped();
}
assertEquals(0, countMbeans(networkedBroker, "stopped"));
assertEquals(0, countMbeans(broker, "NetworkBridge"));
}