qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject [3/3] qpid-jms git commit: update checks to be more reliable
Date Tue, 03 Mar 2015 11:58:21 GMT
update checks to be more reliable


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/fa4dd26e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/fa4dd26e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/fa4dd26e

Branch: refs/heads/master
Commit: fa4dd26ec6920d293bf7fb3ba007758bcd9fa151
Parents: 8633f4f
Author: Robert Gemmell <robbie@apache.org>
Authored: Tue Mar 3 11:50:43 2015 +0000
Committer: Robert Gemmell <robbie@apache.org>
Committed: Tue Mar 3 11:50:43 2015 +0000

----------------------------------------------------------------------
 .../jms/integration/SessionIntegrationTest.java | 45 ++++++++++++--------
 1 file changed, 28 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/fa4dd26e/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index c65b789..acbef10 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -52,6 +52,7 @@ import org.apache.qpid.jms.JmsConnection;
 import org.apache.qpid.jms.provider.amqp.AmqpConnectionProperties;
 import org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper;
 import org.apache.qpid.jms.test.QpidJmsTestCase;
+import org.apache.qpid.jms.test.Wait;
 import org.apache.qpid.jms.test.testpeer.TestAmqpPeer;
 import org.apache.qpid.jms.test.testpeer.basictypes.TerminusDurability;
 import org.apache.qpid.jms.test.testpeer.describedtypes.Accepted;
@@ -1192,17 +1193,23 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
             testPeer.remotelyEndLastOpenedSession(true);
 
             Queue queue = session.createQueue("myQueue");
-            MessageProducer producer = session.createProducer(queue);
+            final MessageProducer producer = session.createProducer(queue);
 
             testPeer.waitForAllHandlersToComplete(1000);
 
-            // Verify the producer is now marked closed
-            try {
-                producer.getDestination();
-                fail("Expected ISE to be thrown due to being closed");
-            } catch (IllegalStateException jmsise) {
-                // expected
-            }
+            // Verify the producer gets marked closed
+            testPeer.waitForAllHandlersToComplete(1000);
+            assertTrue("producer never closed.", Wait.waitFor(new Wait.Condition() {
+                @Override
+                public boolean isSatisified() throws Exception {
+                    try {
+                        producer.getDestination();
+                    } catch (IllegalStateException jmsise) {
+                        return true;
+                    }
+                    return false;
+                }
+            }, 2000, 10));
 
             // Try closing it explicitly, should effectively no-op in client.
             // The test peer will throw during close if it sends anything.
@@ -1224,17 +1231,21 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
             testPeer.remotelyEndLastOpenedSession(true);
 
             Queue queue = session.createQueue("myQueue");
-            MessageConsumer consumer = session.createConsumer(queue);
+            final MessageConsumer consumer = session.createConsumer(queue);
 
+            // Verify the consumer gets marked closed
             testPeer.waitForAllHandlersToComplete(1000);
-
-            // Verify the consumer is now marked closed
-            try {
-                consumer.getMessageListener();
-                fail("Expected ISE to be thrown due to being closed");
-            } catch (IllegalStateException jmsise) {
-                // expected
-            }
+            assertTrue("consumer never closed.", Wait.waitFor(new Wait.Condition() {
+                @Override
+                public boolean isSatisified() throws Exception {
+                    try {
+                        consumer.getMessageListener();
+                    } catch (IllegalStateException jmsise) {
+                        return true;
+                    }
+                    return false;
+                }
+            }, 2000, 10));
 
             // Try closing it explicitly, should effectively no-op in client.
             // The test peer will throw during close if it sends anything.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message