Search in sources :

Example 1 with LiveOnlyActivation

use of org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation 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();
    }
}
Also used : LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) 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) ScaleDownPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) LiveOnlyPolicy(org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy) Test(org.junit.Test)

Example 2 with LiveOnlyActivation

use of org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation 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();
    }
}
Also used : LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) 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) ScaleDownPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) LiveOnlyPolicy(org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy)

Example 3 with LiveOnlyActivation

use of org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation 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();
    }
}
Also used : LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) 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) ScaleDownPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) LiveOnlyPolicy(org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy) Test(org.junit.Test)

Aggregations

Configuration (org.apache.activemq.artemis.core.config.Configuration)3 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)3 StoreConfiguration (org.apache.activemq.artemis.core.config.StoreConfiguration)3 HAPolicy (org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy)3 LiveOnlyPolicy (org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy)3 ScaleDownPolicy (org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy)3 Activation (org.apache.activemq.artemis.core.server.impl.Activation)3 ActiveMQServerImpl (org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl)3 ColocatedActivation (org.apache.activemq.artemis.core.server.impl.ColocatedActivation)3 LiveOnlyActivation (org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation)3 SharedNothingBackupActivation (org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation)3 SharedNothingLiveActivation (org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation)3 SharedStoreBackupActivation (org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation)3 SharedStoreLiveActivation (org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation)3 Test (org.junit.Test)2