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);
}
}
}
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));
}
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());
}
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;
}
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());
}
Aggregations