Search in sources :

Example 1 with ColocatedActivation

use of org.apache.activemq.artemis.core.server.impl.ColocatedActivation 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();
    }
}
Also used : ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) Configuration(org.apache.activemq.artemis.core.config.Configuration) StoreConfiguration(org.apache.activemq.artemis.core.config.StoreConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) HAPolicy(org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy) ReplicaPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy) ReplicatedPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy) SharedNothingBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation) ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) Activation(org.apache.activemq.artemis.core.server.impl.Activation) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) SharedStoreLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation) SharedStoreBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation) LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) ColocatedPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy) Test(org.junit.Test)

Example 2 with ColocatedActivation

use of org.apache.activemq.artemis.core.server.impl.ColocatedActivation 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();
    }
}
Also used : ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) SharedStoreSlavePolicy(org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy) Configuration(org.apache.activemq.artemis.core.config.Configuration) StoreConfiguration(org.apache.activemq.artemis.core.config.StoreConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) HAPolicy(org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy) SharedNothingBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation) ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) Activation(org.apache.activemq.artemis.core.server.impl.Activation) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) SharedStoreLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation) SharedStoreBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation) LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) ColocatedPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy) SharedStoreMasterPolicy(org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy) Test(org.junit.Test)

Example 3 with ColocatedActivation

use of org.apache.activemq.artemis.core.server.impl.ColocatedActivation 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();
    }
}
Also used : ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) SharedStoreSlavePolicy(org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy) Configuration(org.apache.activemq.artemis.core.config.Configuration) StoreConfiguration(org.apache.activemq.artemis.core.config.StoreConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) HAPolicy(org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy) SharedNothingBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation) ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) Activation(org.apache.activemq.artemis.core.server.impl.Activation) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) SharedStoreLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation) SharedStoreBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation) LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) ColocatedPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy) SharedStoreMasterPolicy(org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy) Test(org.junit.Test)

Example 4 with ColocatedActivation

use of org.apache.activemq.artemis.core.server.impl.ColocatedActivation 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();
    }
}
Also used : ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) Configuration(org.apache.activemq.artemis.core.config.Configuration) StoreConfiguration(org.apache.activemq.artemis.core.config.StoreConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) HAPolicy(org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy) ReplicaPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy) ReplicatedPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy) SharedNothingBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation) ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) Activation(org.apache.activemq.artemis.core.server.impl.Activation) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) SharedStoreLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation) SharedStoreBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation) LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) ColocatedPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy) Test(org.junit.Test)

Aggregations

Configuration (org.apache.activemq.artemis.core.config.Configuration)4 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)4 StoreConfiguration (org.apache.activemq.artemis.core.config.StoreConfiguration)4 ColocatedPolicy (org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy)4 HAPolicy (org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy)4 Activation (org.apache.activemq.artemis.core.server.impl.Activation)4 ActiveMQServerImpl (org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl)4 ColocatedActivation (org.apache.activemq.artemis.core.server.impl.ColocatedActivation)4 LiveOnlyActivation (org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation)4 SharedNothingBackupActivation (org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation)4 SharedNothingLiveActivation (org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation)4 SharedStoreBackupActivation (org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation)4 SharedStoreLiveActivation (org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation)4 Test (org.junit.Test)4 ReplicaPolicy (org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy)2 ReplicatedPolicy (org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy)2 SharedStoreMasterPolicy (org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy)2 SharedStoreSlavePolicy (org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy)2