[Jboss-cvs] JBoss Messaging SVN: r1242 - branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/server/destination

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 30 20:20:02 EDT 2006


Author: ovidiu.feodorov at jboss.com
Date: 2006-08-30 20:20:01 -0400 (Wed, 30 Aug 2006)
New Revision: 1242

Modified:
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java
Log:
added a failing test case for http://jira.jboss.org/jira/browse/JBMESSAGING-508

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java	2006-08-31 00:18:46 UTC (rev 1241)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/server/destination/QueueManagementTest.java	2006-08-31 00:20:01 UTC (rev 1242)
@@ -226,7 +226,53 @@
          ServerManagement.undeployQueue("QueueMessageCount");
       }
    }
-   
+
+   public void testMessageCountOverFullSize() throws Exception
+   {
+      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+      Connection conn = null;
+
+      int fullSize = 10;
+
+      ServerManagement.deployQueue("QueueMessageCount2", fullSize, fullSize / 2, fullSize / 2 - 1);
+
+      ObjectName destObjectName =
+         new ObjectName("jboss.messaging.destination:service=Queue,name=QueueMessageCount2");
+
+      try
+      {
+         Queue queue = (Queue)ic.lookup("/queue/QueueMessageCount2");
+
+         conn = cf.createConnection();
+         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer prod = session.createProducer(queue);
+         prod.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+         // Send 20 message to the queue
+
+         for(int i = 0; i < 20; i++)
+         {
+            TextMessage m = session.createTextMessage("message" + i);
+            prod.send(m);
+         }
+
+         int mc =
+            ((Integer)ServerManagement.getAttribute(destObjectName, "MessageCount")).intValue();
+
+         assertEquals(20, mc);
+      }
+      finally
+      {
+         ServerManagement.undeployQueue("QueueMessageCount2");
+
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+
    // TODO this test should be done in DestinationManagementTestBase, once implemented in Topic
    // TODO this only tests reliable non-tx messages
    public void testRemoveAllMessages() throws Exception




More information about the jboss-cvs-commits mailing list