use of org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay in project activemq-artemis by apache.
the class BackupSyncJournalTest method setUp.
@Override
@Before
public void setUp() throws Exception {
startBackupServer = false;
super.setUp();
setNumberOfMessages(defaultNMsgs);
locator = (ServerLocatorInternal) getServerLocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(15).setRetryInterval(200);
sessionFactory = createSessionFactoryAndWaitForTopology(locator, 1);
sessionFactory.addFailoverListener(failoverWaiter);
syncDelay = new BackupSyncDelay(backupServer, liveServer);
}
use of org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay in project activemq-artemis by apache.
the class QuorumFailOverTest method testQuorumVoting.
@Test
public void testQuorumVoting() throws Exception {
int[] liveServerIDs = new int[] { 0, 1, 2 };
setupCluster();
startServers(0, 1, 2);
new BackupSyncDelay(servers[4], servers[1], PacketImpl.REPLICATION_SCHEDULED_FAILOVER);
startServers(3, 4, 5);
for (int i : liveServerIDs) {
waitForTopology(servers[i], 3, 3);
}
waitForFailoverTopology(3, 0, 1, 2);
waitForFailoverTopology(4, 0, 1, 2);
waitForFailoverTopology(5, 0, 1, 2);
for (int i : liveServerIDs) {
setupSessionFactory(i, i + 3, isNetty(), false);
createQueue(i, QUEUES_TESTADDRESS, QUEUE_NAME, null, true);
addConsumer(i, i, QUEUE_NAME, null);
}
waitForBindings(0, QUEUES_TESTADDRESS, 1, 1, true);
waitForBindings(1, QUEUES_TESTADDRESS, 1, 1, true);
waitForBindings(2, QUEUES_TESTADDRESS, 1, 1, true);
send(0, QUEUES_TESTADDRESS, 10, false, null);
verifyReceiveRoundRobinInSomeOrder(true, 10, 0, 1, 2);
final TopologyListener liveTopologyListener = new TopologyListener("LIVE-1");
locators[0].addClusterTopologyListener(liveTopologyListener);
assertTrue("we assume 3 is a backup", servers[3].getHAPolicy().isBackup());
assertFalse("no shared storage", servers[3].getHAPolicy().isSharedStore());
failNode(0);
waitForFailoverTopology(4, 3, 1, 2);
waitForFailoverTopology(5, 3, 1, 2);
waitForBindings(3, QUEUES_TESTADDRESS, 1, 1, true);
assertTrue(servers[3].waitForActivation(2, TimeUnit.SECONDS));
assertFalse("3 should have failed over ", servers[3].getHAPolicy().isBackup());
failNode(1);
assertFalse("4 should have failed over ", servers[4].getHAPolicy().isBackup());
}
use of org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay in project activemq-artemis by apache.
the class ReplicatedLargeMessageWithDelayFailoverTest method setUp.
@Override
@Before
public void setUp() throws Exception {
startBackupServer = false;
super.setUp();
syncDelay = new BackupSyncDelay(backupServer, liveServer);
/* Using getName() here is a bit of a hack, but if the backup is started for this test then the test will fail
* intermittently due to an InterruptedException.
*/
if (!getName().equals("testBackupServerNotRemoved")) {
backupServer.start();
}
}
use of org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay in project activemq-artemis by apache.
the class ReplicatedWithDelayFailoverTest method setUp.
@Override
@Before
public void setUp() throws Exception {
startBackupServer = false;
super.setUp();
syncDelay = new BackupSyncDelay(backupServer, liveServer);
backupServer.start();
waitForServerToStart(backupServer.getServer());
}
use of org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay in project activemq-artemis by apache.
the class QuorumFailOverTest method testQuorumVotingLiveNotDead.
@Test
public void testQuorumVotingLiveNotDead() throws Exception {
int[] liveServerIDs = new int[] { 0, 1, 2 };
setupCluster();
startServers(0, 1, 2);
new BackupSyncDelay(servers[4], servers[1], PacketImpl.REPLICATION_SCHEDULED_FAILOVER);
startServers(3, 4, 5);
for (int i : liveServerIDs) {
waitForTopology(servers[i], 3, 3);
}
waitForFailoverTopology(3, 0, 1, 2);
waitForFailoverTopology(4, 0, 1, 2);
waitForFailoverTopology(5, 0, 1, 2);
for (int i : liveServerIDs) {
setupSessionFactory(i, i + 3, isNetty(), false);
createQueue(i, QUEUES_TESTADDRESS, QUEUE_NAME, null, true);
addConsumer(i, i, QUEUE_NAME, null);
}
waitForBindings(0, QUEUES_TESTADDRESS, 1, 1, true);
waitForBindings(1, QUEUES_TESTADDRESS, 1, 1, true);
waitForBindings(2, QUEUES_TESTADDRESS, 1, 1, true);
send(0, QUEUES_TESTADDRESS, 10, false, null);
verifyReceiveRoundRobinInSomeOrder(true, 10, 0, 1, 2);
final TopologyListener liveTopologyListener = new TopologyListener("LIVE-1");
locators[0].addClusterTopologyListener(liveTopologyListener);
assertTrue("we assume 3 is a backup", servers[3].getHAPolicy().isBackup());
assertFalse("no shared storage", servers[3].getHAPolicy().isSharedStore());
SharedNothingLiveActivation liveActivation = (SharedNothingLiveActivation) servers[0].getActivation();
liveActivation.freezeReplication();
assertFalse(servers[0].isReplicaSync());
waitForRemoteBackupSynchronization(servers[0]);
assertTrue(servers[0].isReplicaSync());
}
Aggregations