예제 #1
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);
  }
예제 #2
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());
  }
예제 #3
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());
  }
예제 #4
0
  public void testDeployFullConfiguration2() throws Exception {
    JMSServerDeployer deployer = new JMSServerDeployer(jmsServer, deploymentManager);

    String conf = "hornetq-jms-for-JMSServerDeployerTest2.xml";
    URI confURL = Thread.currentThread().getContextClassLoader().getResource(conf).toURI();

    String[] connectionFactoryBindings =
        new String[] {
          "/fullConfigurationConnectionFactory",
          "/acme/fullConfigurationConnectionFactory",
          "java:/xyz/tfullConfigurationConnectionFactory",
          "java:/connectionfactories/acme/fullConfigurationConnectionFactory"
        };
    String[] queueBindings =
        new String[] {"/fullConfigurationQueue", "/queue/fullConfigurationQueue"};
    String[] topicBindings =
        new String[] {"/fullConfigurationTopic", "/topic/fullConfigurationTopic"};

    for (String binding : connectionFactoryBindings) {
      UnitTestCase.checkNoBinding(context, binding);
    }
    for (String binding : queueBindings) {
      UnitTestCase.checkNoBinding(context, binding);
    }
    for (String binding : topicBindings) {
      UnitTestCase.checkNoBinding(context, binding);
    }

    deployer.deploy(confURL);

    for (String binding : connectionFactoryBindings) {
      UnitTestCase.checkBinding(context, binding);
    }
    for (String binding : queueBindings) {
      UnitTestCase.checkBinding(context, binding);
    }
    for (String binding : topicBindings) {
      UnitTestCase.checkBinding(context, binding);
    }

    for (String binding : connectionFactoryBindings) {
      HornetQConnectionFactory cf = (HornetQConnectionFactory) context.lookup(binding);
      Assert.assertNotNull(cf);
      Assert.assertEquals(1234, cf.getClientFailureCheckPeriod());
      Assert.assertEquals(5678, cf.getCallTimeout());
      Assert.assertEquals(12345, cf.getConsumerWindowSize());
      Assert.assertEquals(6789, cf.getConsumerMaxRate());
      Assert.assertEquals(123456, cf.getConfirmationWindowSize());
      Assert.assertEquals(7712652, cf.getProducerWindowSize());
      Assert.assertEquals(789, cf.getProducerMaxRate());
      Assert.assertEquals(12, cf.getMinLargeMessageSize());
      Assert.assertEquals("TestClientID", cf.getClientID());
      Assert.assertEquals(3456, cf.getDupsOKBatchSize());
      Assert.assertEquals(4567, cf.getTransactionBatchSize());
      Assert.assertEquals(true, cf.isBlockOnAcknowledge());
      Assert.assertEquals(false, cf.isBlockOnNonDurableSend());
      Assert.assertEquals(true, cf.isBlockOnDurableSend());
      Assert.assertEquals(false, cf.isAutoGroup());
      Assert.assertEquals(true, cf.isPreAcknowledge());
      Assert.assertEquals(2345, cf.getConnectionTTL());
      assertEquals(true, cf.isFailoverOnInitialConnection());
      Assert.assertEquals(34, cf.getReconnectAttempts());
      Assert.assertEquals(5, cf.getRetryInterval());
      Assert.assertEquals(6.0, cf.getRetryIntervalMultiplier());
      Assert.assertEquals(true, cf.isCacheLargeMessagesClient());
    }

    for (String binding : queueBindings) {
      Queue queue = (Queue) context.lookup(binding);
      Assert.assertNotNull(queue);
      Assert.assertEquals("fullConfigurationQueue", queue.getQueueName());
    }

    for (String binding : topicBindings) {
      Topic topic = (Topic) context.lookup(binding);
      Assert.assertNotNull(topic);
      Assert.assertEquals("fullConfigurationTopic", topic.getTopicName());
    }
  }