[embjopr-commits] EMBJOPR SVN: r251 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit/as5 and 1 other directories.
embjopr-commits at lists.jboss.org
embjopr-commits at lists.jboss.org
Mon Mar 23 10:24:42 EDT 2009
Author: fjuma
Date: 2009-03-23 10:24:42 -0400 (Mon, 23 Mar 2009)
New Revision: 251
Added:
trunk/jsfunit/testdata/destinations/MetricsOneQueueReceiverExistingQueue-service.xml
trunk/jsfunit/testdata/destinations/QueueMetricsMultipleMessagesExistingQueue-service.xml
trunk/jsfunit/testdata/destinations/QueueMetricsOneMessageExistingQueue-service.xml
trunk/jsfunit/testdata/destinations/QueueMetricsReceiveMessageExistingQueue-service.xml
trunk/jsfunit/testdata/destinations/QueueMetricsScheduledMessagesExistingQueue-service.xml
trunk/jsfunit/testdata/destinations/QueueMetricsTimeLastUpdateExistingQueue-service.xml
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
Log:
Adding metrics tests for queues.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-21 00:54:16 UTC (rev 250)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-23 14:24:42 UTC (rev 251)
@@ -240,10 +240,9 @@
String id = metric.getIdAttribute();
// An example id is: dataTable:0:j_id118:2:j_id119
- String[] idElements = id.split(":");
- String rowNum = idElements[idElements.length - 2];
- return ((HtmlTableCell)client.getElement(rowNum
- + ":measurementValue")).asText();
+ // We would need: dataTable:0:j_id118:2:measurementValue
+ return ((HtmlTableCell)client.getElement(id.substring(0, id.lastIndexOf(":"))
+ + ":measurementValue")).asText();
}
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java 2009-03-21 00:54:16 UTC (rev 250)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java 2009-03-23 14:24:42 UTC (rev 251)
@@ -51,6 +51,9 @@
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.QueueReceiver;
import javax.jms.ConnectionFactory;
import javax.jms.TextMessage;
import javax.jms.JMSException;
@@ -119,6 +122,8 @@
private static final String DEPTH_DELTA = "Depth Delta";
private static final String TIME_LAST_UPDATE = "Time Last Update";
+ private static final long SCHEDULED_TIME = 3600000;
+
private TopicConnection topicConnection = null;
private QueueConnection queueConnection = null;
@@ -215,7 +220,7 @@
topicConnection.setClientID(CLIENT_ID);
TopicSession topicSession = topicConnection.createTopicSession(Boolean.FALSE,
- TopicSession.AUTO_ACKNOWLEDGE);
+ TopicSession.AUTO_ACKNOWLEDGE);
topicConnection.start();
return topicSession;
@@ -226,7 +231,7 @@
*/
protected TopicSubscriber createNonDurableTopicSubscriber(TopicSession session,
Topic topic) throws JMSException {
- return session.createSubscriber(topic);
+ return session.createSubscriber(topic);
}
/**
@@ -235,7 +240,7 @@
protected TopicSubscriber createDurableTopicSubscriber(TopicSession session,
Topic topic,
String subscriptionName) throws JMSException {
- return session.createDurableSubscriber(topic, subscriptionName);
+ return session.createDurableSubscriber(topic, subscriptionName);
}
/**
@@ -259,13 +264,90 @@
* Lookup and return the topic given by jndiName.
*/
protected Topic getTopic(String jndiName) throws NamingException {
+ InitialContext context = new InitialContext();
+ Topic topic = (Topic)context.lookup(jndiName);
+
+ return topic;
+ }
+
+ /**
+ * Create a queue session and return it.
+ */
+ protected QueueSession createQueueSession() throws Exception {
InitialContext context = new InitialContext();
- Topic topic = (Topic)context.lookup(jndiName);
+ Object tmp = context.lookup(QUEUE_FACTORY);
- return topic;
+ QueueConnectionFactory qcf = (QueueConnectionFactory)tmp;
+ queueConnection = qcf.createQueueConnection();
+
+ QueueSession queueSession = queueConnection.createQueueSession(Boolean.FALSE,
+ QueueSession.AUTO_ACKNOWLEDGE);
+ queueConnection.start();
+
+ return queueSession;
}
/**
+ * Create a QueueReceiver and return it.
+ */
+ protected QueueReceiver createQueueReceiver(QueueSession session,
+ Queue queue) throws JMSException {
+ return session.createReceiver(queue);
+ }
+
+ /**
+ * Create a QueueSender for the given queue and send the
+ * given number of messages.
+ */
+ protected void sendMessages(QueueSession session,
+ Queue queue,
+ int numMessages) throws JMSException {
+
+ QueueSender sender = session.createSender(queue);
+
+ for(int i = 0; i < numMessages; i++) {
+ TextMessage message = session.createTextMessage("Message " + i);
+ sender.send(message);
+ }
+
+ sender.close();
+ }
+
+ /**
+ * Create a QueueSender for the given queue and schedule the
+ * given number of messages.
+ */
+ protected void sendScheduledMessages(QueueSession session,
+ Queue queue,
+ int numMessages) throws JMSException {
+ QueueSender sender = session.createSender(queue);
+
+ for(int i = 0; i < numMessages; i++) {
+
+ // Schedule the message
+ TextMessage message = session.createTextMessage("Message " + i);
+
+ long now = System.currentTimeMillis();
+ message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", now + SCHEDULED_TIME);
+
+ sender.send(message);
+ }
+
+ sender.close();
+ }
+
+ /**
+ * Lookup and return the queue given by jndiName.
+ */
+ protected Queue getQueue(String jndiName) throws NamingException {
+ InitialContext context = new InitialContext();
+ Queue queue = (Queue)context.lookup(jndiName);
+
+ return queue;
+ }
+
+
+ /**
* Close all connections.
*/
protected void disconnect() throws JMSException {
@@ -702,7 +784,7 @@
TOPIC_COMPONENT_TYPE, propertiesMapChanges,
propertiesMap);
}
-
+
/**
* Test Name: testConfigureQueueChangeProperties
* Assertion: Verify the ability to change queue property values.
@@ -1168,6 +1250,344 @@
}
/**
+ * Test Name: testQueueMetricsAfterCreation
+ * Assertion: Verify that queue metrics are correct after queue
+ * creation.
+ */
+ public void testQueueMetricsAfterCreation() throws Exception {
+ String jndiName = "MetricsAfterQueueCreation";
+
+ // Create the queue first
+ createQueue(jndiName);
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+ expectedMetrics.put(CONSUMER_COUNT, "0.0");
+ expectedMetrics.put(DELIVERING_COUNT, "0.0");
+ expectedMetrics.put(MSG_COUNT, "0.0");
+ expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+ expectedMetrics.put(COUNT, "0.0");
+ expectedMetrics.put(COUNT_DELTA, "0.0");
+ expectedMetrics.put(DEPTH, "0.0");
+ expectedMetrics.put(DEPTH_DELTA, "0.0");
+ expectedMetrics.put(TIME_LAST_UPDATE, "0.0");
+
+ checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+ DestinationType.QUEUE);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterCreatingReceiver
+ * Assertion: Verify that queue metrics are correct after creating
+ * a queue receiver.
+ */
+ public void testQueueMetricsAfterCreatingReceiver() throws Exception {
+ String jndiName = "MetricsAfterQueueReceiver";
+
+ // Create the queue first
+ createQueue(jndiName);
+
+ checkQueueMetricsAfterCreatingReceiver(jndiName);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterCreatingReceiverUsingExistingServiceFile
+ * Assertion: Verify that queue metrics are correct after creating
+ * a queue receiver. Use a queue that already exists.
+ */
+ public void testQueueMetricsAfterCreatingReceiverUsingExistingServiceFile() throws Exception {
+ String jndiName = "MetricsOneQueueReceiverExistingQueue";
+
+ expandNavTreeArrow(JMS_NAV_LABEL);
+ checkQueueMetricsAfterCreatingReceiver(jndiName);
+ }
+
+ /**
+ * Common code for the testQueueMetricsAfterCreatingReceiver* tests.
+ */
+ private void checkQueueMetricsAfterCreatingReceiver(String jndiName) throws Exception {
+
+ // Create a receiver
+ QueueSession session = createQueueSession();
+ Queue queue = getQueue(jndiName);
+ createQueueReceiver(session, queue);
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+ expectedMetrics.put(CONSUMER_COUNT, "1.0");
+ expectedMetrics.put(DELIVERING_COUNT, "0.0");
+ expectedMetrics.put(MSG_COUNT, "0.0");
+ expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+ expectedMetrics.put(COUNT, "0.0");
+ expectedMetrics.put(COUNT_DELTA, "0.0");
+ expectedMetrics.put(DEPTH, "0.0");
+ expectedMetrics.put(DEPTH_DELTA, "0.0");
+ expectedMetrics.put(TIME_LAST_UPDATE, "0.0");
+
+ checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+ DestinationType.QUEUE);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterOneMessage
+ * Assertion: Verify that queue metrics are correct after sending
+ * a message to the queue.
+ */
+ public void testQueueMetricsAfterOneMessage() throws Exception {
+ String jndiName = "QueueMetricsAfterOneMessage";
+
+ // Create the queue first
+ createQueue(jndiName);
+
+ checkQueueMetricsAfterOneMessage(jndiName);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterOneMessageUsingExistingServiceFile
+ * Assertion: Verify that queue metrics are correct after sending
+ * a message to the queue. Use a queue that already exists.
+ */
+ public void testQueueMetricsAfterOneMessageUsingExistingServiceFile() throws Exception {
+ String jndiName = "QueueMetricsOneMessageExistingQueue";
+
+ expandNavTreeArrow(JMS_NAV_LABEL);
+ checkQueueMetricsAfterOneMessage(jndiName);
+ }
+
+ /**
+ * Common code for the testQueueMetricsAfterOneMessage* tests.
+ */
+ private void checkQueueMetricsAfterOneMessage(String jndiName) throws Exception {
+
+ // Send 1 message to the queue
+ QueueSession session = createQueueSession();
+ Queue queue = getQueue(jndiName);
+ sendMessages(session, queue, 1);
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+ expectedMetrics.put(CONSUMER_COUNT, "0.0");
+ expectedMetrics.put(DELIVERING_COUNT, "0.0");
+ expectedMetrics.put(MSG_COUNT, "1.0");
+ expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+ expectedMetrics.put(COUNT, "1.0");
+ expectedMetrics.put(COUNT_DELTA, "1.0");
+ expectedMetrics.put(DEPTH, "1.0");
+ expectedMetrics.put(DEPTH_DELTA, "1.0");
+
+ checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+ DestinationType.QUEUE);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterMulipleMessages
+ * Assertion: Verify that queue metrics are correct after sending
+ * multiple messages to the queue.
+ */
+ public void testQueueMetricsAfterMultipleMessages() throws Exception {
+ String jndiName = "QueueMetricsAfterMultipleMessages";
+
+ // Create the queue first
+ createQueue(jndiName);
+
+ checkQueueMetricsAfterMultipleMessages(jndiName);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterMulipleMessagesUsingExistingServiceFile
+ * Assertion: Verify that queue metrics are correct after sending
+ * multiple messages to the queue. Use a queue that already exists.
+ */
+ public void testQueueMetricsAfterMultipleMessagesUsingExistingServiceFile() throws Exception {
+ String jndiName = "QueueMetricsMultipleMessagesExistingQueue";
+
+ expandNavTreeArrow(JMS_NAV_LABEL);
+ checkQueueMetricsAfterMultipleMessages(jndiName);
+ }
+
+ /**
+ * Common code for the testQueueMetricsAfterMultipleMessages* tests.
+ */
+ private void checkQueueMetricsAfterMultipleMessages(String jndiName) throws Exception {
+
+ // Send multiple messages to the queue
+ QueueSession session = createQueueSession();
+ Queue queue = getQueue(jndiName);
+ sendMessages(session, queue, 3);
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+ expectedMetrics.put(CONSUMER_COUNT, "0.0");
+ expectedMetrics.put(DELIVERING_COUNT, "0.0");
+ expectedMetrics.put(MSG_COUNT, "3.0");
+ expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+ expectedMetrics.put(COUNT, "3.0");
+ expectedMetrics.put(COUNT_DELTA, "3.0");
+ expectedMetrics.put(DEPTH, "3.0");
+ expectedMetrics.put(DEPTH_DELTA, "3.0");
+
+ checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+ DestinationType.QUEUE);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterReceivingMessage
+ * Assertion: Verify that queue metrics are correct
+ * after a queue receiver actually receives a message.
+ */
+ public void testQueueMetricsAfterReceivingMessage() throws Exception {
+ String jndiName = "QueueMetricsAfterReceivingMessage";
+
+ // Create the queue first
+ createQueue(jndiName);
+
+ checkQueueMetricsAfterReceivingMessage(jndiName);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterReceivingMessageUsingExistingServiceFile
+ * Assertion: Verify that queue metrics are correct
+ * after a queue receiver actually receives a message. Use a queue
+ * that already exists.
+ */
+ public void testQueueMetricsAfterReceivingMessageUsingExistingServiceFile() throws Exception {
+ String jndiName = "QueueMetricsReceiveMessageExistingQueue";
+
+ expandNavTreeArrow(JMS_NAV_LABEL);
+ checkQueueMetricsAfterReceivingMessage(jndiName);
+ }
+
+ /**
+ * Common code for the testQueueMetricsAfterReceivingMessage* tests.
+ */
+ private void checkQueueMetricsAfterReceivingMessage(String jndiName) throws Exception {
+
+ // Create a queue receiver and then send multiple messages to the
+ // queue
+ QueueSession session = createQueueSession();
+ Queue queue = getQueue(jndiName);
+ QueueReceiver receiver = createQueueReceiver(session, queue);
+ sendMessages(session, queue, 3);
+
+ // Actually receive a message
+ receiver.receive();
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+ expectedMetrics.put(CONSUMER_COUNT, "1.0");
+ expectedMetrics.put(DELIVERING_COUNT, "2.0");
+ expectedMetrics.put(MSG_COUNT, "2.0");
+ expectedMetrics.put(SCHEDULED_MSG_COUNT, "0.0");
+ expectedMetrics.put(COUNT, "3.0");
+ expectedMetrics.put(COUNT_DELTA, "3.0");
+ expectedMetrics.put(DEPTH, "2.0");
+ expectedMetrics.put(DEPTH_DELTA, "2.0");
+
+ checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+ DestinationType.QUEUE);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterScheduledMessages
+ * Assertion: Verify that queue metrics are correct after creating
+ * some scheduled messages for the queue.
+ */
+ public void testQueueMetricsAfterScheduledMessages() throws Exception {
+ String jndiName = "QueueMetricsAfterScheduledMessages";
+
+ // Create the queue first
+ createQueue(jndiName);
+
+ checkQueueMetricsAfterScheduledMessage(jndiName);
+ }
+
+ /**
+ * Test Name: testQueueMetricsAfterScheduledMessagesUsingExistingServiceFile
+ * Assertion: Verify that queue metrics are correct after creating
+ * a scheduled message for the queue. Use a queue that already exists.
+ */
+ public void testQueueMetricsAfterScheduledMessagesUsingExistingServiceFile() throws Exception {
+ String jndiName = "QueueMetricsScheduledMessagesExistingQueue";
+
+ expandNavTreeArrow(JMS_NAV_LABEL);
+ checkQueueMetricsAfterScheduledMessage(jndiName);
+ }
+
+ /**
+ * Common code for the testQueueMetricsAfterScheduledMessage* tests.
+ */
+ private void checkQueueMetricsAfterScheduledMessage(String jndiName) throws Exception {
+
+ // Create a queue receiver and then schedule some
+ // messages
+ QueueSession session = createQueueSession();
+ Queue queue = getQueue(jndiName);
+ createQueueReceiver(session, queue);
+ sendScheduledMessages(session, queue, 2);
+
+ // Set up the expected values
+ Map<String, String> expectedMetrics = new LinkedHashMap<String, String>();
+ expectedMetrics.put(SCHEDULED_MSG_COUNT, "2.0");
+ expectedMetrics.put(COUNT, "2.0");
+ expectedMetrics.put(COUNT_DELTA, "2.0");
+ expectedMetrics.put(DEPTH, "0.0");
+ expectedMetrics.put(DEPTH_DELTA, "0.0");
+ expectedMetrics.put(CONSUMER_COUNT, "1.0");
+ expectedMetrics.put(MSG_COUNT, "2.0");
+ expectedMetrics.put(DELIVERING_COUNT, "0.0");
+
+ checkDestinationMetrics(jndiName, expectedMetrics, getQueueSummaryMetrics(),
+ DestinationType.QUEUE);
+ }
+
+ /**
+ * Test Name: testQueueMetricsTimeLastUpdate
+ * Assertion: Verify that the "Time Last Update" metric for queues gets
+ * displayed appropriately.
+ */
+ public void testQueueMetricTimeLastUpdate() throws Exception {
+ String jndiName = "QueueMetricsCheckTimeLastUpdate";
+
+ // Create the queue first
+ createQueue(jndiName);
+ checkQueueMetricTimeLastUpdate(jndiName);
+ }
+
+ /**
+ * Test Name: testQueueMetricsTimeLastUpdateUsingExistingServiceFile
+ * Assertion: Verify that the "Time Last Update" metric for queues gets
+ * displayed appropriately. Use a queue that already exists.
+ */
+ public void testQueueMetricTimeLastUpdateUsingExistingServiceFile() throws Exception {
+ String jndiName = "QueueMetricsTimeLastUpdateExistingQueue";
+
+ expandNavTreeArrow(JMS_NAV_LABEL);
+ checkQueueMetricTimeLastUpdate(jndiName);
+ }
+
+ /**
+ * Common code for the testQueueMetricsTimeLastUpdate* tests.
+ */
+ private void checkQueueMetricTimeLastUpdate(String jndiName) throws Exception {
+
+ // Send a message to the queue
+ QueueSession session = createQueueSession();
+ Queue queue = getQueue(jndiName);
+ sendMessages(session, queue, 1);
+
+ ArrayList<String> expectedMetric = new ArrayList<String>();
+ expectedMetric.add(TIME_LAST_UPDATE);
+
+ checkResourceMetricsNotNull(JMS_NAV_LABEL, DestinationType.QUEUE.getNavLabel(),
+ jndiName, expectedMetric.iterator(),
+ ZERO_VALUE_MESSAGE,
+ "0.0");
+ // Clean up
+ disconnect();
+ deleteDestination(DestinationType.QUEUE, jndiName);
+ }
+
+ /**
* Common code for the metrics tests.
*/
private void checkDestinationMetrics(String jndiName,
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-03-21 00:54:16 UTC (rev 250)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-03-23 14:24:42 UTC (rev 251)
@@ -54,7 +54,8 @@
public static final String MISSING_VALUE_MESSAGE = "Value is required";
public static final String OUT_OF_RANGE_MESSAGE = "Specified attribute is not between the expected values";
public static final String INVALID_INTEGER_MESSAGE = "Value is not a valid integer";
-
+ public static final String ZERO_VALUE_MESSAGE = "Expected non-zero value for ";
+
// Success messages
public static final String ADD_MESSAGE = "Successfully added new ";
public static final String DELETE_MESSAGE = "Successfully deleted ";
@@ -114,13 +115,13 @@
setResourceProperties(propertiesMapChanges);
client.click("resourceConfigurationForm:saveButton");
-
+
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
// Verify that the properties were set correctly
checkComponentProperties(propertiesMapChanges, resourceName, componentType);
}
-
+
/**
* Unset the specified properties for the given resource.
*
@@ -244,12 +245,12 @@
"Incorrect metric value for ");
if(summaryMetrics.size() > 0) {
-
- // Check values under the "Summary" tab
- HtmlAnchor summaryLink = (HtmlAnchor)client.getElement(SUMMARY_TAB);
- summaryLink.click();
- checkMetricValues(summaryMetrics.iterator(), metricsMap,
+ // Check values under the "Summary" tab
+ HtmlAnchor summaryLink = (HtmlAnchor)client.getElement(SUMMARY_TAB);
+ summaryLink.click();
+
+ checkMetricValues(summaryMetrics.iterator(), metricsMap,
"Incorrect summary metric value for ");
}
}
@@ -262,14 +263,39 @@
* @param metricsMap maps metric names to their expected values
*/
protected void checkMetricValues(Iterator i, Map<String, String> metricsMap, String errorMessage) {
-
- while(i.hasNext()) {
- String metricName = (String)i.next();
-
- String expected = metricsMap.get(metricName);
- String actual = getMetricValueFromTable(metricName, "dataTable");
- actual = normalizeIfDoubleExpected(expected, actual);
- assertEquals(errorMessage + " '"+ metricName + "'", expected, actual);
- }
+
+ while(i.hasNext()) {
+ String metricName = (String)i.next();
+
+ String expected = metricsMap.get(metricName);
+ String actual = getMetricValueFromTable(metricName, "dataTable");
+ actual = normalizeIfDoubleExpected(expected, actual);
+ assertEquals(errorMessage + " '" + metricName + "'", expected, actual);
+ }
}
+
+ /**
+ * Make sure that the specified metrics corresponding to the given resource
+ * are not equal to nullValue.
+ *
+ * @param i is an Iterator over the metrics we want to check
+ *
+ */
+ protected void checkResourceMetricsNotNull(String resourceCategory,
+ String resourceSubCategory,
+ String resourceName,
+ Iterator i,
+ String errorMessage,
+ String nullValue) throws Exception {
+
+ // Navigate to the metrics page for the resource
+ navigateToPage(resourceCategory, resourceSubCategory,
+ resourceName, METRICS_TAB);
+
+ while(i.hasNext()) {
+ String metricName = (String)i.next();
+ String actual = getMetricValueFromTable(metricName, "dataTable");
+ assertTrue(errorMessage + "'" + metricName + "' but was: " + actual, !actual.equals(nullValue));
+ }
+ }
}
Added: trunk/jsfunit/testdata/destinations/MetricsOneQueueReceiverExistingQueue-service.xml
===================================================================
--- trunk/jsfunit/testdata/destinations/MetricsOneQueueReceiverExistingQueue-service.xml (rev 0)
+++ trunk/jsfunit/testdata/destinations/MetricsOneQueueReceiverExistingQueue-service.xml 2009-03-23 14:24:42 UTC (rev 251)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<server>
+ <mbean xmbean-dd="xmdesc/Queue-xmbean.xml" name="jboss.messaging.destination:service=Queue,name=MetricsOneQueueReceiverExistingQueue" code="org.jboss.jms.server.destination.QueueService">
+ <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>
+ <attribute name="JNDIName">MetricsOneQueueReceiverExistingQueue</attribute>
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: trunk/jsfunit/testdata/destinations/QueueMetricsMultipleMessagesExistingQueue-service.xml
===================================================================
--- trunk/jsfunit/testdata/destinations/QueueMetricsMultipleMessagesExistingQueue-service.xml (rev 0)
+++ trunk/jsfunit/testdata/destinations/QueueMetricsMultipleMessagesExistingQueue-service.xml 2009-03-23 14:24:42 UTC (rev 251)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<server>
+ <mbean xmbean-dd="xmdesc/Queue-xmbean.xml" name="jboss.messaging.destination:service=Queue,name=QueueMetricsMultipleMessagesExistingQueue" code="org.jboss.jms.server.destination.QueueService">
+ <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>
+ <attribute name="JNDIName">QueueMetricsMultipleMessagesExistingQueue</attribute>
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: trunk/jsfunit/testdata/destinations/QueueMetricsOneMessageExistingQueue-service.xml
===================================================================
--- trunk/jsfunit/testdata/destinations/QueueMetricsOneMessageExistingQueue-service.xml (rev 0)
+++ trunk/jsfunit/testdata/destinations/QueueMetricsOneMessageExistingQueue-service.xml 2009-03-23 14:24:42 UTC (rev 251)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<server>
+ <mbean xmbean-dd="xmdesc/Queue-xmbean.xml" name="jboss.messaging.destination:service=Queue,name=QueueMetricsOneMessageExistingQueue" code="org.jboss.jms.server.destination.QueueService">
+ <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>
+ <attribute name="JNDIName">QueueMetricsOneMessageExistingQueue</attribute>
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: trunk/jsfunit/testdata/destinations/QueueMetricsReceiveMessageExistingQueue-service.xml
===================================================================
--- trunk/jsfunit/testdata/destinations/QueueMetricsReceiveMessageExistingQueue-service.xml (rev 0)
+++ trunk/jsfunit/testdata/destinations/QueueMetricsReceiveMessageExistingQueue-service.xml 2009-03-23 14:24:42 UTC (rev 251)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<server>
+ <mbean xmbean-dd="xmdesc/Queue-xmbean.xml" name="jboss.messaging.destination:service=Queue,name=QueueMetricsReceiveMessageExistingQueue" code="org.jboss.jms.server.destination.QueueService">
+ <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>
+ <attribute name="JNDIName">QueueMetricsReceiveMessageExistingQueue</attribute>
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: trunk/jsfunit/testdata/destinations/QueueMetricsScheduledMessagesExistingQueue-service.xml
===================================================================
--- trunk/jsfunit/testdata/destinations/QueueMetricsScheduledMessagesExistingQueue-service.xml (rev 0)
+++ trunk/jsfunit/testdata/destinations/QueueMetricsScheduledMessagesExistingQueue-service.xml 2009-03-23 14:24:42 UTC (rev 251)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<server>
+ <mbean xmbean-dd="xmdesc/Queue-xmbean.xml" name="jboss.messaging.destination:service=Queue,name=QueueMetricsScheduledMessagesExistingQueue" code="org.jboss.jms.server.destination.QueueService">
+ <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>
+ <attribute name="JNDIName">QueueMetricsScheduledMessagesExistingQueue</attribute>
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: trunk/jsfunit/testdata/destinations/QueueMetricsTimeLastUpdateExistingQueue-service.xml
===================================================================
--- trunk/jsfunit/testdata/destinations/QueueMetricsTimeLastUpdateExistingQueue-service.xml (rev 0)
+++ trunk/jsfunit/testdata/destinations/QueueMetricsTimeLastUpdateExistingQueue-service.xml 2009-03-23 14:24:42 UTC (rev 251)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<server>
+ <mbean xmbean-dd="xmdesc/Queue-xmbean.xml" name="jboss.messaging.destination:service=Queue,name=QueueMetricsTimeLastUpdateExistingQueue" code="org.jboss.jms.server.destination.QueueService">
+ <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>
+ <attribute name="JNDIName">QueueMetricsTimeLastUpdateExistingQueue</attribute>
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
More information about the embjopr-commits
mailing list