use of org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl 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();
}
}
use of org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method colocatedTest.
@Test
public void colocatedTest() throws Exception {
Configuration configuration = createConfiguration("colocated-hapolicy-config.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);
assertEquals(backupPolicy.getGroupName(), "tiddles");
assertEquals(backupPolicy.getMaxSavedReplicatedJournalsSize(), 22);
assertEquals(backupPolicy.getClusterName(), "33rrrrr");
assertFalse(backupPolicy.isRestartBackup());
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method ReplicaTest.
@Test
public void ReplicaTest() throws Exception {
Configuration configuration = createConfiguration("replica-hapolicy-config.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());
assertTrue(replicaPolicy.isAllowFailback());
assertEquals(replicaPolicy.getInitialReplicationSyncTimeout(), 9876);
ScaleDownPolicy scaleDownPolicy = replicaPolicy.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();
}
}
use of org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method SharedStoreSlaveTest3.
@Test
public void SharedStoreSlaveTest3() throws Exception {
Configuration configuration = createConfiguration("shared-store-slave-hapolicy-config3.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof SharedStoreBackupActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof SharedStoreSlavePolicy);
SharedStoreSlavePolicy sharedStoreSlavePolicy = (SharedStoreSlavePolicy) haPolicy;
assertTrue(sharedStoreSlavePolicy.isFailoverOnServerShutdown());
assertTrue(sharedStoreSlavePolicy.isRestartBackup());
ScaleDownPolicy scaleDownPolicy = sharedStoreSlavePolicy.getScaleDownPolicy();
assertNull(scaleDownPolicy);
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method SharedStoreSlaveTest2.
@Test
public void SharedStoreSlaveTest2() throws Exception {
Configuration configuration = createConfiguration("shared-store-slave-hapolicy-config2.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof SharedStoreBackupActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof SharedStoreSlavePolicy);
SharedStoreSlavePolicy sharedStoreSlavePolicy = (SharedStoreSlavePolicy) haPolicy;
assertTrue(sharedStoreSlavePolicy.isFailoverOnServerShutdown());
assertTrue(sharedStoreSlavePolicy.isRestartBackup());
ScaleDownPolicy scaleDownPolicy = sharedStoreSlavePolicy.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