use of org.apache.activemq.artemis.core.server.impl.Activation in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method colocatedTestNullBackup.
@Test
public void colocatedTestNullBackup() throws Exception {
Configuration configuration = createConfiguration("colocated-hapolicy-config-null-backup.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof ColocatedActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof ColocatedPolicy);
ColocatedPolicy colocatedPolicy = (ColocatedPolicy) haPolicy;
ReplicatedPolicy livePolicy = (ReplicatedPolicy) colocatedPolicy.getLivePolicy();
assertNotNull(livePolicy);
assertEquals(livePolicy.getGroupName(), "purple");
assertTrue(livePolicy.isCheckForLiveServer());
assertEquals(livePolicy.getClusterName(), "abcdefg");
ReplicaPolicy backupPolicy = (ReplicaPolicy) colocatedPolicy.getBackupPolicy();
assertNotNull(backupPolicy);
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.impl.Activation in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method ReplicaTest3.
@Test
public void ReplicaTest3() throws Exception {
Configuration configuration = createConfiguration("replica-hapolicy-config3.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();
assertNull(scaleDownPolicy);
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.impl.Activation in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method colocatedTest2nullbackup.
@Test
public void colocatedTest2nullbackup() throws Exception {
Configuration configuration = createConfiguration("colocated-hapolicy-config2-null-backup.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof ColocatedActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof ColocatedPolicy);
ColocatedPolicy colocatedPolicy = (ColocatedPolicy) haPolicy;
SharedStoreMasterPolicy livePolicy = (SharedStoreMasterPolicy) colocatedPolicy.getLivePolicy();
assertNotNull(livePolicy);
assertFalse(livePolicy.isFailoverOnServerShutdown());
SharedStoreSlavePolicy backupPolicy = (SharedStoreSlavePolicy) colocatedPolicy.getBackupPolicy();
assertNotNull(backupPolicy);
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.impl.Activation in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method colocatedTest2.
@Test
public void colocatedTest2() throws Exception {
Configuration configuration = createConfiguration("colocated-hapolicy-config2.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof ColocatedActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof ColocatedPolicy);
ColocatedPolicy colocatedPolicy = (ColocatedPolicy) haPolicy;
SharedStoreMasterPolicy livePolicy = (SharedStoreMasterPolicy) colocatedPolicy.getLivePolicy();
assertNotNull(livePolicy);
assertFalse(livePolicy.isFailoverOnServerShutdown());
SharedStoreSlavePolicy backupPolicy = (SharedStoreSlavePolicy) colocatedPolicy.getBackupPolicy();
assertNotNull(backupPolicy);
assertFalse(backupPolicy.isFailoverOnServerShutdown());
assertFalse(backupPolicy.isRestartBackup());
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.impl.Activation in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method liveOnlyTest.
@Test
public void liveOnlyTest() throws Exception {
Configuration configuration = createConfiguration("live-only-hapolicy-config.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);
assertEquals(scaleDownPolicy.getGroupName(), "boo!");
assertEquals(scaleDownPolicy.getDiscoveryGroup(), "wahey");
List<String> connectors = scaleDownPolicy.getConnectors();
assertNotNull(connectors);
assertEquals(connectors.size(), 0);
} finally {
server.stop();
}
}
Aggregations