You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/09/28 11:04:04 UTC

svn commit: r580258 - /incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/client/ResetMessageListenerTest.java

Author: ritchiem
Date: Fri Sep 28 02:04:03 2007
New Revision: 580258

URL: http://svn.apache.org/viewvc?rev=580258&view=rev
Log:
QPID-597 : TopicSessionTest Failure, Patch supplied by Aidan Skinner.
ResetMessageListenerTest.java was changing the prefetch method via a system property that propogated to all tests.

Modified:
    incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/client/ResetMessageListenerTest.java

Modified: incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/client/ResetMessageListenerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/client/ResetMessageListenerTest.java?rev=580258&r1=580257&r2=580258&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/client/ResetMessageListenerTest.java (original)
+++ incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/client/ResetMessageListenerTest.java Fri Sep 28 02:04:03 2007
@@ -72,11 +72,14 @@
     private final CountDownLatch _allFirstMessagesSent = new CountDownLatch(2); // all messages Sent Lock
     private final CountDownLatch _allSecondMessagesSent = new CountDownLatch(2); // all messages Sent Lock
 
+    private String oldImmediatePrefetch;
+
     protected void setUp() throws Exception
     {
         super.setUp();
         TransportConnection.createVMBroker(1);
 
+        oldImmediatePrefetch = System.getProperty(AMQSession.IMMEDIATE_PREFETCH);
         System.setProperty(AMQSession.IMMEDIATE_PREFETCH, "true");
 
         InitialContextFactory factory = new PropertiesFileInitialContextFactory();
@@ -117,17 +120,16 @@
     }
 
     protected void tearDown() throws Exception
-    {
-        assertEquals("First batch of messages not received correctly", 0, _allFirstMessagesSent.getCount());
-        assertEquals("Second batch of messages not received correctly", 0, _allSecondMessagesSent.getCount());
-        assertEquals("Client 1 ML1 didn't get all messages", MSG_COUNT / 2, receivedCount1ML1);
-        assertEquals("Client 2 didn't get all messages", MSG_COUNT, receivedCount2);
-        assertEquals("Client 1 ML2 didn't get all messages", MSG_COUNT / 2, receivedCount1ML2);
-
+    {       
         _clientConnection.close();
-
         _producerConnection.close();
+
         super.tearDown();
+        if (oldImmediatePrefetch == null)
+        {
+            oldImmediatePrefetch = AMQSession.IMMEDIATE_PREFETCH_DEFAULT;
+        }
+        System.setProperty(AMQSession.IMMEDIATE_PREFETCH, oldImmediatePrefetch);
         TransportConnection.killAllVMBrokers();
     }
 
@@ -261,6 +263,11 @@
         {
             // do nothing
         }
+        assertEquals("First batch of messages not received correctly", 0, _allFirstMessagesSent.getCount());
+        assertEquals("Second batch of messages not received correctly", 0, _allSecondMessagesSent.getCount());
+        assertEquals("Client 1 ML1 didn't get all messages", MSG_COUNT / 2, receivedCount1ML1);
+        assertEquals("Client 2 didn't get all messages", MSG_COUNT, receivedCount2);
+        assertEquals("Client 1 ML2 didn't get all messages", MSG_COUNT / 2, receivedCount1ML2);
     }
 
     public static junit.framework.Test suite()