protected void removeAllMessages(final String queueName, final int index) throws Exception { ManagementService managementService = server0.getManagementService(); if (index == 1) { managementService = server1.getManagementService(); } JMSQueueControl queueControl = (JMSQueueControl) managementService.getResource(ResourceNames.JMS_QUEUE + queueName); queueControl.removeMessages(null); }
protected void checkNoSubscriptions(final Topic topic, final int index) throws Exception { ManagementService managementService = server0.getManagementService(); if (index == 1) { managementService = server1.getManagementService(); } TopicControl topicControl = (TopicControl) managementService.getResource(ResourceNames.JMS_TOPIC + topic.getTopicName()); Assert.assertEquals(0, topicControl.getSubscriptionCount()); }
public boolean checkEmpty(final Queue queue, final int index) throws Exception { ManagementService managementService = server0.getManagementService(); if (index == 1) { managementService = server1.getManagementService(); } JMSQueueControl queueControl = (JMSQueueControl) managementService.getResource(ResourceNames.JMS_QUEUE + queue.getQueueName()); Long messageCount = queueControl.getMessageCount(); if (messageCount > 0) { queueControl.removeMessages(null); } return true; }