use of org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy 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.cluster.ha.SharedStoreMasterPolicy 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.cluster.ha.SharedStoreMasterPolicy in project activemq-artemis by apache.
the class FailoverTest method testLiveAndBackupBackupComesBackNewFactory.
@Test(timeout = 120000)
public void testLiveAndBackupBackupComesBackNewFactory() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true).setReconnectAttempts(300).setRetryInterval(100);
sf = createSessionFactoryAndWaitForTopology(locator, 2);
ClientSession session = sendAndConsume(sf, true);
CountDownSessionFailureListener listener = new CountDownSessionFailureListener(session);
session.addFailureListener(listener);
backupServer.stop();
liveServer.crash();
// To reload security or other settings that are read during startup
beforeRestart(backupServer);
if (!backupServer.getServer().getHAPolicy().isSharedStore()) {
// XXX
// this test would not make sense in the remote replication use case, without the following
backupServer.getServer().setHAPolicy(new SharedStoreMasterPolicy());
}
backupServer.start();
Assert.assertTrue("session failure listener", listener.getLatch().await(5, TimeUnit.SECONDS));
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
ClientMessage message = session.createMessage(true);
setBody(0, message);
producer.send(message);
session.close();
sf.close();
createClientSessionFactory();
session = createSession(sf);
ClientConsumer cc = session.createConsumer(FailoverTestBase.ADDRESS);
session.start();
ClientMessage cm = cc.receive(5000);
Assert.assertNotNull(cm);
Assert.assertEquals("message0", cm.getBodyBuffer().readString());
}
use of org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy 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();
}
}
Aggregations