use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverTransportBrokerTest method setUp.
@Before
public void setUp() throws Exception {
Configuration config0 = createConfig(0);
server = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
Configuration config1 = createConfig(1);
remoteServer = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
server.start();
remoteServer.start();
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class InitalReconnectDelayTest method setUp.
@Before
public void setUp() throws Exception {
Configuration config1 = createConfig(1);
Configuration config2 = createConfig(2);
deployClusterConfiguration(config1, 2);
deployClusterConfiguration(config2, 1);
server1 = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
server2 = new EmbeddedJMS().setConfiguration(config2).setJmsConfiguration(new JMSConfigurationImpl());
server1.start();
server2.start();
Assert.assertTrue(server1.waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
Assert.assertTrue(server2.waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverComplexClusterTest method commonSetup.
// default setup for most tests
private void commonSetup() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("rebalanceClusterClients", "true");
params.put("updateClusterClients", "true");
params.put("updateClusterClientsOnRemove", "true");
Configuration config0 = createConfig("localhost", 0, params);
Configuration config1 = createConfig("localhost", 1, params);
Configuration config2 = createConfig("localhost", 2, params);
deployClusterConfiguration(config0, 1, 2);
deployClusterConfiguration(config1, 0, 2);
deployClusterConfiguration(config2, 0, 1);
servers[0] = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
servers[1] = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
servers[2] = new EmbeddedJMS().setConfiguration(config2).setJmsConfiguration(new JMSConfigurationImpl());
servers[0].start();
servers[1].start();
servers[2].start();
Assert.assertTrue(servers[0].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 3));
Assert.assertTrue(servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 3));
Assert.assertTrue(servers[2].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 3));
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverComplexClusterTest method testFailOverWithUpdateClientsOnRemove.
@Test
public void testFailOverWithUpdateClientsOnRemove() throws Exception {
// Broker A
Configuration config0 = createConfig(0, "?rebalanceClusterClients=true&updateClusterClients=true&updateClusterClientsOnRemove=true");
// Broker B
Configuration config1 = createConfig(1, "?rebalanceClusterClients=true&updateClusterClients=true&updateClusterClientsOnRemove=true");
deployClusterConfiguration(config0, 1);
deployClusterConfiguration(config1, 0);
servers[0] = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
servers[0].start();
servers[1] = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
servers[1].start();
servers[0].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2);
servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2);
Thread.sleep(1000);
// create client connecting only to A. It should receive broker B address whet it connects to A.
setClientUrl("failover:(" + BROKER_A_CLIENT_TC_ADDRESS + ")?useExponentialBackOff=true");
createClients(1);
Thread.sleep(5000);
// We stop broker A.
servers[0].stop();
servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 1);
Thread.sleep(5000);
// Client should failover to B.
assertAllConnectedTo(BROKER_B_CLIENT_TC_ADDRESS);
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverPriorityTest method restart.
private void restart(boolean primary, int primaryID, int secondaryID, int total) throws Exception {
Thread.sleep(1000);
if (primary) {
LOG.info("Stopping " + primaryID);
stopBroker(primaryID);
Assert.assertTrue(servers[secondaryID].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, total - 1));
} else {
LOG.info("Stopping " + secondaryID);
stopBroker(secondaryID);
Assert.assertTrue(servers[primaryID].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, total - 1));
}
Thread.sleep(5000);
if (primary) {
assertAllConnectedTo(urls.get(secondaryID));
} else {
assertAllConnectedTo(urls.get(primaryID));
}
if (primary) {
Configuration config = createConfig("127.0.0.1", primaryID);
deployClusterConfiguration(config, secondaryID);
servers[primaryID] = new EmbeddedJMS().setConfiguration(config).setJmsConfiguration(new JMSConfigurationImpl());
servers[primaryID].start();
Assert.assertTrue(servers[primaryID].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, total));
Assert.assertTrue(servers[secondaryID].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, total));
} else {
Configuration config = createConfig("127.0.0.1", secondaryID);
deployClusterConfiguration(config, primaryID);
servers[secondaryID] = new EmbeddedJMS().setConfiguration(config).setJmsConfiguration(new JMSConfigurationImpl());
servers[secondaryID].start();
Assert.assertTrue(servers[primaryID].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, total));
Assert.assertTrue(servers[secondaryID].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, total));
}
Thread.sleep(5000);
assertAllConnectedTo(urls.get(primaryID));
}
Aggregations