use of org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method liveOnlyTest.
private void liveOnlyTest(String file) throws Exception {
Configuration configuration = createConfiguration(file);
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof LiveOnlyActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof LiveOnlyPolicy);
LiveOnlyPolicy liveOnlyPolicy = (LiveOnlyPolicy) haPolicy;
ScaleDownPolicy scaleDownPolicy = liveOnlyPolicy.getScaleDownPolicy();
assertNull(scaleDownPolicy);
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method SharedStoreMasterTest.
@Test
public void SharedStoreMasterTest() throws Exception {
Configuration configuration = createConfiguration("shared-store-master-hapolicy-config.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof SharedStoreLiveActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof SharedStoreMasterPolicy);
SharedStoreMasterPolicy masterPolicy = (SharedStoreMasterPolicy) haPolicy;
assertFalse(masterPolicy.isFailoverOnServerShutdown());
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy 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();
}
}
use of org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method liveOnlyTest2.
@Test
public void liveOnlyTest2() throws Exception {
Configuration configuration = createConfiguration("live-only-hapolicy-config2.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof LiveOnlyActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof LiveOnlyPolicy);
LiveOnlyPolicy liveOnlyPolicy = (LiveOnlyPolicy) haPolicy;
ScaleDownPolicy scaleDownPolicy = liveOnlyPolicy.getScaleDownPolicy();
assertNotNull(scaleDownPolicy);
assertFalse(scaleDownPolicy.isEnabled());
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();
}
}
use of org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method ReplicatedTest.
@Test
public void ReplicatedTest() throws Exception {
Configuration configuration = createConfiguration("replicated-hapolicy-config.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof SharedNothingLiveActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof ReplicatedPolicy);
ReplicatedPolicy replicatedPolicy = (ReplicatedPolicy) haPolicy;
assertEquals(replicatedPolicy.getGroupName(), "purple");
assertTrue(replicatedPolicy.isCheckForLiveServer());
assertEquals(replicatedPolicy.getClusterName(), "abcdefg");
assertEquals(replicatedPolicy.getInitialReplicationSyncTimeout(), 9876);
} finally {
server.stop();
}
}
Aggregations