[jboss-cvs] JBossAS SVN: r86903 - branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 7 05:28:02 EDT 2009
Author: emuckenhuber
Date: 2009-04-07 05:28:02 -0400 (Tue, 07 Apr 2009)
New Revision: 86903
Modified:
branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
Log:
[JBAS-6736] test queue metrics
Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-04-07 09:09:07 UTC (rev 86902)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-04-07 09:28:02 UTC (rev 86903)
@@ -173,6 +173,17 @@
public void testQueueMetrics() throws Exception
{
+ // Get the managed component
+ ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
+ ManagedComponent component = getManagementView().getComponent("testCreateQueue", type);
+
+ // The message count property
+ ManagedProperty property = component.getProperty("messageCount");
+ assertNotNull(property);
+ ManagedProperty messageCounter = component.getProperty("messageCounter");
+ assertNotNull(messageCounter);
+
+ // Send a message
Queue queue = (Queue) getInitialContext().lookup("testCreateQueue");
assertNotNull(queue);
QueueConnectionFactory qCf = (QueueConnectionFactory) getInitialContext().lookup("ConnectionFactory");
@@ -181,15 +192,22 @@
QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = s.createSender(queue);
+ //
sender.send(s.createTextMessage("Hey!"));
+
+ SimpleValue messageCount = (SimpleValue) property.getValue();
+ assertTrue((Integer) (messageCount).getValue() > 0);
+ assertEquals(((CompositeValue) messageCounter.getValue()).get("messageCount"), messageCount);
+
+ //
+ sender.send(s.createTextMessage("Message2"));
+
+ SimpleValue messageCount2 = (SimpleValue) property.getValue();
+ assertTrue(messageCount2.compareTo(messageCount) > 0);
+ assertEquals(((CompositeValue) messageCounter.getValue()).get("messageCount"), messageCount2);
+
c.stop();
c.close();
-
- ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
- ManagedComponent component = getManagementView().getComponent("testCreateQueue", type);
- ManagedProperty property = component.getProperty("messageCount");
- assertNotNull(property);
- assertTrue((Integer) ((SimpleValue)property.getValue()).getValue() > 0);
}
public void testQueueOperations() throws Exception
More information about the jboss-cvs-commits
mailing list