use of org.apache.activemq.artemis.core.config.FileDeploymentManager in project activemq-artemis by apache.
the class HAPolicyConfigurationTest method createConfiguration.
protected Configuration createConfiguration(String fileName) throws Exception {
FileConfiguration fc = new FileConfiguration();
FileDeploymentManager deploymentManager = new FileDeploymentManager(fileName);
deploymentManager.addDeployable(fc);
deploymentManager.readConfiguration();
// we need this otherwise the data folder will be located under activemq-server and not on the temporary directory
fc.setPagingDirectory(getTestDir() + "/" + fc.getPagingDirectory());
fc.setLargeMessagesDirectory(getTestDir() + "/" + fc.getLargeMessagesDirectory());
fc.setJournalDirectory(getTestDir() + "/" + fc.getJournalDirectory());
fc.setBindingsDirectory(getTestDir() + "/" + fc.getBindingsDirectory());
return fc;
}
use of org.apache.activemq.artemis.core.config.FileDeploymentManager 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.FileDeploymentManager 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.FileDeploymentManager in project activemq-artemis by apache.
the class EmbeddedJMS method start.
@Override
public EmbeddedJMS start() throws Exception {
super.initStart();
if (jmsConfiguration != null) {
serverManager = new JMSServerManagerImpl(activeMQServer, jmsConfiguration);
} else {
FileJMSConfiguration fileConfiguration = new FileJMSConfiguration();
FileDeploymentManager deploymentManager;
if (configResourcePath != null) {
deploymentManager = new FileDeploymentManager(configResourcePath);
} else {
deploymentManager = new FileDeploymentManager();
}
deploymentManager.addDeployable(fileConfiguration);
deploymentManager.readConfiguration();
serverManager = new JMSServerManagerImpl(activeMQServer, fileConfiguration);
}
if (registry == null) {
if (context != null)
registry = new JndiBindingRegistry(context);
else
registry = new MapBindingRegistry();
}
serverManager.setRegistry(registry);
serverManager.start();
return this;
}
use of org.apache.activemq.artemis.core.config.FileDeploymentManager 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