You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2017/11/06 11:55:38 UTC

qpid-broker-j git commit: NO-JIRA: [Broker-J] Change test MultiNodeTest#testPriority to make sure that both replicas have the test data fully replicated before shutting down the master

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master 440268243 -> e5be145b5


NO-JIRA: [Broker-J] Change test MultiNodeTest#testPriority to make sure that both replicas have the test data fully replicated before shutting down the master


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/e5be145b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/e5be145b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/e5be145b

Branch: refs/heads/master
Commit: e5be145b5199554a705a3ab16a28c4f0473e8bdd
Parents: 4402682
Author: Alex Rudyy <or...@apache.org>
Authored: Mon Nov 6 11:53:59 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Mon Nov 6 11:53:59 2017 +0000

----------------------------------------------------------------------
 .../berkeleydb/replication/MultiNodeTest.java   | 35 ++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/e5be145b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
----------------------------------------------------------------------
diff --git a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
index cf51142..f86f467 100644
--- a/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
+++ b/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java
@@ -55,6 +55,7 @@ import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.jms.ConnectionListener;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.State;
+import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBHARemoteReplicationNode;
 import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBHAVirtualHostNode;
 import org.apache.qpid.server.virtualhostnode.berkeleydb.NodeRole;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
@@ -679,11 +680,11 @@ public class MultiNodeTest extends QpidBrokerTestCase
         Set<Integer> ports = _groupCreator.getBrokerPortNumbersForNodes();
         for (Integer port : ports)
         {
-            if (activeBrokerPort != port.intValue())
+            if (activeBrokerPort != port)
             {
                 priority = priority + 1;
                 highestPriorityBrokerPort = port;
-                _groupCreator.setNodeAttributes(port, port, Collections.<String, Object>singletonMap(BDBHAVirtualHostNode.PRIORITY, priority));
+                _groupCreator.setNodeAttributes(port, port, Collections.singletonMap(BDBHAVirtualHostNode.PRIORITY, priority));
                 Map<String, Object> attributes = _groupCreator.getNodeAttributes(port, port);
                 assertEquals("Broker has unexpected priority", priority, attributes.get(BDBHAVirtualHostNode.PRIORITY));
             }
@@ -691,6 +692,36 @@ public class MultiNodeTest extends QpidBrokerTestCase
 
         LOGGER.info("Broker on port " + highestPriorityBrokerPort + " has the highest priority of " + priority);
 
+        // make sure all remote nodes are materialized on the master
+        // in order to make sure that DBPing is not invoked
+        for (Integer port : ports)
+        {
+            if (activeBrokerPort != port)
+            {
+                _groupCreator.awaitNodeToAttainAttributeValue(activeBrokerPort, port, BDBHARemoteReplicationNode.ROLE, "REPLICA");
+            }
+        }
+
+        // do work on master
+        assertProducingConsuming(connection);
+
+        Map<String, Object> masterNodeAttributes = _groupCreator.getNodeAttributes(activeBrokerPort);
+
+        Object lastTransactionId = masterNodeAttributes.get(BDBHAVirtualHostNode.LAST_KNOWN_REPLICATION_TRANSACTION_ID);
+        assertTrue("Unexpected last transaction id: " + lastTransactionId, lastTransactionId instanceof Number);
+
+        // make sure all remote nodes have the same transaction id as master
+        for (Integer port : ports)
+        {
+            if (activeBrokerPort != port)
+            {
+                _groupCreator.awaitNodeToAttainAttributeValue(activeBrokerPort,
+                                                              port,
+                                                              BDBHARemoteReplicationNode.LAST_KNOWN_REPLICATION_TRANSACTION_ID,
+                                                              String.valueOf(lastTransactionId));
+            }
+        }
+
         LOGGER.info("Shutting down the MASTER");
         _groupCreator.stopNode(activeBrokerPort);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org