Ejemplo n.º 1
0
  @Override
  @After
  public void tearDown() throws Exception {
    backupJMSService.stop();

    liveJMSService.stop();

    Assert.assertEquals(0, InVMRegistry.instance.size());

    liveService = null;

    liveJMSService = null;

    backupJMSService = null;

    ctx1 = null;

    ctx2 = null;

    backupService = null;

    backupParams = null;

    super.tearDown();
  }
Ejemplo n.º 2
0
  @Override
  @After
  public void tearDown() throws Exception {
    jmsServer.stop();

    super.tearDown();
  }
Ejemplo n.º 3
0
  @Test
  public void testCreateDurableQueueUsingJMXAndRestartServer() throws Exception {
    String queueName = RandomUtil.randomString();
    String binding = RandomUtil.randomString();

    UnitTestCase.checkNoBinding(context, binding);
    checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));

    JMSServerControl control = ManagementControlHelper.createJMSServerControl(mbeanServer);
    control.createQueue(queueName, binding);

    Object o = UnitTestCase.checkBinding(context, binding);
    Assert.assertTrue(o instanceof Queue);
    Queue queue = (Queue) o;
    assertEquals(queueName, queue.getQueueName());
    checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));

    serverManager.stop();

    checkNoBinding(context, binding);
    checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));

    serverManager = createJMSServer();
    serverManager.start();

    o = UnitTestCase.checkBinding(context, binding);
    Assert.assertTrue(o instanceof Queue);
    queue = (Queue) o;
    assertEquals(queueName, queue.getQueueName());
    checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
  }
Ejemplo n.º 4
0
 @Override
 @After
 public void tearDown() throws Exception {
   serverManager.stop();
   serverManager = null;
   super.tearDown();
 }
Ejemplo n.º 5
0
 public synchronized void stop(StopContext context) {
   final JMSServerManager jmsServer = this.jmsServer;
   this.jmsServer = null;
   try {
     jmsServer.stop();
   } catch (Exception e) {
     MESSAGING_LOGGER.errorStoppingJmsServer(e);
   }
 }
Ejemplo n.º 6
0
  @Override
  protected void tearDown() throws Exception {
    jmsServer.stop();
    jmsServer = null;
    context = null;
    deploymentManager = null;
    config = null;

    super.tearDown();
  }
Ejemplo n.º 7
0
  @Test
  public void testCreateDurableQueueUsingJMSAndRestartServer() throws Exception {
    String queueName = RandomUtil.randomString();
    String binding = RandomUtil.randomString();

    UnitTestCase.checkNoBinding(context, binding);
    checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));

    TransportConfiguration config =
        new TransportConfiguration(InVMConnectorFactory.class.getName());
    Connection connection =
        HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, config)
            .createConnection();
    connection.start();
    Queue managementQueue = HornetQJMSClient.createQueue("hornetq.management");
    QueueSession session = (QueueSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    QueueRequestor requestor = new QueueRequestor(session, managementQueue);
    Message message = session.createMessage();
    JMSManagementHelper.putOperationInvocation(
        message, "jms.server", "createQueue", queueName, binding);
    Message reply = requestor.request(message);
    assertTrue(JMSManagementHelper.hasOperationSucceeded(reply));
    connection.close();

    Object o = UnitTestCase.checkBinding(context, binding);
    Assert.assertTrue(o instanceof Queue);
    Queue queue = (Queue) o;
    assertEquals(queueName, queue.getQueueName());
    checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));

    serverManager.stop();

    checkNoBinding(context, binding);
    checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));

    serverManager = createJMSServer();
    serverManager.start();

    o = UnitTestCase.checkBinding(context, binding);
    Assert.assertTrue(o instanceof Queue);
    queue = (Queue) o;
    assertEquals(queueName, queue.getQueueName());
    checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
  }