use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class SimpleSendReceiveSoakTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
clearDataRecreateServerDirs();
Configuration config = createDefaultConfig(isNetty()).setJournalFileSize(10 * 1024 * 1024);
server = createServer(IS_JOURNAL, config, -1, -1, new HashMap<String, AddressSettings>());
server.start();
ServerLocator locator = createFactory(isNetty());
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession();
session.createQueue(SimpleSendReceiveSoakTest.ADDRESS, SimpleSendReceiveSoakTest.ADDRESS, true);
session.close();
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class ClientSoakTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
clearDataRecreateServerDirs();
Configuration config = createDefaultConfig(isNetty()).setJournalFileSize(10 * 1024 * 1024);
server = createServer(IS_JOURNAL, config, -1, -1, new HashMap<String, AddressSettings>());
DivertConfiguration divert1 = new DivertConfiguration().setName("dv1").setRoutingName("nm1").setAddress(ClientSoakTest.ADDRESS.toString()).setForwardingAddress(ClientSoakTest.DIVERTED_AD1.toString()).setExclusive(true);
DivertConfiguration divert2 = new DivertConfiguration().setName("dv2").setRoutingName("nm2").setAddress(ClientSoakTest.ADDRESS.toString()).setForwardingAddress(ClientSoakTest.DIVERTED_AD2.toString()).setExclusive(true);
ArrayList<DivertConfiguration> divertList = new ArrayList<>();
divertList.add(divert1);
divertList.add(divert2);
config.setDivertConfigurations(divertList);
server.start();
ServerLocator locator = createFactory(isNetty());
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession();
session.createQueue(ClientSoakTest.ADDRESS, ClientSoakTest.ADDRESS, true);
session.createQueue(ClientSoakTest.DIVERTED_AD1, ClientSoakTest.DIVERTED_AD1, true);
session.createQueue(ClientSoakTest.DIVERTED_AD2, ClientSoakTest.DIVERTED_AD2, true);
session.close();
sf.close();
locator.close();
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class SpawnedJMSServer method startServer.
public static ActiveMQServer startServer() throws Exception {
if (server == null) {
Configuration config = new ConfigurationImpl().addAcceptorConfiguration("netty", "tcp://localhost:61616").setSecurityEnabled(false).addConnectorConfiguration("netty", "tcp://localhost:61616");
File dataPlace = new File("./target/dataJoram");
FileUtil.deleteDirectory(dataPlace);
config.setJournalDirectory(new File(dataPlace, "./journal").getAbsolutePath()).setPagingDirectory(new File(dataPlace, "./paging").getAbsolutePath()).setLargeMessagesDirectory(new File(dataPlace, "./largemessages").getAbsolutePath()).setBindingsDirectory(new File(dataPlace, "./bindings").getAbsolutePath()).setPersistenceEnabled(true);
// disable server persistence since JORAM tests do not restart server
server = ActiveMQServers.newActiveMQServer(config, useFiles);
// set DLA and expiry to avoid spamming the log with warnings
server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry")));
serverManager = new JMSServerManagerImpl(server);
serverManager.start();
}
return server;
}
use of org.apache.activemq.artemis.core.config.Configuration 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.core.config.Configuration 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);
}
Aggregations