Search in sources :

Example 11 with FileDeploymentManager

use of org.apache.activemq.artemis.core.config.FileDeploymentManager in project activemq-artemis by apache.

the class FileConfigurationParserTest method testSchemaValidation.

/**
 * These "InvalidConfigurationTest*.xml" files are modified copies of {@value
 * ConfigurationTest-full-config.xml}, so just diff it for changes, e.g.
 * <p>
 * <pre>
 * diff ConfigurationTest-full-config.xml InvalidConfigurationTest4.xml
 * </pre>
 *
 * @throws Exception
 */
@Test
public void testSchemaValidation() throws Exception {
    for (int i = 0; i < 7; i++) {
        String filename = "InvalidConfigurationTest" + i + ".xml";
        FileConfiguration fc = new FileConfiguration();
        FileDeploymentManager deploymentManager = new FileDeploymentManager(filename);
        deploymentManager.addDeployable(fc);
        try {
            deploymentManager.readConfiguration();
            fail("parsing should have failed for " + filename);
        } catch (java.lang.IllegalStateException e) {
            Throwable cause = e.getCause();
            assertTrue("must have been org.xml.sax.SAXParseException", cause instanceof org.xml.sax.SAXParseException);
        }
    }
}
Also used : SimpleString(org.apache.activemq.artemis.api.core.SimpleString) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) Test(org.junit.Test)

Example 12 with FileDeploymentManager

use of org.apache.activemq.artemis.core.config.FileDeploymentManager in project activemq-artemis by apache.

the class XmlConfigPluginTest method createServerFromConfig.

private ActiveMQServer createServerFromConfig(String configFileName) throws Exception {
    FileConfiguration fc = new FileConfiguration();
    FileJMSConfiguration fileConfiguration = new FileJMSConfiguration();
    FileDeploymentManager deploymentManager = new FileDeploymentManager(configFileName);
    deploymentManager.addDeployable(fc);
    deploymentManager.addDeployable(fileConfiguration);
    deploymentManager.readConfiguration();
    return addServer(new ActiveMQServerImpl(fc));
}
Also used : FileConfiguration(org.apache.activemq.artemis.core.config.impl.FileConfiguration) FileJMSConfiguration(org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl)

Example 13 with FileDeploymentManager

use of org.apache.activemq.artemis.core.config.FileDeploymentManager 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());
}
Also used : FileConfiguration(org.apache.activemq.artemis.core.config.impl.FileConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) File(java.io.File) Test(org.junit.Test)

Example 14 with FileDeploymentManager

use of org.apache.activemq.artemis.core.config.FileDeploymentManager in project activemq-artemis by apache.

the class DatabaseStoreConfigurationTest 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 15 with FileDeploymentManager

use of org.apache.activemq.artemis.core.config.FileDeploymentManager in project activemq-artemis by apache.

the class FileConfigurationParserTest method testDuplicateQueue.

@Test
public void testDuplicateQueue() throws Exception {
    String filename = "duplicateQueue.xml";
    FileConfiguration fc = new FileConfiguration();
    FileDeploymentManager deploymentManager = new FileDeploymentManager(filename);
    deploymentManager.addDeployable(fc);
    deploymentManager.readConfiguration();
    ActiveMQServer server = addServer((ActiveMQServer) deploymentManager.buildService(null, null).get("core"));
    server.start();
    assertEquals(0, server.locateQueue(SimpleString.toSimpleString("q")).getMaxConsumers());
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) Test(org.junit.Test)

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