activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [4/5] activemq-artemis git commit: ARTEMIS-179 fix BindingsClusterTest
Date Tue, 11 Aug 2015 15:22:41 GMT
ARTEMIS-179 fix BindingsClusterTest


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/38188cdf
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/38188cdf
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/38188cdf

Branch: refs/heads/master
Commit: 38188cdf2e6a1a04c6b900ec6bbc6bd49a406b4b
Parents: 3bb88c6
Author: jbertram <jbertram@apache.org>
Authored: Mon Aug 10 16:19:01 2015 -0500
Committer: jbertram <jbertram@apache.org>
Committed: Mon Aug 10 16:19:01 2015 -0500

----------------------------------------------------------------------
 .../jms/cluster/BindingsClusterTest.java        | 42 +++++++++++---------
 1 file changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/38188cdf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/BindingsClusterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/BindingsClusterTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/BindingsClusterTest.java
index 29c0edc..674c9f1 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/BindingsClusterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/BindingsClusterTest.java
@@ -402,28 +402,32 @@ public class BindingsClusterTest extends JMSClusteredTestBase {
    }
 
    private void crash() throws Exception {
+      /*
+       * 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();
+      RemotingConnection forwardingConnection = getForwardingConnection(bridge);
+      forwardingConnection.addFailureListener(new FailureListener() {
+         @Override
+         public void connectionFailed(ActiveMQException exception, boolean failedOver) {
+            latch.countDown();
+         }
+
+         @Override
+         public void connectionFailed(final ActiveMQException me, boolean failedOver, String
scaleDownTargetNodeID) {
+            connectionFailed(me, failedOver);
+         }
+      });
+      forwardingConnection.fail(new ActiveMQNotConnectedException());
+      assertTrue(latch.await(5000, TimeUnit.MILLISECONDS));
+
       if (crash) {
          jmsServer2.stop();
       }
-      else {
-         final CountDownLatch latch = new CountDownLatch(1);
-         ClusterConnectionImpl next = (ClusterConnectionImpl) server1.getClusterManager().getClusterConnections().iterator().next();
-         BridgeImpl bridge = (BridgeImpl) next.getRecords().values().iterator().next().getBridge();
-         RemotingConnection forwardingConnection = getForwardingConnection(bridge);
-         forwardingConnection.addFailureListener(new FailureListener() {
-            @Override
-            public void connectionFailed(ActiveMQException exception, boolean failedOver)
{
-               latch.countDown();
-            }
-
-            @Override
-            public void connectionFailed(final ActiveMQException me, boolean failedOver,
String scaleDownTargetNodeID) {
-               connectionFailed(me, failedOver);
-            }
-         });
-         forwardingConnection.fail(new ActiveMQNotConnectedException());
-         assertTrue(latch.await(5000, TimeUnit.MILLISECONDS));
-      }
    }
 
    private void restart() throws Exception {


Mime
View raw message