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)));
}
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);
}
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)));
}
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)));
}
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));
}
Aggregations