Search in sources :

Example 1 with SameProcessActiveMQServer

use of org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer in project activemq-artemis by apache.

the class SingleLiveMultipleBackupsFailoverTest method createBackupConfig.

protected void createBackupConfig(int liveNode, int nodeid, int... nodes) throws Exception {
    TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty()));
    Configuration config1 = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(nodeid, isNetty()))).setHAPolicyConfiguration(sharedStore ? new SharedStoreSlavePolicyConfiguration() : new ReplicatedPolicyConfiguration()).addConnectorConfiguration(backupConnector.getName(), backupConnector).setBindingsDirectory(getBindingsDir() + "_" + liveNode).setJournalDirectory(getJournalDir() + "_" + liveNode).setPagingDirectory(getPageDir() + "_" + liveNode).setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode);
    String[] staticConnectors = new String[nodes.length];
    for (int i = 0; i < nodes.length; i++) {
        TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(nodes[i], isNetty()));
        config1.addConnectorConfiguration(liveConnector.getName(), liveConnector);
        staticConnectors[i] = liveConnector.getName();
    }
    config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), staticConnectors));
    servers.put(nodeid, new SameProcessActiveMQServer(createInVMFailoverServer(true, config1, nodeManager, nodeid)));
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 2 with SameProcessActiveMQServer

use of org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer in project activemq-artemis by apache.

the class ClusterWithBackupFailoverTestBase method failNode.

/**
 * @param node             The node which we should fail
 * @param originalLiveNode The number of the original node, to locate session to fail
 * @throws Exception
 */
protected void failNode(final int node, final int originalLiveNode) throws Exception {
    ClusterWithBackupFailoverTestBase.log.info("*** failing node " + node);
    ActiveMQServer server = getServer(node);
    TestableServer tstServer = new SameProcessActiveMQServer(server);
    ClientSession[] sessionsArray = exploreSessions(originalLiveNode);
    tstServer.crash(sessionsArray);
}
Also used : SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) TestableServer(org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer)

Example 3 with SameProcessActiveMQServer

use of org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer in project activemq-artemis by apache.

the class MultipleLivesMultipleBackupsFailoverTest method createLiveConfig.

protected void createLiveConfig(NodeManager nodeManager, int liveNode, int... otherLiveNodes) throws Exception {
    TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(liveNode, isNetty()));
    Configuration config0 = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(liveNode, isNetty()))).setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()).setBindingsDirectory(getBindingsDir() + "_" + liveNode).setJournalDirectory(getJournalDir() + "_" + liveNode).setPagingDirectory(getPageDir() + "_" + liveNode).setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode).addConnectorConfiguration(liveConnector.getName(), liveConnector);
    String[] pairs = new String[otherLiveNodes.length];
    for (int i = 0; i < otherLiveNodes.length; i++) {
        TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(otherLiveNodes[i], isNetty()));
        config0.addConnectorConfiguration(otherLiveConnector.getName(), otherLiveConnector);
        pairs[i] = otherLiveConnector.getName();
    }
    config0.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), pairs));
    servers.put(liveNode, new SameProcessActiveMQServer(createInVMFailoverServer(true, config0, nodeManager, liveNode)));
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 4 with SameProcessActiveMQServer

use of org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer in project activemq-artemis by apache.

the class MultipleLivesMultipleBackupsFailoverTest method createBackupConfig.

protected void createBackupConfig(NodeManager nodeManager, int liveNode, int nodeid, boolean createClusterConnections, int[] otherBackupNodes, int... otherClusterNodes) throws Exception {
    Configuration config1 = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(nodeid, isNetty()))).setHAPolicyConfiguration(sharedStore ? new SharedStoreSlavePolicyConfiguration() : new ReplicaPolicyConfiguration()).setBindingsDirectory(getBindingsDir() + "_" + liveNode).setJournalDirectory(getJournalDir() + "_" + liveNode).setPagingDirectory(getPageDir() + "_" + liveNode).setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode);
    for (int node : otherBackupNodes) {
        TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
        config1.addConnectorConfiguration(liveConnector.getName(), liveConnector);
    }
    TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty()));
    config1.addConnectorConfiguration(backupConnector.getName(), backupConnector);
    String[] clusterNodes = new String[otherClusterNodes.length];
    for (int i = 0; i < otherClusterNodes.length; i++) {
        TransportConfiguration connector = createTransportConfiguration(isNetty(), false, generateParams(otherClusterNodes[i], isNetty()));
        config1.addConnectorConfiguration(connector.getName(), connector);
        clusterNodes[i] = connector.getName();
    }
    config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), clusterNodes));
    servers.put(nodeid, new SameProcessActiveMQServer(createInVMFailoverServer(true, config1, nodeManager, liveNode)));
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)

Example 5 with SameProcessActiveMQServer

use of org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer in project activemq-artemis by apache.

the class NettyFailoverTest method createTestableServer.

@Override
protected TestableServer createTestableServer(Configuration config) throws Exception {
    final boolean isBackup = config.getHAPolicyConfiguration() instanceof ReplicaPolicyConfiguration || config.getHAPolicyConfiguration() instanceof SharedStoreSlavePolicyConfiguration;
    NodeManager nodeManager = this.nodeManager;
    // create a separate NodeManager for the backup
    if (isBackup && nodeManagerType == NodeManagerType.Jdbc) {
        nodeManager = createNodeManager();
    }
    return new SameProcessActiveMQServer(createInVMFailoverServer(true, config, nodeManager, isBackup ? 2 : 1));
}
Also used : InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) NodeManager(org.apache.activemq.artemis.core.server.NodeManager) JdbcNodeManager(org.apache.activemq.artemis.core.server.impl.jdbc.JdbcNodeManager) SameProcessActiveMQServer(org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)

Aggregations

SameProcessActiveMQServer (org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer)7 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)6 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)5 Configuration (org.apache.activemq.artemis.core.config.Configuration)5 ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)5 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)5 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)4 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)2 TestableServer (org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer)2 ArrayList (java.util.ArrayList)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)1 NodeManager (org.apache.activemq.artemis.core.server.NodeManager)1 InVMNodeManager (org.apache.activemq.artemis.core.server.impl.InVMNodeManager)1 JdbcNodeManager (org.apache.activemq.artemis.core.server.impl.jdbc.JdbcNodeManager)1 Before (org.junit.Before)1