You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2015/06/19 13:47:43 UTC
[4/4] activemq git commit: add sanity test for masterslave scheme for
networkconnectors
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 <ga...@gmail.com>
Authored: Thu Jun 18 16:11:56 2015 +0100
Committer: gtully <ga...@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();
+ }
+
+ }
}