Пример #1
0
  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;
  }
Пример #2
0
  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);
  }
Пример #3
0
  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());
  }
Пример #4
0
  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());
  }
 @Override
 public void validate(final Node rootNode) throws Exception {
   org.hornetq.utils.XMLUtil.validate(rootNode, "schema/hornetq-configuration.xsd");
 }