use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class ConnectionFactoryWithJGroupsSerializationTest method testCopyConfiguration.
@Test
public void testCopyConfiguration() throws Exception {
Assert.assertEquals(2, jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().size());
Configuration copiedconfig = jmsServer.getActiveMQServer().getConfiguration().copy();
Assert.assertEquals(2, copiedconfig.getDiscoveryGroupConfigurations().size());
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class AcceptorControlTest method testStartStop.
@Test
public void testStartStop() throws Exception {
TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<String, Object>(), RandomUtil.randomString());
Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig);
ActiveMQServer service = createServer(false, config);
service.setMBeanServer(mbeanServer);
service.start();
AcceptorControl acceptorControl = createManagementControl(acceptorConfig.getName());
// started by the server
Assert.assertTrue(acceptorControl.isStarted());
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
Assert.assertNotNull(session);
session.close();
acceptorControl.stop();
Assert.assertFalse(acceptorControl.isStarted());
try {
sf.createSession(false, true, true);
Assert.fail("acceptor must not accept connections when stopped accepting");
} catch (ActiveMQException e) {
}
acceptorControl.start();
Assert.assertTrue(acceptorControl.isStarted());
locator = createInVMNonHALocator();
sf = createSessionFactory(locator);
session = sf.createSession(false, true, true);
Assert.assertNotNull(session);
session.close();
acceptorControl.stop();
Assert.assertFalse(acceptorControl.isStarted());
try {
sf.createSession(false, true, true);
Assert.fail("acceptor must not accept connections when stopped accepting");
} catch (ActiveMQException e) {
}
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class JMSServerConfigParserTest method testParsing.
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@Test
public void testParsing() throws Exception {
Configuration config = createDefaultInVMConfig().addConnectorConfiguration("netty", new TransportConfiguration());
String conf = "activemq-jms-for-JMSServerDeployerTest.xml";
FileJMSConfiguration jmsconfig = new FileJMSConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(conf);
deploymentManager.addDeployable(jmsconfig);
deploymentManager.readConfiguration();
assertEquals(1, jmsconfig.getQueueConfigurations().size());
JMSQueueConfiguration queueConfig = jmsconfig.getQueueConfigurations().get(0);
assertEquals("fullConfigurationQueue", queueConfig.getName());
assertEquals(1, jmsconfig.getTopicConfigurations().size());
TopicConfiguration topicConfig = jmsconfig.getTopicConfigurations().get(0);
assertEquals("fullConfigurationTopic", topicConfig.getName());
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class BroadcastGroupControlTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
TransportConfiguration connectorConfiguration = new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
List<String> connectorInfos = new ArrayList<>();
connectorInfos.add(connectorConfiguration.getName());
broadcastGroupConfig = new BroadcastGroupConfiguration().setName(RandomUtil.randomString()).setBroadcastPeriod(RandomUtil.randomPositiveInt()).setConnectorInfos(connectorInfos).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(getUDPDiscoveryAddress()).setGroupPort(getUDPDiscoveryPort()).setLocalBindPort(1198));
Configuration config = createDefaultInVMConfig().setJMXManagementEnabled(true).addConnectorConfiguration(connectorConfiguration.getName(), connectorConfiguration).addBroadcastGroupConfiguration(broadcastGroupConfig);
server = addServer(ActiveMQServers.newActiveMQServer(config, mbeanServer, false));
server.start();
broadcastGroupControl = createManagementControl(broadcastGroupConfig.getName());
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class RelativePathTest method testRelativePathOnDefaultConfig.
@Test
public void testRelativePathOnDefaultConfig() throws Exception {
Configuration configuration = createDefaultConfig(false);
ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<String, AddressSettings>());
server.start();
server.stop();
checkData(new File(configuration.getJournalDirectory()), ".amq");
checkData(new File(configuration.getBindingsDirectory()), ".bindings");
}
Aggregations