use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method SharedStoreSlaveTest2.
@Test
public void SharedStoreSlaveTest2() throws Exception {
Configuration configuration = createConfiguration("shared-store-slave-hapolicy-config2.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
try {
server.start();
Activation activation = server.getActivation();
assertTrue(activation instanceof SharedStoreBackupActivation);
HAPolicy haPolicy = server.getHAPolicy();
assertTrue(haPolicy instanceof SharedStoreSlavePolicy);
SharedStoreSlavePolicy sharedStoreSlavePolicy = (SharedStoreSlavePolicy) haPolicy;
assertTrue(sharedStoreSlavePolicy.isFailoverOnServerShutdown());
assertTrue(sharedStoreSlavePolicy.isRestartBackup());
ScaleDownPolicy scaleDownPolicy = sharedStoreSlavePolicy.getScaleDownPolicy();
assertNotNull(scaleDownPolicy);
assertEquals(scaleDownPolicy.getGroupName(), "boo!");
assertEquals(scaleDownPolicy.getDiscoveryGroup(), null);
List<String> connectors = scaleDownPolicy.getConnectors();
assertNotNull(connectors);
assertEquals(connectors.size(), 2);
assertTrue(connectors.contains("sd-connector1"));
assertTrue(connectors.contains("sd-connector2"));
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method shouldNotUseJdbcNodeManagerWithoutHAPolicy.
@Test
public void shouldNotUseJdbcNodeManagerWithoutHAPolicy() throws Exception {
Configuration configuration = createConfiguration("database-store-no-hapolicy-config.xml");
ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
assertEquals(StoreConfiguration.StoreType.DATABASE, server.getConfiguration().getStoreConfiguration().getStoreType());
assertEquals(HAPolicyConfiguration.TYPE.LIVE_ONLY, server.getConfiguration().getHAPolicyConfiguration().getType());
try {
server.start();
assertThat(server.getNodeManager(), instanceOf(InVMNodeManager.class));
} finally {
server.stop();
}
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class SecurityManagementWithModifiedConfigurationTest method setupAndStartActiveMQServer.
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@Override
protected ActiveMQServer setupAndStartActiveMQServer() throws Exception {
Configuration conf = createDefaultInVMConfig().setSecurityEnabled(true).setClusterPassword(configuredClusterPassword);
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(conf, false));
server.start();
return server;
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class MQTTSecurityCRLTest method initServer.
private ActiveMQServer initServer() throws Exception {
Configuration configuration = createDefaultNettyConfig().setSecurityEnabled(false);
addMqttTransportConfiguration(configuration);
addWildCardConfiguration(configuration);
ActiveMQServer server = createServer(true, configuration);
return server;
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class MQTTTest method testDoubleBroker.
@Test
public void testDoubleBroker() throws Exception {
/*
* Start two embedded server instances for MQTT and connect to them
* with the same MQTT client id. As those are two different instances
* connecting to them with the same client ID must succeed.
*/
final int port1 = 1884;
final int port2 = 1885;
final Configuration cfg1 = createDefaultConfig(1, false);
cfg1.addAcceptorConfiguration("mqtt1", "tcp://localhost:" + port1 + "?protocols=MQTT");
final Configuration cfg2 = createDefaultConfig(2, false);
cfg2.addAcceptorConfiguration("mqtt2", "tcp://localhost:" + port2 + "?protocols=MQTT");
final ActiveMQServer server1 = createServer(cfg1);
server1.start();
final ActiveMQServer server2 = createServer(cfg2);
server2.start();
final String clientId = "client1";
final MQTT mqtt1 = createMQTTConnection(clientId, true);
final MQTT mqtt2 = createMQTTConnection(clientId, true);
mqtt1.setHost("localhost", port1);
mqtt2.setHost("localhost", port2);
final BlockingConnection connection1 = mqtt1.blockingConnection();
final BlockingConnection connection2 = mqtt2.blockingConnection();
try {
connection1.connect();
connection2.connect();
} catch (Exception e) {
fail("Connections should have worked.");
} finally {
if (connection1.isConnected())
connection1.disconnect();
if (connection2.isConnected())
connection2.disconnect();
}
}
Aggregations