activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [4/4] activemq git commit: add sanity test for masterslave scheme for networkconnectors
Date Fri, 19 Jun 2015 11:47:43 GMT
add sanity test for masterslave scheme for networkconnectors


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

Branch: refs/heads/master
Commit: e3a72cfa1d23d1e3f1ab44ee1d9841cd47ec2f96
Parents: cd32c60
Author: gtully <gary.tully@gmail.com>
Authored: Thu Jun 18 16:11:56 2015 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Fri Jun 19 12:36:32 2015 +0100

----------------------------------------------------------------------
 .../ft/QueueMasterSlaveSingleUrlTest.java       | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/e3a72cfa/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
index b7a35f4..c05f9d9 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
@@ -18,11 +18,13 @@ package org.apache.activemq.broker.ft;
 
 import java.io.File;
 import java.net.URI;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.activemq.leveldb.LevelDBStore;
+import org.apache.activemq.util.Wait;
 import org.junit.Ignore;
 
 
@@ -81,4 +83,36 @@ public class QueueMasterSlaveSingleUrlTest extends QueueMasterSlaveTestSupport
{
         }).start();
     }
 
+    public void testNetworkMasterSlave() throws Exception {
+
+        final BrokerService client = new BrokerService();
+        client.setBrokerName("client");
+        client.setPersistent(false);
+        client.getManagementContext().setCreateConnector(false);
+        client.addNetworkConnector("masterslave:(tcp://localhost:62001,tcp://localhost:62002)");
+        client.start();
+        try {
+            Wait.waitFor(new Wait.Condition() {
+                @Override
+                public boolean isSatisified() throws Exception {
+                    return client.getRegionBroker().getPeerBrokerInfos().length == 1;
+                }
+            });
+
+            assertTrue(!master.isSlave());
+            master.stop();
+            assertTrue("slave started", slaveStarted.await(60, TimeUnit.SECONDS));
+            assertTrue(!slave.get().isSlave());
+
+            Wait.waitFor(new Wait.Condition() {
+                @Override
+                public boolean isSatisified() throws Exception {
+                    return client.getRegionBroker().getPeerBrokerInfos().length == 1;
+                }
+            });
+        } finally {
+            client.stop();
+        }
+
+    }
 }


Mime
View raw message