public synchronized void start() throws Exception { if (started) { return; } URL url = getClass().getClassLoader().getResource(configurationUrl); if (url == null) { // The URL is outside of the classloader. Trying a pure url now url = new URL(configurationUrl); } FileConfiguration.log.debug("Loading server configuration from " + url); Reader reader = new InputStreamReader(url.openStream()); String xml = org.hornetq.utils.XMLUtil.readerToString(reader); xml = XMLUtil.replaceSystemProps(xml); Element e = org.hornetq.utils.XMLUtil.stringToElement(xml); FileConfigurationParser parser = new FileConfigurationParser(); // https://jira.jboss.org/browse/HORNETQ-478 - We only want to validate AIO when // starting the server // and we don't want to do it when deploying hornetq-queues.xml which uses the same parser // and XML format parser.setValidateAIO(true); parser.parseMainConfig(e, this); started = true; }
public void testValidateEmptyConfiguration() throws Exception { JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager); String xml = "<configuration xmlns='urn:hornetq'> " + "</configuration>"; Element rootNode = org.hornetq.utils.XMLUtil.stringToElement(xml); deployer.validate(rootNode); }
private void doTestDeployTopicsWithUnusualNames( final String topicName, final String htmlEncodedName, final String jndiName) throws Exception { JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager); String xml = "<topic name=\"" + htmlEncodedName + "\">" + "<entry name=\"" + jndiName + "\"/>" + "</topic>"; Element rootNode = org.hornetq.utils.XMLUtil.stringToElement(xml); deployer.deploy(rootNode); Topic topic = (Topic) context.lookup(jndiName); Assert.assertNotNull(topic); Assert.assertEquals(topicName, topic.getTopicName()); }
private void doTestDeployQueuesWithUnusualNames( final String queueName, final String htmlEncodedName, final String jndiName) throws Exception { JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager); String xml = "<queue name=\"" + htmlEncodedName + "\">" + "<entry name=\"" + jndiName + "\"/>" + "</queue>"; Element rootNode = org.hornetq.utils.XMLUtil.stringToElement(xml); deployer.deploy(rootNode); Queue queue = (Queue) context.lookup(jndiName); Assert.assertNotNull(queue); Assert.assertEquals(queueName, queue.getQueueName()); }