@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(); }
@Override @After public void tearDown() throws Exception { jmsServer.stop(); super.tearDown(); }
@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)); }
@Override @After public void tearDown() throws Exception { serverManager.stop(); serverManager = null; super.tearDown(); }
public synchronized void stop(StopContext context) { final JMSServerManager jmsServer = this.jmsServer; this.jmsServer = null; try { jmsServer.stop(); } catch (Exception e) { MESSAGING_LOGGER.errorStoppingJmsServer(e); } }
@Override protected void tearDown() throws Exception { jmsServer.stop(); jmsServer = null; context = null; deploymentManager = null; config = null; super.tearDown(); }
@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)); }