/*
* JBoss, Home of Professional Open Source.
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.jopr.jsfunit.as5.jmsDestinations;
import com.gargoylesoftware.htmlunit.html.*;
import java.util.Map;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
import java.util.List;
import java.io.IOException;
import org.jboss.jopr.jsfunit.*;
import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
import javax.management.MalformedObjectNameException;
import javax.management.JMException;
import javax.jms.Topic;
import javax.jms.TopicSession;
import javax.jms.Queue;
import javax.jms.QueueSession;
import javax.jms.DeliveryMode;
import org.jboss.jms.server.messagecounter.MessageCounter;
import org.jboss.jms.destination.JBossDestination;
import javax.management.ObjectName;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentTable;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentTableRow;
/**
* This class contains operations tests for JMS topics and queues.
* This class should be run against JBAS 5.x.
*
* @author Farah Juma
*/
public class JMSOperationsTest extends JMSTest {
/* OPERATION #1 - REMOVE ALL MESSAGES - APPLIES TO TOPICS AND QUEUES */
/**
* Test Name: testRemoveAllMessagesAfterTopicCreation
* Assertion: Verify that the metrics remain unchanged
* after executing the "Remove All Messages" operation for a topic
* when there are no messages.
*/
public void testRemoveAllMessagesAfterTopicCreation() throws Exception {
String jndiName = "RemoveAllMessagesAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "0");
expectedMetrics.put(ALL_SUB_COUNT, "0");
expectedMetrics.put(DURABLE_MSG_COUNT, "0");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0");
expectedMetrics.put(DURABLE_SUB_COUNT, "0");
expectedMetrics.put(NON_DURABLE_SUB_COUNT, "0");
performDestinationOperationAndCheckMetrics(DestinationType.TOPIC,
jndiName, REMOVE_ALL_MSGS,
expectedMetrics,
getTopicSummaryMetrics());
}
/**
* Test Name: testTopicRemoveAllMessagesAfterMultipleMessages
* Assertion: Verify that the metrics are updated accordingly
* after executing the "Remove All Messages" operation for a topic
* when the topic has multiple messages.
*/
public void DISABLEDtestTopicRemoveAllMessagesAfterMultipleMessages() throws Exception {
String jndiName = "TopicRemoveAllMessagesAfterMultipleMessages";
// Create the topic first
createTopic(jndiName);
topicRemoveAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testTopicRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Verify that the metrics are updated accordingly
* after executing the "Remove All Messages" operation for a topic
* when the topic has multiple messages. Use a topic that already exists.
*/
public void DISABLEDtestTopicRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "RemoveAllMessagesMultipleMessagesExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
topicRemoveAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testTopicRemoveAllMessagesAfterMultipleMessages*
* tests.
*/
private void topicRemoveAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
createTopicSessionAndSendMessages(2, jndiName);
// Wait for messages to be delivered before removing them
Thread.sleep(10000);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "0");
expectedMetrics.put(ALL_SUB_COUNT, "2");
expectedMetrics.put(DURABLE_MSG_COUNT, "0");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0");
expectedMetrics.put(DURABLE_SUB_COUNT, "1");
expectedMetrics.put(NON_DURABLE_SUB_COUNT, "1");
performDestinationOperationAndCheckMetrics(DestinationType.TOPIC,
jndiName, REMOVE_ALL_MSGS,
expectedMetrics,
getTopicSummaryMetrics());
}
/**
* Test Name: testRemoveAllMessagesAfterQueueCreation
* Assertion: Verify that the metrics remain unchanged
* after executing the "Remove All Messages" operation for a queue
* when there are no messages.
*/
public void testRemoveAllMessagesAfterQueueCreation() throws Exception {
String jndiName = "RemoveAllMessagesMAfterQueueCreation";
// Create the queue first
createQueue(jndiName);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(DELIVERING_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "0");
expectedMetrics.put(SCHEDULED_MSG_COUNT, "0");
expectedMetrics.put(COUNT, "0");
//expectedMetrics.put(COUNT_DELTA, "0");
expectedMetrics.put(DEPTH, "0");
//expectedMetrics.put(DEPTH_DELTA, "0");
performDestinationOperationAndCheckMetrics(DestinationType.QUEUE,
jndiName, REMOVE_ALL_MSGS,
expectedMetrics,
getQueueSummaryMetrics());
}
/**
* Test Name: testQueueRemoveAllMessagesAfterMultipleMessages
* Assertion: Verify that the metrics are updated appropriately
* after executing the "Remove All Messages" operation for a queue
* when there are multiple messages in the queue.
*/
public void DISABLEDtestQueueRemoveAllMessagesAfterMultipleMessages() throws Exception {
String jndiName = "QueueRemoveAllMessagesAfterMultipleMessages";
// Create the queue first
createQueue(jndiName);
queueRemoveAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testQueueRemoveAllMessagesAfterMultipleMessagesUsingExistingServicefile
* Assertion: Verify that the metrics are updated appropriately
* after executing the "Remove All Messages" operation for a queue
* when there are multiple messages in the queue. Use a queue that
* already exists.
*/
public void DISABLEDtestQueueRemoveAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "RemoveAllMessagesMultipleMessagesExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
queueRemoveAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testQueueRemoveAllMessagesAfterMultipleMessages*
* tests.
*/
private void queueRemoveAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
createQueueSessionAndSendMessages(2, jndiName);
// Wait for messages to be delivered before removing them
Thread.sleep(10000);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(DELIVERING_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "0");
expectedMetrics.put(SCHEDULED_MSG_COUNT, "0");
expectedMetrics.put(COUNT, "2");
//expectedMetrics.put(COUNT_DELTA, "2");
expectedMetrics.put(DEPTH, "0");
//expectedMetrics.put(DEPTH_DELTA, "0");
performDestinationOperationAndCheckMetrics(DestinationType.QUEUE,
jndiName, REMOVE_ALL_MSGS,
expectedMetrics,
getQueueSummaryMetrics());
}
/* OPERATION #2 - RESET MESSAGE COUNTER - APPLIES TO QUEUES ONLY */
/**
* Test Name: testResetMessageCounterAfterQueueCreation
* Assertion: Verify that the queue metrics are correct
* after executing the "Reset Message Counter" operation for a queue
* right after creation.
*/
public void testResetMessageCounterAfterQueueCreation() throws Exception {
String jndiName = "ResetMessageCounterAfterQueueCreation";
// Create the queue first
createQueue(jndiName);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(DELIVERING_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "0");
expectedMetrics.put(SCHEDULED_MSG_COUNT, "0");
expectedMetrics.put(COUNT, "0");
//expectedMetrics.put(COUNT_DELTA, "0");
expectedMetrics.put(DEPTH, "0");
//expectedMetrics.put(DEPTH_DELTA, "0");
performDestinationOperationAndCheckMetrics(DestinationType.QUEUE,
jndiName, RESET_MSG_COUNTER,
expectedMetrics,
getQueueSummaryMetrics());
}
/**
* Test Name: testQueueResetMessageCounterAfterMultipleMessages
* Assertion: Verify that the queue metrics are correct
* after executing the "Reset Message Counter" operation for a queue
* when there are multiple messages in the queue.
*/
public void testQueueResetMessageCounterAfterMultipleMessages() throws Exception {
String jndiName = "QueueResetMessageCounterAfterMultipleMessages";
// Create the queue first
createQueue(jndiName);
resetMessageCounterAfterMultipleMessages(jndiName);
}
/**
* Test Name: testQueueResetMessageCounterAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Verify that the queue metrics are correct
* after executing the "Reset Message Counter" operation for a queue
* when there are multiple messages in the queue. Use a queue that
* already exists.
*/
public void testQueueResetMessageCounterAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ResetMessageCounterMultipleMessagesExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
resetMessageCounterAfterMultipleMessages(jndiName);
}
/**
* Common code for the testQueueResetMessageCounterAfterMultipleMessages*
* tests.
*/
private void resetMessageCounterAfterMultipleMessages(String jndiName) throws Exception {
createQueueSessionAndSendMessages(3, jndiName);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(DELIVERING_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "3");
expectedMetrics.put(SCHEDULED_MSG_COUNT, "0");
expectedMetrics.put(COUNT, "0");
//expectedMetrics.put(COUNT_DELTA, "0");
expectedMetrics.put(DEPTH, "3");
//expectedMetrics.put(DEPTH_DELTA, "3");
performDestinationOperationAndCheckMetrics(DestinationType.QUEUE,
jndiName, RESET_MSG_COUNTER,
expectedMetrics,
getQueueSummaryMetrics());
}
/* OPERATION #3 - RESET MESSAGE COUNTER HISTORY - APPLIES TO QUEUES ONLY */
/**
* Test Name: testResetMessageCounterHistoryAfterQueueCreation
* Assertion: Verify that the queue metrics are correct after
* executing the "Reset Message Counter History" operation for a queue
* after creation.
*/
public void testResetMessageCounterHistoryAfterQueueCreation() throws Exception {
String jndiName = "ResetMessageCounterHistoryAfterQueueCreation";
// Create the queue first
createQueue(jndiName);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(DELIVERING_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "0");
expectedMetrics.put(SCHEDULED_MSG_COUNT, "0");
expectedMetrics.put(COUNT, "0");
//expectedMetrics.put(COUNT_DELTA, "0");
expectedMetrics.put(DEPTH, "0");
//expectedMetrics.put(DEPTH_DELTA, "0");
performDestinationOperationAndCheckMetrics(DestinationType.QUEUE,
jndiName, RESET_MSG_COUNTER_HISTORY,
expectedMetrics,
getQueueSummaryMetrics());
}
/**
* Test Name: testQueueResetMessageCounterHistoryAfterMultipleMessages
* Assertion: Verify that the queue metrics are correct after
* executing the "Reset Message Counter History" operation for a queue
* that has multiple messages.
*/
public void testQueueResetMessageCounterHistoryAfterMultipleMessages() throws Exception {
String jndiName = "QueueResetMessageCounterHistoryAfterMultipleMessages";
// Create the queue first
createQueue(jndiName);
queueResetMessageCounterHistoryAfterMultipleMessages(jndiName);
}
/**
* Test Name: testQueueResetMessageCounterHistoryAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Verify that the queue metrics are correct after
* executing the "Reset Message Counter History" operation for a queue
* that has multiple messages. Use a queue that already exists.
*/
public void testQueueResetMessageCounterHistoryAfterMultipleMessagesUsingExsitingServiceFile() throws Exception {
String jndiName = "ResetMessageCounterHistoryMultipleMessagesExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
queueResetMessageCounterHistoryAfterMultipleMessages(jndiName);
}
/**
* Common code for the testQueueResetMessageCounterHistoryAfterMultipleMessages*
* tests.
*/
private void queueResetMessageCounterHistoryAfterMultipleMessages(String jndiName) throws Exception {
createQueueSessionAndSendMessages(3, jndiName);
// Set up the expected values
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(DELIVERING_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "3");
expectedMetrics.put(SCHEDULED_MSG_COUNT, "0");
expectedMetrics.put(COUNT, "3");
//expectedMetrics.put(COUNT_DELTA, "3");
expectedMetrics.put(DEPTH, "3");
//expectedMetrics.put(DEPTH_DELTA, "3");
performDestinationOperationAndCheckMetrics(DestinationType.QUEUE,
jndiName, RESET_MSG_COUNTER_HISTORY,
expectedMetrics,
getQueueSummaryMetrics());
}
/* OPERATION #4 - LIST ALL SUBSCRIPTIONS - APPLIES ONLY TO TOPICS */
/**
* Test Name: testListAllSubscriptionsAfterTopicCreation
* Assertion: Make sure that the correct results get displayed
* after the "List All Subscriptions" operation is invoked for
* a topic right after creation.
*/
public void testListAllSubscriptionsAfterTopicCreation() throws Exception {
String jndiName = "ListAllSubscriptionsAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
performListSubscriptionsAndCheckResults(jndiName, LIST_ALL_SUB, Boolean.TRUE);
}
/**
* Test Name: testTopicListAllSubscriptionsAfterMultipleSubscribers
* Assertion: Verify that the correct results get displayed after invoking
* the "List All Subscriptions" operation for a topic that has multiple subscribers.
*/
public void testTopicListAllSubscriptionsAfterMultipleSubscribers() throws Exception {
String jndiName = "ListAllSubscriptionsAfterMultipleSubscribers";
// Create the topic first
createTopic(jndiName);
listAllSubscriptionsAfterMultipleSubscribers(jndiName);
}
/**
* Test Name: testTopicListAllSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
* Assertion: Verify that the correct results get displayed after invoking
* the "List All Subscriptions" operation for a topic that has multiple subscribers.
* Use a topic that already exists.
*/
public void testTopicListAllSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
String jndiName = "ListAllSubscriptionsMultipleSubscribersExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
listAllSubscriptionsAfterMultipleSubscribers(jndiName);
}
/**
* Common code for the testListAllSubscriptionsAfterMultipleSubscribers* tests.
*/
private void listAllSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
TopicSession session = createTopicSession();
Topic topic = getTopic(jndiName);
// Create multiple subscriptions (2 durable ones, 2 non-durable ones)
for(int i = 0; i < 2; i++) {
createDurableTopicSubscriber(session, topic, jndiName + "Subscriber" + i);
createNonDurableTopicSubscriber(session, topic);
}
performListSubscriptionsAndCheckResults(jndiName, LIST_ALL_SUB,
Boolean.FALSE);
}
/* OPERATION #5 - LIST DURABLE SUBSCRIPTIONS - APPLIES TO TOPICS ONLY */
/**
* Test Name: testListDurableSubscriptionsAfterTopicCreation
* Assertion: Make sure that the correct results get displayed
* after the "List Durable Subscriptions" operation is invoked for
* a topic right after creation.
*/
public void testListDurableSubscriptionsAfterTopicCreation() throws Exception {
String jndiName = "ListDurableSubscriptionsAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
performListSubscriptionsAndCheckResults(jndiName, LIST_DURABLE_SUB, Boolean.TRUE);
}
/**
* Test Name: testTopicListDurableSubscriptionsAfterMultipleSubscribers
* Assertion: Verify that the correct results get displayed after invoking
* the "List Durable Subscriptions" operation for a topic that has multiple
* durable subscribers.
*/
public void testTopicListDurableSubscriptionsAfterMultipleSubscribers() throws Exception {
String jndiName = "ListDurableSubscriptionsAfterMultipleSubscribers";
// Create the topic first
createTopic(jndiName);
listDurableSubscriptionsAfterMultipleSubscribers(jndiName);
}
/**
* Test Name: testTopicListDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
* Assertion: Verify that the correct results get displayed after invoking
* the "List Durable Subscriptions" operation for a topic that has multiple
* durable subscribers. Use a topic that already exists.
*/
public void testTopicListDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
String jndiName = "ListDurableSubscriptionsMultipleSubscribersExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
listDurableSubscriptionsAfterMultipleSubscribers(jndiName);
}
/**
* Common code for the testListDurableSubscriptionsAfterMultipleSubscribers* tests.
*/
private void listDurableSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
createTopicSessionAndDurableSubscribers(2, jndiName);
performListSubscriptionsAndCheckResults(jndiName, LIST_DURABLE_SUB,
Boolean.FALSE);
}
/* OPERATION #6 - LIST NON DURABLE SUBSCRIPTIONS - APPLIES TO TOPICS ONLY*/
/**
* Test Name: testListNonDurableSubscriptionsAfterTopicCreation
* Assertion: Make sure that the correct results get displayed
* after the "List Non Durable Subscriptions" operation is invoked for
* a topic right after creation.
*/
public void testListNonDurableSubscriptionsAfterTopicCreation() throws Exception {
String jndiName = "ListNonDurableSubscriptionsAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
performListSubscriptionsAndCheckResults(jndiName, LIST_NON_DURABLE_SUB, Boolean.TRUE);
}
/**
* Test Name: testTopicListNonDurableSubscriptionsAfterMultipleSubscribers
* Assertion: Verify that the correct results get displayed after invoking
* the "List Non Durable Subscriptions" operation for a topic that has multiple
* non-durable subscribers.
*/
public void testTopicListNonDurableSubscriptionsAfterMultipleSubscribers() throws Exception {
String jndiName = "ListNonDurableSubscriptionsAfterMultipleSubscribers";
// Create the topic first
createTopic(jndiName);
listNonDurableSubscriptionsAfterMultipleSubscribers(jndiName);
}
/**
* Test Name: testTopicListNonDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile
* Assertion: Verify that the correct results get displayed after invoking
* the "List Non Durable Subscriptions" operation for a topic that has multiple
* non-durable subscribers. Use a topic that already exists.
*/
public void testTopicListNonDurableSubscriptionsAfterMultipleSubscribersUsingExistingServiceFile() throws Exception {
String jndiName = "ListNonDurableSubscriptionsMultipleSubscribersExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
listNonDurableSubscriptionsAfterMultipleSubscribers(jndiName);
}
/**
* Common code for the testListNonDurableSubscriptionsAfterMultipleSubscribers* tests.
*/
private void listNonDurableSubscriptionsAfterMultipleSubscribers(String jndiName) throws Exception {
createTopicSessionAndNonDurableSubscribers(2, jndiName);
performListSubscriptionsAndCheckResults(jndiName, LIST_NON_DURABLE_SUB,
Boolean.FALSE);
}
/* OPERATION #7 - LIST MESSAGE COUNTER AS HTML - APPLIES TO QUEUES ONLY */
/**
* Test Name: testListMessageCounterAsHTMLAfterQueueCreation
* Assertion: Make sure that the "List Message Counter As HTML"
* operation for queues is executed successfully after creating
* a new queue.
*/
public void testListMessageCounterAsHTMLAfterQueueCreation() throws Exception {
ArrayList<String> expectedValues = new ArrayList<String>();
String jndiName = "ListMessageCounterAfterQueueCreation";
//Create the queue first
createQueue(jndiName);
// Set up the expected result
StringBuffer expectedBuffer = new StringBuffer();
expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()));
expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()
+ "." + jndiName));
expectedBuffer.append(formatTableCell("-")); // Subscription
expectedBuffer.append(formatTableCell("-")); // Durable
expectedBuffer.append(formatTableCell("0")); // Count
expectedBuffer.append(formatTableCell("-")); // Count delta
expectedBuffer.append(formatTableCell("0")); // Depth
expectedBuffer.append(formatTableCell("-")); // Depth delta
expectedValues.add(expectedBuffer.toString());
performListAsHtmlOperation(jndiName,
DestinationType.QUEUE,
LIST_MSG_COUNTER_AS_HTML,
Boolean.FALSE,
expectedValues);
}
/**
* Test Name: testListMessageCounterAsHTMLAfterMultipleMessages
* Assertion: Make sure that the "List Message Counter As HTML"
* operation for queues returns the correct results when the queue has
* multiple messages.
*/
public void testListMessageCounterAsHTMLAfterMultipleMessagess() throws Exception {
String jndiName = "ListMessageCounterAfterMultipleMessages";
// Create the queue first
createQueue(jndiName);
listMessageCounterAsHtmlAfterMultipleMessages(jndiName);
}
/**
* Test Name: testListMessageCounterAsHTMLAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Make sure that the "List Message Counter As HTML"
* operation for queues returns the correct results when the queue has
* multiple messages. Use a queue that already exists.
*/
public void testListMessageCounterAsHTMLAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ListMessageCounterMultipleMessagesExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
listMessageCounterAsHtmlAfterMultipleMessages(jndiName);
}
/**
* Common code for the testListMessageCounterAsHTMLAfterMultipleMessages* tests.
*/
private void listMessageCounterAsHtmlAfterMultipleMessages(String jndiName) throws Exception {
ArrayList<String> expectedValues = new ArrayList<String>();
// Send some messages to the queue
createQueueSessionAndSendMessages(2, jndiName);
// Set up the expected result
StringBuffer expectedBuffer = new StringBuffer();
expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()));
expectedBuffer.append(formatTableCell(DestinationType.QUEUE.getName()
+ "." + jndiName));
expectedBuffer.append(formatTableCell("-")); // Subscription
expectedBuffer.append(formatTableCell("-")); // Durable
expectedBuffer.append(formatTableCell("2")); // Count
expectedBuffer.append(formatTableCell("2")); // Count delta
expectedBuffer.append(formatTableCell("2")); // Depth
expectedBuffer.append(formatTableCell("2")); // Depth delta
expectedValues.add(expectedBuffer.toString());
performListAsHtmlOperation(jndiName,
DestinationType.QUEUE,
LIST_MSG_COUNTER_AS_HTML,
Boolean.FALSE,
expectedValues);
}
/* OPERATION #8 - LIST MESSAGE COUNTER HISTORY AS HTML - APPLIES TO QUEUES ONLY*/
/**
* Test Name: testListMessageCounterHistoryAsHTMLAfterQueueCreation
* Assertion: Make sure that the "List Message Counter History As HTML"
* operation for queues returns the correct results after creating
* a new queue.
*/
public void testListMessageCounterHistoryAsHTMLAfterQueueCreation() throws Exception {
String jndiName = "ListMessageCounterHistoryAfterQueueCreation";
ArrayList<String> expectedValue = new ArrayList<String>();
expectedValue.add("");
//Create the queue first
createQueue(jndiName);
performListAsHtmlOperation(jndiName,
DestinationType.QUEUE,
LIST_MSG_COUNTER_HISTORY_AS_HTML,
Boolean.FALSE,
expectedValue);
}
/**
* Test Name: testListMessageCounterHistoryAsHTMLUsingExistingServiceFile
* Assertion: Make sure that the "List Message Counter History As HTML"
* operation for queues returns the correct results. Use a queue that already
* exists.
*/
public void testListMessageCounterHistoryAsHTMLUsingExistingServiceFile() throws Exception {
String jndiName = "ListMessageCounterHistoryExistingQueue";
ArrayList<String> expectedValue = new ArrayList<String>();
expectedValue.add("");
expandNavTreeArrow(JMS_NAV_LABEL);
performListAsHtmlOperation(jndiName,
DestinationType.QUEUE,
LIST_MSG_COUNTER_HISTORY_AS_HTML,
Boolean.FALSE,
expectedValue);
}
/* OPERATION #9 - LIST DURABLE SUBSCRIPTIONS AS HTML - APPLIES TO TOPICS ONLY */
/**
* Test Name: testListDurableSubscriptionsAsHTMLAfterTopicCreation
* Assertion: Make sure that the "List Durable Subscriptions As HTML"
* operation for topics returns the correct results after creating
* a new topic.
*/
public void testListDurableSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
String jndiName = "ListDurableSubscriptionsHtmlAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
performListAsHtmlOperationAfterCreation(jndiName,
DestinationType.TOPIC,
LIST_DURABLE_SUB_AS_HTML,
Boolean.FALSE);
}
/**
* Test Name: testListDurableSubscriptionsAsHTMLAfterMultipleSubscribers
* Assertion: Make sure that the "List Durable Subscriptions As HTML"
* operation for topics returns the correct results when the topic
* has multiple durable subscribers.
*/
public void testListDurableSubscriptionsAsHTMLAfterMultipleSubscribers()
throws Exception {
String jndiName = "ListDurableSubscriptionsHtmlAfterMultipleSubscribers";
createTopic(jndiName);
listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
}
/**
* Test Name: testListDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
* Assertion: Make sure that the "List Durable Subscriptions As HTML"
* operation for topics returns the correct results when the topic
* has multiple durable subscribers. Use a topic that already exists.
*/
public void testListDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile()
throws Exception {
String jndiName = "ListDurableSubscriptionsHtmlMultipleSubscribersExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
}
/**
* Common code for the listDurableSubscriptionsAfterMultipleSubscribers* tests.
*/
private void listDurableSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
ArrayList<String> expectedValues = new ArrayList<String>();
// Create some durable subscribers
createTopicSessionAndDurableSubscribers(2, jndiName);
// Set up the expected result
StringBuffer expectedBuffer1 = new StringBuffer();
expectedBuffer1.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber0")); // Id
expectedBuffer1.append(formatTableCell(DURABLE)); // Durable
expectedBuffer1.append(formatTableCell(jndiName + "Subscriber0")); // Subscription Name
expectedBuffer1.append(formatTableCell(CLIENT_ID)); // Client Id
expectedBuffer1.append(formatTableCell("")); // Selector
expectedBuffer1.append(formatTableCell("0")); // Message Count
expectedValues.add(expectedBuffer1.toString());
StringBuffer expectedBuffer2 = new StringBuffer();
expectedBuffer2.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber1")); // Id
expectedBuffer2.append(formatTableCell(DURABLE)); // Durable
expectedBuffer2.append(formatTableCell(jndiName + "Subscriber1")); // Subscription Name
expectedBuffer2.append(formatTableCell(CLIENT_ID)); // Client Id
expectedBuffer2.append(formatTableCell("")); // Selector
expectedBuffer2.append(formatTableCell("0")); // Message Count
expectedValues.add(expectedBuffer2.toString());
performListAsHtmlOperation(jndiName,
DestinationType.TOPIC,
LIST_DURABLE_SUB_AS_HTML,
Boolean.FALSE,
expectedValues);
}
/* OPERATION #10 - LIST NON DURABLE SUBSCRIPTIONS AS HTML - APPPLIES ONLY TO TOPICS */
/**
* Test Name: testListNonDurableSubscriptionsAsHTMLAfterTopicCreation
* Assertion: Make sure that the "List Non Durable Subscriptions As HTML"
* operation for topics returns the correct results after creating
* a new topic.
*/
public void testListNonDurableSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
String jndiName = "ListNonDurableSubscriptionsHtmlAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
performListAsHtmlOperationAfterCreation(jndiName,
DestinationType.TOPIC,
LIST_NON_DURABLE_SUB_AS_HTML,
Boolean.FALSE);
}
/**
* Test Name: testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribers
* Assertion: Make sure that the "List Non Durable Subscriptions As HTML"
* operation for topics returns the correct results when the topic
* has multiple non durable subscribers.
*/
public void testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribers()
throws Exception {
String jndiName = "ListNonDurableSubscriptionsHtmlAfterMultipleSubscribers";
createTopic(jndiName);
listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
}
/**
* Test Name: testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
* Assertion: Make sure that the "List Non Durable Subscriptions As HTML"
* operation for topics returns the correct results when the topic
* has multiple non durable subscribers. Use a topic that already exists.
*/
public void testListNonDurableSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile()
throws Exception {
String jndiName = "ListNonDurableSubscriptionsHtmlMultipleSubscribersExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
}
/**
* Common code for the listNonDurableSubscriptionsAfterMultipleSubscribers* tests.
*/
private void listNonDurableSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
ArrayList<String> expectedValues = new ArrayList<String>();
// Create some non durable subscribers
createTopicSessionAndNonDurableSubscribers(2, jndiName);
// Set up the expected result
StringBuffer expectedBuffer = new StringBuffer();
expectedBuffer.append(formatTableCell(NON_DURABLE)); // Durable
expectedBuffer.append(formatTableCell("")); // Subscription Name
expectedBuffer.append(formatTableCell("")); // Client Id
expectedBuffer.append(formatTableCell("")); // Selector
expectedBuffer.append(formatTableCell("0")); // Message Count
expectedValues.add(expectedBuffer.toString());
performListAsHtmlOperation(jndiName,
DestinationType.TOPIC,
LIST_NON_DURABLE_SUB_AS_HTML,
Boolean.FALSE,
expectedValues);
}
/* OPERATION #11 - LIST ALL SUBSCRIPTIONS AS HTML - APPPLIES ONLY TO TOPICS */
/**
* Test Name: testListAllSubscriptionsAsHTMLAfterTopicCreation
* Assertion: Make sure that the "List All Subscriptions As HTML"
* operation for topics returns the correct results after creating
* a new topic.
*/
public void testListAllSubscriptionsAsHTMLAfterTopicCreation() throws Exception {
String jndiName = "ListAllSubscriptionsHtmlAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
performListAsHtmlOperationAfterCreation(jndiName,
DestinationType.TOPIC,
LIST_ALL_SUB_AS_HTML,
Boolean.FALSE);
}
/**
* Test Name: testListAllSubscriptionsAsHTMLAfterMultipleSubscribers
* Assertion: Make sure that the "List All Subscriptions As HTML"
* operation for topics returns the correct results when the topic
* has multiple durable subscribers.
*/
public void testListAllSubscriptionsAsHTMLAfterMultipleSubscribers()
throws Exception {
String jndiName = "ListAllSubscriptionsHtmlAfterMultipleSubscribers";
createTopic(jndiName);
listAllSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
}
/**
* Test Name: testListAllSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile
* Assertion: Make sure that the "List All Subscriptions As HTML"
* operation for topics returns the correct results when the topic
* has multiple durable subscribers. Use a topic that already exists.
*/
public void testListAllSubscriptionsAsHTMLAfterMultipleSubscribersUsingExistingServiceFile()
throws Exception {
String jndiName = "ListAllSubscriptionsHtmlMultipleSubscribersExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
listAllSubscriptionsAsHtmlAfterMultipleSubscribers(jndiName);
}
/**
* Common code for the listAllSubscriptionsAfterMultipleSubscribers* tests.
*/
private void listAllSubscriptionsAsHtmlAfterMultipleSubscribers(String jndiName) throws Exception {
ArrayList<String> expectedValues = new ArrayList<String>();
// Create a non-durable and durable subscriber
createTopicSessionAndMultipleSubscribers(1, jndiName);
// Set up the expected result
StringBuffer expectedBuffer1 = new StringBuffer();
expectedBuffer1.append(formatTableCell(NON_DURABLE)); // Durable
expectedBuffer1.append(formatTableCell("")); // Subscription Name
expectedBuffer1.append(formatTableCell("")); // Client Id
expectedBuffer1.append(formatTableCell("")); // Selector
expectedBuffer1.append(formatTableCell("0")); // Message Count
expectedValues.add(expectedBuffer1.toString());
StringBuffer expectedBuffer2 = new StringBuffer();
expectedBuffer2.append(TABLE_ROW_DELIM);
expectedBuffer2.append(formatTableCell(CLIENT_ID + "." + jndiName + "Subscriber0")); // Id
expectedBuffer2.append(formatTableCell(DURABLE)); // Durable
expectedBuffer2.append(formatTableCell(jndiName + "Subscriber0")); // Subscription Name
expectedBuffer2.append(formatTableCell(CLIENT_ID)); // Client Id
expectedBuffer2.append(formatTableCell("")); // Selector
expectedBuffer2.append(formatTableCell("0")); // Message Count
expectedValues.add(expectedBuffer2.toString());
performListAsHtmlOperation(jndiName,
DestinationType.TOPIC,
LIST_ALL_SUB_AS_HTML,
Boolean.FALSE,
expectedValues);
}
/**
* Common code for the List*AsHTML tests.
*/
private void performListAsHtmlOperation(String jndiName,
DestinationType destinationType,
String operationName,
Boolean takesParameters,
ArrayList<String> expectedValues) throws Exception {
performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(),
jndiName, operationName, takesParameters);
// Get the result of the operation
HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_HISTORY_FORM);
HtmlTextArea resultTextArea = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']");
assertNotNull("Could not get the result of the operation", resultTextArea);
String result = resultTextArea.getText();
String shortenedResult = result.substring(result.indexOf(TABLE_CELL_DELIM),
result.lastIndexOf(TABLE_ROW_END_DELIM));
log.info("Operation result was: " + shortenedResult);
assertFalse("The result of the operation was an empty string", result.equals(""));
for(int i = 0; i < expectedValues.size(); i++) {
assertTrue("Expected the result to contain:\n\n" + expectedValues.get(i) + "\n\nbut was:\n\n" + shortenedResult,
shortenedResult.contains(expectedValues.get(i)));
}
// Clean up
disconnect();
deleteDestination(destinationType, jndiName);
}
/**
* Common code for the List*AsHTML*After*Creation tests.
*/
private void performListAsHtmlOperationAfterCreation(String jndiName,
DestinationType destinationType,
String operationName,
Boolean takesParameters) throws Exception {
performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(),
jndiName, operationName, takesParameters);
// Get the result of the operation
HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_HISTORY_FORM);
HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']");
assertNotNull("Could not get the result of the operation", resultTextBox);
String result = resultTextBox.getText();
log.info("Operation result was: " + result);
assertFalse("The result of the operation was an empty string", result.equals(""));
// Clean up
disconnect();
deleteDestination(destinationType, jndiName);
}
/* OPERATION #12 - CREATE - APPLIES TO TOPICS AND QUEUES */
// These tests are now disabled since the "Create" operation has been
// removed.
/**
* Test Name: testTopicCreateOperation
* Assertion: Make sure that the "Create" operation for topics is executed
* successfully.
*/
public void DISABLEDtestTopicCreateOperation() throws Exception {
String jndiName = "TopicCreate";
// Create the topic first
createTopic(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
CREATE, Boolean.TRUE);
}
/**
* Test Name: testTopicCreateOperationUsingExistingServiceFile
* Assertion: Make sure that the "Create" operation for topics is executed
* successfully. Use a topic that already exists.
*/
public void DISABLEDtestTopicCreateOperationUsingExistingServiceFile() throws Exception {
String jndiName = "CreateOperationExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
CREATE, Boolean.TRUE);
}
/**
* Test Name: testQueueCreateOperation
* Assertion: Make sure that the "Create" operation for queues is executed
* successfully.
*/
public void DISABLEDtestQueueCreateOperation() throws Exception {
String jndiName = "QueueCreate";
// Create the queue first
createQueue(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
CREATE, Boolean.TRUE);
}
/**
* Test Name: testQueueCreateOperationUsingExistingServiceFile
* Assertion: Make sure that the "Create" operation for queues is executed
* successfully. Use a queue that already exists.
*/
public void DISABLEDtestQueueCreateOperationUsingExistingServiceFile() throws Exception {
String jndiName = "CreateOperationExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
CREATE, Boolean.TRUE);
}
/* OPERATION #13 - START - APPLIES TO TOPICS AND QUEUES */
/**
* Test Name: testTopicStartOperation
* Assertion: Make sure that the "Start" operation for topics is executed
* successfully.
*/
public void testTopicStartOperation() throws Exception {
String jndiName = "TopicStart";
// Create the topic first
createTopic(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
START, Boolean.TRUE);
}
/**
* Test Name: testTopicStartOperationUsingExistingServiceFile
* Assertion: Make sure that the "Start" operation for topics is executed
* successfully. Use a topic that already exists.
*/
public void testTopicStartOperationUsingExistingServiceFile() throws Exception {
String jndiName = "StartOperationExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
START, Boolean.TRUE);
}
/**
* Test Name: testQueueStartOperation
* Assertion: Make sure that the "Start" operation for queues is executed
* successfully.
*/
public void testQueueStartOperation() throws Exception {
String jndiName = "QueueStart";
// Create the queue first
createQueue(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
START, Boolean.TRUE);
}
/**
* Test Name: testQueueStartOperationUsingExistingServiceFile
* Assertion: Make sure that the "Start" operation for queues is executed
* successfully. Use a queue that already exists.
*/
public void testQueueStartOperationUsingExistingServiceFile() throws Exception {
String jndiName = "StartOperationExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
START, Boolean.TRUE);
}
/* OPERATION #14 - DESTROY - APPLIES TO TOPICS AND QUEUES */
// These tests are now disabled since the "Destroy" operation has been
// removed.
/**
* Test Name: testTopicDestroyOperation
* Assertion: Make sure that the "Destroy" operation for topics is executed
* successfully.
*/
public void DISABLEDtestTopicDestroyOperation() throws Exception {
String jndiName = "TopicDestroy";
// Create the topic first
createTopic(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
DESTROY, Boolean.FALSE);
}
/**
* Test Name: testTopicDestroyOperationUsingExistingServiceFile
* Assertion: Make sure that the "Destroy" operation for topics is executed
* successfully. Use a topic that already exists.
*/
public void DISABLEDtestTopicDestroyOperationUsingExistingServiceFile() throws Exception {
String jndiName = "DestroyOperationExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
DESTROY, Boolean.FALSE);
}
/**
* Test Name: testQueueDestroyOperation
* Assertion: Make sure that the "Destroy" operation for queues is executed
* successfully.
*/
public void DISABLEDtestQueueDestroyOperation() throws Exception {
String jndiName = "QueueDestroy";
// Create the queue first
createQueue(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
DESTROY, Boolean.FALSE);
}
/**
* Test Name: testQueueDestroyOperationUsingExistingServiceFile
* Assertion: Make sure that the "Destroy" operation for queues is executed
* successfully. Use a queue that already exists.
*/
public void DISABLEDtestQueueDestroyOperationUsingExistingServiceFile() throws Exception {
String jndiName = "DestroyOperationExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
DESTROY, Boolean.FALSE);
}
/* OPERATION #15 - STOP - APPLIES TO TOPICS AND QUEUES */
/**
* Test Name: testTopicStopOperation
* Assertion: Make sure that the "Stop" operation for topics is executed
* successfully.
*/
public void testTopicStopOperation() throws Exception {
String jndiName = "TopicStop";
// Create the topic first
createTopic(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
STOP, Boolean.FALSE);
}
/**
* Test Name: testTopicStopOperationUsingExistingServiceFile
* Assertion: Make sure that the "Stop" operation for topics is executed
* successfully. Use a topic that already exists.
*/
public void testTopicStopOperationUsingExistingServiceFile() throws Exception {
String jndiName = "StopOperationExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.TOPIC,
STOP, Boolean.FALSE);
}
/**
* Test Name: testQueueStopOperation
* Assertion: Make sure that the "Stop" operation for queues is executed
* successfully.
*/
public void testQueueStopOperation() throws Exception {
String jndiName = "QueueStop";
// Create the queue first
createQueue(jndiName);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
STOP, Boolean.FALSE);
}
/**
* Test Name: testQueueStopOperationUsingExistingServiceFile
* Assertion: Make sure that the "Stop" operation for queues is executed
* successfully. Use a queue that already exists.
*/
public void testQueueStopOperationUsingExistingServiceFile() throws Exception {
String jndiName = "StopOperationExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
performServletLifecycleOperation(jndiName, DestinationType.QUEUE,
STOP, Boolean.FALSE);
}
/* OPERATION #16 - LIST ALL MESSAGES - APPLIES TO TOPICS AND QUEUES */
/**
* Test Name: testListAllMessagesAfterTopicCreation
* Assertion: Make sure that the "List All Messages" operation for topics
* returns the correct results after creating a new topic.
*/
public void testListAllMessagesAfterTopicCreation() throws Exception {
String jndiName = "ListAllMessagesAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
// Some message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "0");
expectedMetrics.put(DURABLE_MSG_COUNT, "0");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0");
expectedMetrics.put(ALL_SUB_COUNT, "0");
performListMessages(jndiName, DestinationType.TOPIC, LIST_ALL_MSGS,
0, Boolean.FALSE, null, expectedMetrics);
}
/**
* Test Name: testTopicListAllMessagesAfterMultipleMessages
* Assertion: Make sure that the "List All Messages" operation for topics
* returns the correct results when the topic has multiple messages.
*/
public void testTopicListAllMessagesAfterMultipleMessages() throws Exception {
String jndiName = "TopicListAllMessagesAfterMultipleMessages";
// Create the topic first
createTopic(jndiName);
performTopicListAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testTopicListAllMessagesAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Make sure that the "List All Messages" operation for topics
* returns the correct results when the topic has multiple messages.
* Use a topic that already exists.
*/
public void testTopicListAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ListAllMessagesMultipleMessagesExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
performTopicListAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testTopicListAllMessagesAfterMultipleMessages*
* tests.
*/
private void performTopicListAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
TopicSession session = createTopicSession();
Topic topic = getTopic(jndiName);
// Send some messages to the topic
createDurableTopicSubscriber(session, topic, jndiName);
publishMessages(session, topic, 3);
// The operation parameters
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put(ARG_0, CLIENT_ID + "." + jndiName);
// Message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "3");
expectedMetrics.put(DURABLE_MSG_COUNT, "3");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0");
expectedMetrics.put(ALL_SUB_COUNT, "1");
performListMessages(jndiName, DestinationType.TOPIC, LIST_ALL_MSGS,
3, Boolean.TRUE, parametersMap, expectedMetrics);
}
/**
* Test Name: testListAllMessagesAfterQueueCreation
* Assertion: Make sure that the "List All Messages" operation for queues
* returns the correct results after creating a new queue.
*/
public void testListAllMessagesAfterQueueCreation() throws Exception {
String jndiName = "ListAllMessagesAfterQueueCreation";
// Create the queue first
createQueue(jndiName);
// Some message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "0");
performListMessages(jndiName, DestinationType.QUEUE, LIST_ALL_MSGS,
0, Boolean.FALSE, null, expectedMetrics);
}
/**
* Test Name: testQueueListAllMessagesAfterMultipleMessages
* Assertion: Make sure that the "List All Messages" operation for queues
* returns the correct results when the queue has multiple messages.
*/
public void testQueueListAllMessagesAfterMultipleMessages() throws Exception {
String jndiName = "QueueListAllMessagesAfterMultipleMessages";
// Create the queue first
createQueue(jndiName);
performQueueListAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testQueueListAllMessagesAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Make sure that the "List All Messages" operation for queues
* returns the correct results when the queue has multiple messages.
* Use a queue that already exists.
*/
public void testQueueListAllMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ListAllMessagesMultipleMessagesExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
performQueueListAllMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testQueueListAllMessagesAfterMultipleMessages*
* tests.
*/
private void performQueueListAllMessagesAfterMultipleMessages(String jndiName) throws Exception {
QueueSession session = createQueueSession();
Queue queue = getQueue(jndiName);
// Send 1 durable message and 1 non-durable message
sendMessagesAndSpecifyDeliveryMode(session, queue, 1, DeliveryMode.PERSISTENT);
sendMessagesAndSpecifyDeliveryMode(session, queue, 1, DeliveryMode.NON_PERSISTENT);
// The operation parameters
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put(ARG_0, EMBJOPR_TEST_SELECTOR);
// Some message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "2");
performListMessages(jndiName, DestinationType.QUEUE, LIST_ALL_MSGS,
2, Boolean.TRUE, parametersMap, expectedMetrics);
}
/* OPERATION #17 - LIST DURABLE MESSAGES - APPLIES TO TOPICS AND QUEUES */
/**
* Test Name: testListDurableMessagesAfterTopicCreation
* Assertion: Make sure that the "List Durable Messages" operation for topics
* returns the correct results after creating a new topic.
*/
public void testListDurableMessagesAfterTopicCreation() throws Exception {
String jndiName = "ListDurableMessagesAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
// Message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "0");
expectedMetrics.put(DURABLE_MSG_COUNT, "0");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0");
expectedMetrics.put(ALL_SUB_COUNT, "0");
performListMessages(jndiName, DestinationType.TOPIC, LIST_DURABLE_MSGS,
0, Boolean.FALSE, null, expectedMetrics);
}
/**
* Test Name: testTopicListDurableMessagesAfterMultipleMessages
* Assertion: Make sure that the "List Durable Messages" operation for topics
* returns the correct results when the topic has multiple messages.
*/
public void testTopicListDurableMessagesAfterMultipleMessages() throws Exception {
String jndiName = "TopicListDurableMessagesAfterMultipleMessages";
// Create the topic first
createTopic(jndiName);
performTopicListDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testTopicListDurableMessagesAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Make sure that the "List Durable Messages" operation for topics
* returns the correct results when the topic has multiple messages.
* Use a topic that already exists.
*/
public void testTopicListDurableMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ListDurableMessagesMultipleMessagesExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
performTopicListDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testTopicListDurableMessagesAfterMultipleMessages* tests.
*/
private void performTopicListDurableMessagesAfterMultipleMessages(String jndiName) throws Exception {
TopicSession session = createTopicSession();
Topic topic = getTopic(jndiName);
// Create a durable subscriber and send some messages to the topic
createDurableTopicSubscriber(session, topic, jndiName);
publishMessages(session, topic, 2);
// The operation parameters
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put(ARG_0, CLIENT_ID + "." + jndiName);
// Message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "2");
expectedMetrics.put(DURABLE_MSG_COUNT, "2");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0");
expectedMetrics.put(ALL_SUB_COUNT, "1");
performListMessages(jndiName, DestinationType.TOPIC, LIST_DURABLE_MSGS,
2, Boolean.TRUE, parametersMap, expectedMetrics);
}
/**
* Test Name: testListDurableMessagesAfterQueueCreation
* Assertion: Make sure that the "List Durable Messages" operation for
* queues returns the correct results after creating a new queue.
*/
public void testListDurableMessagesAfterQueueCreation() throws Exception {
String jndiName = "ListDurableMessagesAfterQueueCreation";
// Create the queue first
createQueue(jndiName);
// Some message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "0");
performListMessages(jndiName, DestinationType.QUEUE, LIST_DURABLE_MSGS,
0, Boolean.FALSE, null, expectedMetrics);
}
/**
* Test Name: testQueueListDurableMessagesAfterMultipleMessages
* Assertion: Make sure that the "List Durable Messages" operation for queues
* returns the correct results when the queue has multiple messages.
*/
public void testQueueListDurableMessagesAfterMultipleMessages() throws Exception {
String jndiName = "QueueListDurableMessagesAfterMultipleMessages";
// Create the queue first
createQueue(jndiName);
performQueueListDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testQueueListDurableMessagesAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Make sure that the "List Durable Messages" operation for queues
* returns the correct results when the queue has multiple messages. Use a queue
* that already exists.
*/
public void testQueueListDurableMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ListDurableMessagesMultipleMessagesExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
performQueueListDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testQueueListDurableMessagesAfterMultipleMessages* tests.
*/
private void performQueueListDurableMessagesAfterMultipleMessages(String jndiName) throws Exception {
// Send some durable messages to the queue
createQueueSessionAndSendMessages(2, jndiName);
// The operation parameters
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put(ARG_0, EMBJOPR_TEST_SELECTOR);
// Some message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "2");
performListMessages(jndiName, DestinationType.QUEUE, LIST_DURABLE_MSGS,
2, Boolean.TRUE, parametersMap, expectedMetrics);
}
/* OPERATION #18 - LIST NON DURABLE MESSAGES - APPLIES TO TOPICS AND QUEUES */
/**
* Test Name: testListNonDurableMessagesAfterTopicCreation
* Assertion: Make sure that the "List Non Durable Messages" operation for
* topics returns the correct results after creating a new topic.
*/
public void testListNonDurableMessagesAfterTopicCreation() throws Exception {
String jndiName = "ListNonDurableMessagesAfterTopicCreation";
// Create the topic first
createTopic(jndiName);
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "0");
expectedMetrics.put(DURABLE_MSG_COUNT, "0");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "0");
expectedMetrics.put(ALL_SUB_COUNT, "0");
performListMessages(jndiName, DestinationType.TOPIC, LIST_NON_DURABLE_MSGS,
0, Boolean.FALSE, null, expectedMetrics);
}
/**
* Test Name: testTopicListNonDurableMessagesAfterMultipleMessages
* Assertion: Make sure that the "List Non Durable Messages" operation for
* topics returns the correct results when the topic has multiple messages.
*/
public void testTopicListNonDurableMessagesAfterMultipleMessages() throws Exception {
String jndiName = "TopicListNonDurableMessagesAfterMultipleMessages";
// Create the topic first
createTopic(jndiName);
performTopicListNonDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testTopicListNonDurableMessagesAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Make sure that the "List Non Durable Messages" operation for
* topics returns the correct results when the topic has multiple messages.
* Use a topic that already exists.
*/
public void testTopicListNonDurableMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ListNonDurableMessagesMultipleMessagesExistingTopic";
expandNavTreeArrow(JMS_NAV_LABEL);
performTopicListNonDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testTopicListNonDurableMessagesAfterMultipleMessages* tests.
*/
private void performTopicListNonDurableMessagesAfterMultipleMessages(String jndiName) throws Exception {
createTopicSessionAndSendNonDurableMessages(2, jndiName);
// Get the subscription ID to pass as a parameter to "List Non Durable Messages"
String subID = getSubID(jndiName);
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put(ARG_0, subID);
// Message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(ALL_MSG_COUNT, "2");
expectedMetrics.put(DURABLE_MSG_COUNT, "0");
expectedMetrics.put(NON_DURABLE_MSG_COUNT, "2");
expectedMetrics.put(ALL_SUB_COUNT, "1");
performListMessages(jndiName, DestinationType.TOPIC, LIST_NON_DURABLE_MSGS,
2, Boolean.TRUE, parametersMap, expectedMetrics);
}
/**
* Get the subscription id of a topic subscriber.
*/
private String getSubID(String jndiName) throws MalformedObjectNameException, JMException, IOException {
JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
ObjectName deploymentMBean = new ObjectName("jboss.messaging.destination:name="
+ jndiName + ",service="
+ DestinationType.TOPIC.getName());
Object messageCounters = jmxUtils.getMBeanAttribute(deploymentMBean, "MessageCounters");
assertTrue(((List<MessageCounter>)messageCounters).size() == 1);
// Get the subscription ID
String subID = "";
MessageCounter mc = ((List<MessageCounter>)messageCounters).get(0);
String mcString = mc.getCounterAsString();
String temp = mcString.substring(mcString.indexOf(".") + 1);
subID = temp.substring(0, temp.indexOf(","));
return subID;
}
/**
* Test Name: testListNonDurableMessagesAfterQueueCreation
* Assertion: Make sure that the "List Non Durable Messages" operation for
* queues returns the correct results after creating a new queue.
*/
public void testListNonDurableMessagesAfterQueueCreation() throws Exception {
String jndiName = "ListNonDurableMessagesAfterQueueCreation";
// Create the queue first
createQueue(jndiName);
// Some message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "0");
performListMessages(jndiName, DestinationType.QUEUE, LIST_NON_DURABLE_MSGS,
0, Boolean.FALSE, null, expectedMetrics);
}
/**
* Test Name: testQueueListNonDurableMessagesAfterMultipleMessages
* Assertion: Make sure that the "List Non Durable Messages" operation for
* queues returns the correct results when the queue has multiple messages.
*/
public void testQueueListNonDurableMessagesAfterMultipleMessages() throws Exception {
String jndiName = "QueueListNonDurableMessagesAfterMultipleMessages";
// Create the queue first
createQueue(jndiName);
performQueueListNonDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Test Name: testQueueListNonDurableMessagesAfterMultipleMessagesUsingExistingServiceFile
* Assertion: Make sure that the "List Non Durable Messages" operation for
* queues returns the correct results when the queue has multiple messages.
* Use a queue that already exists.
*/
public void testQueueListNonDurableMessagesAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
String jndiName = "ListNonDurableMessagesMultipleMessagesExistingQueue";
expandNavTreeArrow(JMS_NAV_LABEL);
performQueueListNonDurableMessagesAfterMultipleMessages(jndiName);
}
/**
* Common code for the testQueueListNonDurableMessagesAfterMultipleMessages* tests.
*/
private void performQueueListNonDurableMessagesAfterMultipleMessages(String jndiName) throws Exception {
QueueSession session = createQueueSession();
Queue queue = getQueue(jndiName);
// Send some non-durable messages to the queue
sendMessagesAndSpecifyDeliveryMode(session, queue, 2, DeliveryMode.NON_PERSISTENT);
Map<String, String> parametersMap = new HashMap<String, String>();
parametersMap.put(ARG_0, EMBJOPR_TEST_SELECTOR);
// Some message counts to check before performing the operation
Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
expectedMetrics.put(CONSUMER_COUNT, "0");
expectedMetrics.put(MSG_COUNT, "2");
performListMessages(jndiName, DestinationType.QUEUE, LIST_NON_DURABLE_MSGS,
2, Boolean.TRUE, parametersMap, expectedMetrics);
}
/**
* Common code for the List*Messages tests.
*/
private void performListMessages(String jndiName,
DestinationType destinationType,
String operationName,
int expectedNumMessages,
boolean useParameters,
Map<String, String> parametersMap,
Map<String, String> expectedMetrics) throws Exception {
// Check some message metrics before performing the operation
ArrayList<String> summaryMetrics = new ArrayList<String>();
if(destinationType == DestinationType.TOPIC) {
summaryMetrics = getTopicSummaryMetrics();
} else {
summaryMetrics = getQueueSummaryMetrics();
}
checkResourceMetrics(JMS_NAV_LABEL, destinationType.getNavLabel(),
jndiName, expectedMetrics, summaryMetrics);
// Invoke the operation and check the results
if(useParameters) {
performResourceOperationWithParameters(JMS_NAV_LABEL, destinationType.getNavLabel(),
jndiName, operationName, parametersMap);
} else {
performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(),
jndiName, operationName, Boolean.TRUE);
}
checkListMessagesTable(expectedNumMessages);
// Clean up
disconnect();
deleteDestination(destinationType, jndiName);
}
/**
* Make sure the correct number of messages gets displayed in the
* output of the "List * Messages" operations.
*/
private void checkListMessagesTable(int expectedNumMessages) {
// Get the result of the operation
HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_HISTORY_FORM);
HtmlTable resultsTable = (HtmlTable)historyPanel.getFirstByXPath(".//table[@class='property-map-summary-table']");
assertNotNull("Could not get the result of the operation", resultsTable);
List<HtmlTableRow> rows = resultsTable.getRows();
// Don't include the header row
int numMessages = rows.size() - 1;
String emptyTableMessage = "";
if((numMessages == 0) && (expectedNumMessages > 0)) {
emptyTableMessage = "An empty table was displayed - ";
}
if( expectedNumMessages != numMessages ){
String msg = emptyTableMessage + "Incorrect number of messages displayed in the results table." +
" Expected: "+expectedNumMessages+" Actual: "+numMessages+"; Page dumped.";
new EmbJoprTestException(msg, this);
fail(msg);
}
Iterator i = rows.iterator();
int rowNum = 0;
// The table should contain these columns: "JMS Correlation ID", "JMS Message ID",
// and "JMS Timestamp"
while(i.hasNext()) {
HtmlTableRow row = (HtmlTableRow)i.next();
String jmsCorrelationID = ((HtmlTableCell)row.getCell(JMS_CORRELATION_ID)).asText();
String jmsMessageID = ((HtmlTableCell)row.getCell(JMS_MESSAGE_ID)).asText();
assertNotNull("The JMS Message ID was null", jmsMessageID);
String jmsTimestamp = ((HtmlTableCell)row.getCell(JMS_TIMESTAMP)).asText();
assertNotNull("The JMS Timestamp was null", jmsTimestamp);
log.info("Row " + rowNum + ": ");
log.info("JMS Correlation ID: " + jmsCorrelationID);
log.info("JMS Message ID: " + jmsMessageID);
log.info("JMS Timestamp: " + jmsTimestamp);
rowNum = rowNum + 1;
}
}
/**
* Common code for the Create/Start/Stop/Destroy operations.
*/
private void performServletLifecycleOperation(String jndiName,
DestinationType destinationType,
String operationName,
Boolean isActiveDestination) throws Exception {
performResourceOperation(JMS_NAV_LABEL, destinationType.getNavLabel(),
jndiName, operationName, Boolean.FALSE);
// Make sure the correct parameters ("None") and the
// the correct results ("None") are displayed
checkNoParametersAndNoResults();
// Make sure the list of active destinations is updated,
// if necessary
JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
ObjectName deploymentMBean = new ObjectName("jboss.messaging:service=ServerPeer");
Object activeDestinations = jmxUtils.getMBeanAttribute(deploymentMBean, "Destinations");
Boolean inActiveDestinationsList = false;
Iterator i = ((Set)activeDestinations).iterator();
while(i.hasNext()) {
JBossDestination destination = (JBossDestination)i.next();
if(destination.getName().equals(jndiName)) {
inActiveDestinationsList = true;
break;
}
}
String errorMessage;
if(isActiveDestination) {
errorMessage = "The destination was not in the list of active destinations";
} else {
errorMessage = "The destination should not be in the list of active destinations";
}
assertEquals(errorMessage, isActiveDestination, inActiveDestinationsList);
// Make sure the "Status" of the destination is correctly displayed in
// the destinations table (see JOPR-198)
String expectedStatus = "";
// The operation will be "Start" or "Stop"
if(operationName.equals(START)) {
expectedStatus = UP;
} else {
expectedStatus = DOWN;
}
clickNavTreeLink(destinationType.getNavLabel());
ContentTableRow destinationRow = ejtt.getTabMenu().getTabContentBox().
findLinkRowInDataTableUsingPagination(jndiName);
assertNotNull("Row containing '" + jndiName + "' was not found in the table", destinationRow);
String actualStatus = destinationRow.getCellTextByColumnName(STATUS);
assertEquals("The status of the destination is not correct: ", expectedStatus, actualStatus);
// Clean up
disconnect();
deleteDestination(destinationType, jndiName);
}
/**
* Common code for the list subscriptions tests.
*
* @param shouldBeEmpty - whether or not the list of subscriptions that
* gets displayed should be empty
*
* FAILS: This got implemented as structured result; before, it was only a string.
* "Viewing/editing of lists ... not supported. Here's the list's toString() value for now: []"
* See: JOPR-141
* Affects: testTopicListAllSubscriptions*
*/
private void performListSubscriptionsAndCheckResults(String jndiName,
String operationName,
Boolean shouldBeEmpty) throws Exception {
performResourceOperation(JMS_NAV_LABEL, DestinationType.TOPIC.getNavLabel(),
jndiName, operationName, Boolean.FALSE);
//fail("Operation result used to be toString(), now it's a table. Need to fix the test method.");
/*
String actualOperationResults = ((HtmlDivision)client.getElement(OPERATION_RESULTS)).getTextContent();
String shortenedResult = actualOperationResults.substring(actualOperationResults.indexOf("Viewing"),
actualOperationResults.indexOf("]") + 1);
log.info("Operation result was: " + shortenedResult);
if(!shouldBeEmpty) {
assertFalse("Expected non-empty list but was: '" + shortenedResult + "'",
actualOperationResults.contains(EMPTY_LIST));
} else {
assertTrue("Expected empty list but was: '" + shortenedResult + "'",
actualOperationResults.contains(EMPTY_LIST));
}
/**/
// Find the result values table.
HtmlDivision opResDiv = (HtmlDivision) client.getElement("operationResults");
log.debug("opRes div: "+opResDiv.getTextContent());
final String xPath = ".//table[ contains( @class, 'properties-table' ) ]//table[ contains( @class, 'property-map-summary-table' ) ]";
ContentTable opResultTable = ejtt.getTable((HtmlTable) opResDiv.getFirstByXPath(xPath) );
if( null == opResultTable )
throw new org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException("Can't find operation result table: "+xPath, this);
log.debug("property-map-summary-table: "+opResultTable.getElement().getTextContent());
// Get the rows and list them.
List<ContentTableRow> rows = opResultTable.getRows();
int subscCount = rows.size() -1;
log.info("List contains "+subscCount+" subscriptions.");
for( ContentTableRow row : rows ) {
if( row.isHeader() )
continue;
// Id Durable Message Count Actions
String rowInfo = String.format(" Id: '%s' Durable: '%s' Message Count: '%s' Actions: '%s'",
row.getCellTextByColumnName("Id"),
row.getCellTextByColumnName("Durable"),
row.getCellTextByColumnName("Message Count"),
row.getCellTextByColumnName("Actions"));
log.info(" * "+ rowInfo );
}
// Check whether the list is empty / non-empty as expected.
if(shouldBeEmpty) {
if( subscCount != 0 ){
throw new EmbJoprTestException("Expected empty list but found "+subscCount+" subscriptions. See the log for more info. Page dumped.", this);
}
} else {
if( subscCount <= 0 ){
throw new EmbJoprTestException("Expected non-empty list. See the log for more info. Page dumped.", this);
}
}
// Clean up
disconnect();
deleteDestination(DestinationType.TOPIC, jndiName);
}
/**
* Common code for the operations tests.
*/
private void performDestinationOperationAndCheckMetrics(DestinationType destinationType,
String jndiName,
String operationName,
Map<String, String> expectedMetrics,
ArrayList<String> summaryMetrics) throws Exception {
performResourceOperationAndCheckMetrics(JMS_NAV_LABEL, destinationType.getNavLabel(),
jndiName, operationName, expectedMetrics,
summaryMetrics, Boolean.FALSE);
// Clean up
disconnect();
deleteDestination(destinationType, jndiName);
}
}