use of org.apache.activemq.artemis.core.config.impl.FileConfiguration in project activemq-artemis by apache.
the class ArtemisTest method testPing.
@Test
public void testPing() throws Exception {
File instanceFolder = temporaryFolder.newFolder("pingTest");
setupAuth(instanceFolder);
String queues = "q1,t2";
String topics = "t1,t2";
// This is usually set when run from the command line via artemis.profile
Run.setEmbedded(true);
Artemis.main("create", instanceFolder.getAbsolutePath(), "--force", "--silent", "--no-web", "--queues", queues, "--addresses", topics, "--no-autotune", "--require-login", "--ping", "127.0.0.1", "--no-autotune");
System.setProperty("artemis.instance", instanceFolder.getAbsolutePath());
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(new File(instanceFolder, "./etc/broker.xml").toURI().toString());
deploymentManager.addDeployable(fc);
deploymentManager.readConfiguration();
Assert.assertEquals("127.0.0.1", fc.getNetworkCheckList());
}
use of org.apache.activemq.artemis.core.config.impl.FileConfiguration in project activemq-artemis by apache.
the class ConfigurationValidationTest method testChangeConfiguration.
@Test
public void testChangeConfiguration() throws Exception {
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager("ConfigurationTest-full-config.xml");
deploymentManager.addDeployable(fc);
deploymentManager.readConfiguration();
deploymentManager = new FileDeploymentManager("ConfigurationTest-full-config-wrong-address.xml");
deploymentManager.addDeployable(fc);
try {
deploymentManager.readConfiguration();
fail("Exception expected");
} catch (Exception ignored) {
}
}
use of org.apache.activemq.artemis.core.config.impl.FileConfiguration in project activemq-artemis by apache.
the class LocalTestServer method start.
@Override
public synchronized void start(final HashMap<String, Object> configuration, final boolean clearJournal) throws Exception {
if (isStarted()) {
return;
}
if (clearJournal) {
// Delete the Journal environment
File dir = new File("target/data");
boolean deleted = LocalTestServer.deleteDirectory(dir);
JmsTestLogger.LOGGER.info("Deleted dir: " + dir.getAbsolutePath() + " deleted: " + deleted);
}
javax.management.MBeanServer beanServer = java.lang.management.ManagementFactory.getPlatformMBeanServer();
FileConfiguration fileConfiguration = new FileConfiguration();
ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest");
securityManager.getConfiguration().addRole("guest", "guest");
ActiveMQServerImpl activeMQServer = new ActiveMQServerImpl(fileConfiguration, beanServer, securityManager);
jmsServerManager = new JMSServerManagerImpl(activeMQServer);
System.setProperty(Constants.SERVER_INDEX_PROPERTY_NAME, "" + getServerID());
jmsServerManager.setRegistry(new JndiBindingRegistry(getInitialContext()));
FileDeploymentManager deploymentManager = new FileDeploymentManager();
deploymentManager.addDeployable(fileConfiguration).readConfiguration();
jmsServerManager.start();
started = true;
}
use of org.apache.activemq.artemis.core.config.impl.FileConfiguration in project activemq-artemis by apache.
the class EmbeddedActiveMQ method initStart.
protected void initStart() throws Exception {
if (configuration == null) {
if (configResourcePath == null)
configResourcePath = "broker.xml";
FileDeploymentManager deploymentManager = new FileDeploymentManager(configResourcePath);
FileConfiguration config = new FileConfiguration();
deploymentManager.addDeployable(config);
deploymentManager.readConfiguration();
configuration = config;
}
if (securityManager == null) {
securityManager = new ActiveMQJAASSecurityManager();
}
if (mbeanServer == null) {
activeMQServer = new ActiveMQServerImpl(configuration, securityManager);
} else {
activeMQServer = new ActiveMQServerImpl(configuration, mbeanServer, securityManager);
}
}
Aggregations