ARTEMIS-179 fix BindingsClusterTest

This commit is contained in:
jbertram 2015-08-10 16:19:01 -05:00
parent 3bb88c60ca
commit 38188cdf2e
1 changed files with 23 additions and 19 deletions

View File

@ -402,10 +402,11 @@ public class BindingsClusterTest extends JMSClusteredTestBase {
}
private void crash() throws Exception {
if (crash) {
jmsServer2.stop();
}
else {
/*
* Rather than just calling stop() on the server here we want to simulate an actual node crash or bridge failure
* so the bridge's failure listener needs to get something other than a DISCONNECTED message. In this case we
* simulate a NOT_CONNECTED exception.
*/
final CountDownLatch latch = new CountDownLatch(1);
ClusterConnectionImpl next = (ClusterConnectionImpl) server1.getClusterManager().getClusterConnections().iterator().next();
BridgeImpl bridge = (BridgeImpl) next.getRecords().values().iterator().next().getBridge();
@ -423,6 +424,9 @@ public class BindingsClusterTest extends JMSClusteredTestBase {
});
forwardingConnection.fail(new ActiveMQNotConnectedException());
assertTrue(latch.await(5000, TimeUnit.MILLISECONDS));
if (crash) {
jmsServer2.stop();
}
}