You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2019/08/02 19:02:22 UTC

[qpid-jms] 01/02: NO-JIRA tweak some tests to avoid race on peer start / setup

This is an automated email from the ASF dual-hosted git repository.

tabish pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git

commit a00b896bfbcc3cb68ba3e407f96bf8db16d11276
Author: Timothy Bish <ta...@gmail.com>
AuthorDate: Fri Aug 2 14:56:08 2019 -0400

    NO-JIRA tweak some tests to avoid race on peer start / setup
---
 .../provider/failover/FailoverIntegrationTest.java | 41 ++++++++++++++--------
 1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java
index f79f16c..39a9a94 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverIntegrationTest.java
@@ -3619,13 +3619,13 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
 
     private void doCreateTemporaryDestinationFailsWhenLinkRefusedTestImpl(boolean topic, boolean deferAttachResponseWrite) throws Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
-            JmsConnection connection = establishAnonymousConnecton(testPeer);
 
             testPeer.expectSaslAnonymous();
             testPeer.expectOpen();
             testPeer.expectBegin();
             testPeer.expectBegin();
 
+            JmsConnection connection = establishAnonymousConnecton(testPeer);
             connection.start();
 
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -3661,6 +3661,12 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
 
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
             final CountDownLatch producerClosed = new CountDownLatch(1);
+
+            testPeer.expectSaslAnonymous();
+            testPeer.expectOpen();
+            testPeer.expectBegin();
+            testPeer.expectBegin();
+
             JmsConnection connection = establishAnonymousConnecton(testPeer);
             connection.addConnectionListener(new JmsDefaultConnectionListener() {
                 @Override
@@ -3668,12 +3674,6 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
                     producerClosed.countDown();
                 }
             });
-
-            testPeer.expectSaslAnonymous();
-            testPeer.expectOpen();
-            testPeer.expectBegin();
-            testPeer.expectBegin();
-
             connection.start();
 
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -3723,15 +3723,19 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
 
     @Test(timeout = 20000)
     public void testPassthroughOfSendFailsWhenDelayedDeliveryIsNotSupported() throws Exception {
-        try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
-            // DO NOT add capability to indicate server support for DELAYED-DELIVERY
-            JmsConnection connection = establishAnonymousConnecton(testPeer);
+        try (TestAmqpPeer testPeer = new TestAmqpPeer()) {
+
+            final String testPeerURI = createPeerURI(testPeer);
+            LOG.info("Original peer is at: {}", testPeerURI);
 
             testPeer.expectSaslAnonymous();
             testPeer.expectOpen();
             testPeer.expectBegin();
             testPeer.expectBegin();
 
+            // DO NOT add capability to indicate server support for DELAYED-DELIVERY so that
+            // send fails and we can see if the error passes through the failover provider
+            JmsConnection connection = establishAnonymousConnecton(testPeer);
             connection.start();
 
             Matcher<Symbol[]> desiredCapabilitiesMatcher = arrayContaining(new Symbol[] { DELAYED_DELIVERY });
@@ -3765,14 +3769,17 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
 
     @Test(timeout = 20000)
     public void testPassthroughOfSendTimesOutWhenNoDispostionArrives() throws Exception {
-        try(TestAmqpPeer testPeer = new TestAmqpPeer();) {
-            JmsConnection connection = establishAnonymousConnecton(testPeer);
+        try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
+
+            final String testPeerURI = createPeerURI(testPeer);
+            LOG.info("Original peer is at: {}", testPeerURI);
 
             testPeer.expectSaslAnonymous();
             testPeer.expectOpen();
             testPeer.expectBegin();
             testPeer.expectBegin();
 
+            JmsConnection connection = establishAnonymousConnecton(testPeer);
             connection.setSendTimeout(500);
             connection.start();
 
@@ -3810,7 +3817,9 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
     @Test(timeout=20000)
     public void testPassthroughOfRollbackErrorCoordinatorClosedOnCommit() throws Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
-            JmsConnection connection = establishAnonymousConnecton(testPeer);
+
+            final String testPeerURI = createPeerURI(testPeer);
+            LOG.info("Original peer is at: {}", testPeerURI);
 
             testPeer.expectSaslAnonymous();
             testPeer.expectOpen();
@@ -3818,6 +3827,7 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
             testPeer.expectBegin();
             testPeer.expectCoordinatorAttach();
 
+            JmsConnection connection = establishAnonymousConnecton(testPeer);
             connection.start();
 
             Binary txnId1 = new Binary(new byte[]{ (byte) 5, (byte) 6, (byte) 7, (byte) 8});
@@ -3848,7 +3858,9 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
     @Test(timeout=20000)
     public void testPassthroughOfSessionCreateFailsOnDeclareTimeout() throws Exception {
         try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
-            JmsConnection connection = establishAnonymousConnecton(testPeer);
+
+            final String testPeerURI = createPeerURI(testPeer);
+            LOG.info("Original peer is at: {}", testPeerURI);
 
             testPeer.expectSaslAnonymous();
             testPeer.expectOpen();
@@ -3859,6 +3871,7 @@ public class FailoverIntegrationTest extends QpidJmsTestCase {
             // Expect the AMQP session to be closed due to the JMS session creation failure.
             testPeer.expectEnd();
 
+            JmsConnection connection = establishAnonymousConnecton(testPeer);
             connection.setRequestTimeout(500);
             connection.start();
 


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