You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2017/03/10 12:48:45 UTC

qpid-jms git commit: NO-JIRA: address race in test, make behaviour deterministic to avoid intermittent failure in slower CI env

Repository: qpid-jms
Updated Branches:
  refs/heads/master 4624e5e60 -> 13ebdb18b


NO-JIRA: address race in test, make behaviour deterministic to avoid intermittent failure in slower CI env


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

Branch: refs/heads/master
Commit: 13ebdb18be9acbb4104a85f9712ce088e2f8be6d
Parents: 4624e5e
Author: Robert Gemmell <ro...@apache.org>
Authored: Fri Mar 10 12:47:16 2017 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Fri Mar 10 12:47:16 2017 +0000

----------------------------------------------------------------------
 pom.xml                                              |  6 +++---
 .../jms/integration/TransactionsIntegrationTest.java | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/13ebdb18/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 917ad13..d59d678 100644
--- a/pom.xml
+++ b/pom.xml
@@ -325,9 +325,9 @@
 
   <repositories>
     <repository>
-      <!-- Proton-J 0.18.0 (RC1) -->
-      <id>proton-staging-repo</id>
-      <url>https://repository.apache.org/content/repositories/orgapacheqpid-1101/</url>
+      <!-- Temporary to pick up Proton-J 0.18.0 until it hits central -->
+      <id>apache-releases</id>
+      <url>https://repository.apache.org/content/repositories/releases</url>
       <releases>
         <enabled>true</enabled>
       </releases>

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/13ebdb18/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java
index 867d2d9..edba3d6 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/TransactionsIntegrationTest.java
@@ -30,6 +30,8 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 import javax.jms.Connection;
 import javax.jms.JMSException;
@@ -42,7 +44,9 @@ import javax.jms.TextMessage;
 import javax.jms.TransactionRolledBackException;
 
 import org.apache.qpid.jms.JmsConnection;
+import org.apache.qpid.jms.JmsDefaultConnectionListener;
 import org.apache.qpid.jms.JmsOperationTimedOutException;
+import org.apache.qpid.jms.message.JmsInboundMessageDispatch;
 import org.apache.qpid.jms.policy.JmsDefaultPrefetchPolicy;
 import org.apache.qpid.jms.test.QpidJmsTestCase;
 import org.apache.qpid.jms.test.testpeer.TestAmqpPeer;
@@ -391,6 +395,14 @@ public class TransactionsIntegrationTest extends QpidJmsTestCase {
                 testPeer.expectDisposition(true, stateMatcher);
             }
 
+            final CountDownLatch expected = new CountDownLatch(transferCount);
+            ((JmsConnection) connection).addConnectionListener(new JmsDefaultConnectionListener() {
+                @Override
+                public void onInboundMessage(JmsInboundMessageDispatch envelope) {
+                    expected.countDown();
+                }
+            });
+
             MessageConsumer messageConsumer = session.createConsumer(queue);
 
             for (int i = 1; i <= consumeCount; i++) {
@@ -400,6 +412,9 @@ public class TransactionsIntegrationTest extends QpidJmsTestCase {
                 assertTrue(receivedMessage instanceof TextMessage);
             }
 
+            // Ensure all the messages arrived so that the matching below is deterministic
+            assertTrue("Expected transfers didnt occur: " + expected.getCount(), expected.await(10, TimeUnit.SECONDS));
+
             // Expect the consumer to close now
             if (closeConsumer && closeBeforeCommit) {
 


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