Search in sources :

Example 6 with JMSConfigurationImpl

use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by rh-messaging.

the class FailoverPriorityTest method testPriorityBackup.

@Test
public void testPriorityBackup() throws Exception {
    Configuration config0 = createConfig("127.0.0.1", 0);
    Configuration config1 = createConfig("127.0.0.1", 1);
    deployClusterConfiguration(config0, 1);
    deployClusterConfiguration(config1, 0);
    servers[0] = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
    servers[1] = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
    servers[0].start();
    servers[1].start();
    Assert.assertTrue(servers[0].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
    Assert.assertTrue(servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
    Thread.sleep(1000);
    setClientUrl("failover:(" + BROKER_A_CLIENT_TC_ADDRESS + "," + BROKER_B_CLIENT_TC_ADDRESS + ")?randomize=false&priorityBackup=true&initialReconnectDelay=1000&useExponentialBackOff=false");
    createClients(5);
    assertAllConnectedTo(urls.get(0));
    restart(false, 0, 1);
    for (int i = 0; i < 3; i++) {
        restart(true, 0, 1);
    }
    Thread.sleep(5000);
    restart(false, 0, 1);
}
Also used : EmbeddedJMS(org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS) Configuration(org.apache.activemq.artemis.core.config.Configuration) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl) Test(org.junit.Test) OpenwireArtemisBaseTest(org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest)

Example 7 with JMSConfigurationImpl

use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by rh-messaging.

the class FailoverPriorityTest method testPriorityBackupAndUpdateClients.

@Test
public void testPriorityBackupAndUpdateClients() throws Exception {
    Configuration config0 = createConfig("127.0.0.1", 0);
    Configuration config1 = createConfig("127.0.0.1", 1);
    deployClusterConfiguration(config0, 1);
    deployClusterConfiguration(config1, 0);
    servers[0] = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
    servers[1] = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
    servers[0].start();
    servers[1].start();
    Assert.assertTrue(servers[0].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
    Assert.assertTrue(servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
    Thread.sleep(1000);
    setClientUrl("failover:(" + BROKER_A_CLIENT_TC_ADDRESS + "," + BROKER_B_CLIENT_TC_ADDRESS + ")?randomize=false&priorityBackup=true&initialReconnectDelay=1000&useExponentialBackOff=false");
    createClients(5);
    // Let's wait a little bit longer just in case it takes a while to realize that the
    // Broker A is the one with higher priority.
    Thread.sleep(5000);
    assertAllConnectedTo(urls.get(0));
}
Also used : EmbeddedJMS(org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS) Configuration(org.apache.activemq.artemis.core.config.Configuration) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl) Test(org.junit.Test) OpenwireArtemisBaseTest(org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest)

Example 8 with JMSConfigurationImpl

use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by rh-messaging.

the class FailoverPriorityTest method setupThreeBrokers.

private void setupThreeBrokers() throws Exception {
    params.put("rebalanceClusterClients", "false");
    params.put("updateClusterClients", "false");
    params.put("updateClusterClientsOnRemove", "false");
    Configuration config0 = createConfig("127.0.0.1", 0, params);
    Configuration config1 = createConfig("127.0.0.1", 1, params);
    Configuration config2 = createConfig("127.0.0.1", 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));
}
Also used : EmbeddedJMS(org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS) Configuration(org.apache.activemq.artemis.core.config.Configuration) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl)

Example 9 with JMSConfigurationImpl

use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by rh-messaging.

the class AMQ1925Test method createNewServer.

private EmbeddedJMS createNewServer() throws Exception {
    Configuration config = createConfig("localhost", 0);
    EmbeddedJMS server = new EmbeddedJMS().setConfiguration(config).setJmsConfiguration(new JMSConfigurationImpl());
    return server;
}
Also used : EmbeddedJMS(org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS) Configuration(org.apache.activemq.artemis.core.config.Configuration) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl)

Example 10 with JMSConfigurationImpl

use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by rh-messaging.

the class FailoverBackupLeakTest method setUp.

@Before
public void setUp() throws Exception {
    Configuration config0 = createConfig("127.0.0.1", 0);
    Configuration config1 = createConfig("127.0.0.1", 1);
    deployClusterConfiguration(config0, 1);
    deployClusterConfiguration(config1, 0);
    s1 = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
    s2 = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
    s1.start();
    s2.start();
    Assert.assertTrue(s1.waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
    Assert.assertTrue(s2.waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
}
Also used : EmbeddedJMS(org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS) Configuration(org.apache.activemq.artemis.core.config.Configuration) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl) Before(org.junit.Before)

Aggregations

JMSConfigurationImpl (org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl)62 Configuration (org.apache.activemq.artemis.core.config.Configuration)57 EmbeddedJMS (org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS)52 Before (org.junit.Before)19 Test (org.junit.Test)16 OpenwireArtemisBaseTest (org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest)14 HashMap (java.util.HashMap)10 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)8 JMSConfiguration (org.apache.activemq.artemis.jms.server.config.JMSConfiguration)8 MessageProducer (javax.jms.MessageProducer)6 Queue (javax.jms.Queue)6 Session (javax.jms.Session)6 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)6 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)6 JMSServerManagerImpl (org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl)6 InVMNamingContext (org.apache.activemq.artemis.tests.unit.util.InVMNamingContext)6 ConnectionFactoryConfiguration (org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration)5 JMSQueueConfigurationImpl (org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl)5 URI (java.net.URI)4 Connection (javax.jms.Connection)4