Search in sources :

Example 21 with FileDeploymentManager

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;
}
Also used : FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager)

Example 22 with FileDeploymentManager

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) {
    }
}
Also used : FileConfiguration(org.apache.activemq.artemis.core.config.impl.FileConfiguration) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) Test(org.junit.Test)

Example 23 with FileDeploymentManager

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;
}
Also used : FileConfiguration(org.apache.activemq.artemis.core.config.impl.FileConfiguration) JMSServerManagerImpl(org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl) ActiveMQJAASSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager) InVMLoginModule(org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule) JndiBindingRegistry(org.apache.activemq.artemis.core.registry.JndiBindingRegistry) SecurityConfiguration(org.apache.activemq.artemis.core.config.impl.SecurityConfiguration) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) File(java.io.File)

Example 24 with FileDeploymentManager

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;
}
Also used : MapBindingRegistry(org.apache.activemq.artemis.core.registry.MapBindingRegistry) FileJMSConfiguration(org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration) JMSServerManagerImpl(org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl) JndiBindingRegistry(org.apache.activemq.artemis.core.registry.JndiBindingRegistry) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager)

Example 25 with FileDeploymentManager

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);
    }
}
Also used : FileConfiguration(org.apache.activemq.artemis.core.config.impl.FileConfiguration) ActiveMQJAASSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl)

Aggregations

FileDeploymentManager (org.apache.activemq.artemis.core.config.FileDeploymentManager)25 FileConfiguration (org.apache.activemq.artemis.core.config.impl.FileConfiguration)12 Test (org.junit.Test)11 FileJMSConfiguration (org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration)8 File (java.io.File)5 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)5 ActiveMQServerImpl (org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl)5 ActiveMQJAASSecurityManager (org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager)5 SecurityConfiguration (org.apache.activemq.artemis.core.config.impl.SecurityConfiguration)3 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)3 JMSServerManagerImpl (org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl)3 InVMLoginModule (org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule)3 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)2 JMSQueueConfiguration (org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration)2 TopicConfiguration (org.apache.activemq.artemis.jms.server.config.TopicConfiguration)2 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1