use of org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy in project activemq-artemis by apache.
the class FailoverTest method testFailBack.
/**
* Basic fail-back test.
*
* @throws Exception
*/
@Test(timeout = 120000)
public void testFailBack() throws Exception {
boolean doFailBack = true;
HAPolicy haPolicy = backupServer.getServer().getHAPolicy();
if (haPolicy instanceof ReplicaPolicy) {
((ReplicaPolicy) haPolicy).setMaxSavedReplicatedJournalsSize(1);
}
simpleFailover(haPolicy instanceof ReplicaPolicy, doFailBack);
}
use of org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method ReplicaTest2.
@Test
public void ReplicaTest2() throws Exception {
Configuration configuration = createConfiguration("replica-hapolicy-config2.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof SharedNothingBackupActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof ReplicaPolicy);
ReplicaPolicy replicaPolicy = (ReplicaPolicy) haPolicy;
assertEquals(replicaPolicy.getGroupName(), "tiddles");
assertEquals(replicaPolicy.getMaxSavedReplicatedJournalsSize(), 22);
assertEquals(replicaPolicy.getClusterName(), "33rrrrr");
assertFalse(replicaPolicy.isRestartBackup());
ScaleDownPolicy scaleDownPolicy = replicaPolicy.getScaleDownPolicy();
assertNotNull(scaleDownPolicy);
assertEquals(scaleDownPolicy.getGroupName(), "boo!");
assertEquals(scaleDownPolicy.getDiscoveryGroup(), null);
List<String> connectors = scaleDownPolicy.getConnectors();
assertNotNull(connectors);
assertEquals(connectors.size(), 2);
assertTrue(connectors.contains("sd-connector1"));
assertTrue(connectors.contains("sd-connector2"));
} finally {
server.stop();
}
}
Aggregations