[jboss-cvs] JBoss Messaging SVN: r6614 - trunk/tests/src/org/jboss/messaging/tests/integration/client.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 29 02:12:41 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-04-29 02:12:41 -0400 (Wed, 29 Apr 2009)
New Revision: 6614

Modified:
   trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java
Log:
small tweak on test

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java	2009-04-29 03:55:48 UTC (rev 6613)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/client/ConsumerWindowSizeTest.java	2009-04-29 06:12:41 UTC (rev 6614)
@@ -491,7 +491,7 @@
       internalTestSlowConsumerOnMessageHandlerNoBuffers(true);
    }
 
-   public void internalTestSlowConsumerOnMessageHandlerNoBuffers(boolean largeMessages) throws Exception
+   public void internalTestSlowConsumerOnMessageHandlerNoBuffers(final boolean largeMessages) throws Exception
    {
 
       MessagingServer server = createServer(false);
@@ -530,6 +530,9 @@
 
          final CountDownLatch latchDone = new CountDownLatch(1);
 
+         // It can't close the session while the large message is being read
+         final CountDownLatch latchRead = new CountDownLatch(1);
+
          // It should receive two messages and then give up
          class LocalHandler implements MessageHandler
          {
@@ -557,12 +560,16 @@
                      if (!latchDone.await(TIMEOUT, TimeUnit.SECONDS)) // a timed wait, so if the test fails, one less
                      // thread around
                      {
-                        new Exception("ClientConsuemrWindowSizeTest Handler couldn't receive signal in less than 5 seconds").printStackTrace(); // hudson
-                        // or
-                        // junit
-                        // report
+                        new Exception("ClientConsuemrWindowSizeTest Handler couldn't receive signal in less than 5 seconds").printStackTrace(); 
                         failed = true;
                      }
+
+                     if (largeMessages)
+                     {
+                        message.getBody().readBytes(new byte[600]);
+                     }
+
+                     latchRead.countDown();
                   }
                }
                catch (Exception e)
@@ -607,6 +614,9 @@
 
          latchDone.countDown();
 
+         // The test can' t close the session while the message is still being read, or it could interrupt the data
+         assertTrue(latchRead.await(10, TimeUnit.SECONDS));
+
          session.close();
          session = null;
 




More information about the jboss-cvs-commits mailing list