Search in sources :

Example 11 with JMSConfigurationImpl

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

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 12 with JMSConfigurationImpl

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));
}
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 13 with JMSConfigurationImpl

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

Example 14 with JMSConfigurationImpl

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

the class ConnectionHangOnStartupTest method createMaster.

protected void createMaster() throws Exception {
    Configuration config = createConfig("localhost", 0, 62001);
    master = new EmbeddedJMS().setConfiguration(config).setJmsConfiguration(new JMSConfigurationImpl());
    master.start();
}
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 15 with JMSConfigurationImpl

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

the class FailoverClusterTest method setUp.

@Before
public void setUp() throws Exception {
    Map<String, String> params = new HashMap<>();
    params.put("rebalanceClusterClients", "true");
    params.put("updateClusterClients", "true");
    Configuration config1 = createConfig("localhost", 1, params);
    Configuration config2 = createConfig("localhost", 2, params);
    deployClusterConfiguration(config1, 2);
    deployClusterConfiguration(config2, 1);
    server1 = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
    server2 = new EmbeddedJMS().setConfiguration(config2).setJmsConfiguration(new JMSConfigurationImpl());
    clientUrl = "failover://(" + newURI(1) + "," + newURI(2) + ")";
}
Also used : EmbeddedJMS(org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS) Configuration(org.apache.activemq.artemis.core.config.Configuration) HashMap(java.util.HashMap) 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)33 Configuration (org.apache.activemq.artemis.core.config.Configuration)29 EmbeddedJMS (org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS)26 Before (org.junit.Before)10 Test (org.junit.Test)8 OpenwireArtemisBaseTest (org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest)7 JMSConfiguration (org.apache.activemq.artemis.jms.server.config.JMSConfiguration)6 HashMap (java.util.HashMap)5 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)4 MessageProducer (javax.jms.MessageProducer)3 Queue (javax.jms.Queue)3 Session (javax.jms.Session)3 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)3 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)3 ConnectionFactoryConfiguration (org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration)3 JMSQueueConfigurationImpl (org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl)3 JMSServerManagerImpl (org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl)3 InVMNamingContext (org.apache.activemq.artemis.tests.unit.util.InVMNamingContext)3 URI (java.net.URI)2 Connection (javax.jms.Connection)2