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

[qpid-broker-j] 04/08: QPID-8349: [Tests][AMQP 1.0] Assert coordinator attach responses

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

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

commit 38f737589969177b06727ba7920edeec96cfc0c2
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Tue Aug 27 16:48:49 2019 +0100

    QPID-8349: [Tests][AMQP 1.0] Assert coordinator attach responses
---
 .../qpid/tests/protocol/v1_0/Interaction.java      | 43 ++++++++++++++++++++--
 .../anonymousterminus/AnonymousTerminusTest.java   | 28 ++++++++------
 .../extensions/qpid/queue/QueueDeletionTest.java   | 12 +++++-
 .../protocol/v1_0/messaging/TransferTest.java      | 10 ++++-
 .../protocol/v1_0/transaction/DischargeTest.java   | 27 +++++++-------
 .../transaction/TransactionalTransferTest.java     | 30 +++++++++------
 6 files changed, 108 insertions(+), 42 deletions(-)

diff --git a/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java
index ff0fa60..6631590 100644
--- a/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java
+++ b/systests/protocol-tests-amqp-1-0/src/main/java/org/apache/qpid/tests/protocol/v1_0/Interaction.java
@@ -982,10 +982,23 @@ public class Interaction extends AbstractInteraction<Interaction>
 
     public Interaction txnAttachCoordinatorLink(final UnsignedInteger handle) throws Exception
     {
-        return txnAttachCoordinatorLink(handle, Accepted.ACCEPTED_SYMBOL, Rejected.REJECTED_SYMBOL);
+        return txnAttachCoordinatorLink(handle,
+                                        this::txDefaultUnexpectedResponseHandler,
+                                        Accepted.ACCEPTED_SYMBOL,
+                                        Rejected.REJECTED_SYMBOL);
     }
 
     public Interaction txnAttachCoordinatorLink(final UnsignedInteger handle,
+                                                final Consumer<Response<?>> unexpectedResponseHandler) throws Exception
+    {
+        return txnAttachCoordinatorLink(handle,
+                                        unexpectedResponseHandler,
+                                        Accepted.ACCEPTED_SYMBOL,
+                                        Rejected.REJECTED_SYMBOL);
+    }
+
+    public Interaction txnAttachCoordinatorLink(final UnsignedInteger handle,
+                                                final Consumer<Response<?>> unexpectedResponseHandler,
                                                 final Symbol... outcomes) throws Exception
     {
         Attach attach = new Attach();
@@ -999,12 +1012,29 @@ public class Interaction extends AbstractInteraction<Interaction>
         source.setOutcomes(outcomes);
         _transactionalState = new InteractionTransactionalState(handle);
         sendPerformativeAndChainFuture(attach, _sessionChannel);
-        consumeResponse(Attach.class);
-        final Flow flow = consumeResponse(Flow.class).getLatestResponse(Flow.class);
+
+        // attach expected
+        Consumer<Response<?>> handler = unexpectedResponseHandler == null
+                ? this::txDefaultUnexpectedResponseHandler
+                : unexpectedResponseHandler;
+        consumeResponse().assertLatestResponse(handler);
+
+        // flow expected
+        consumeResponse().assertLatestResponse(handler);
+
+        Flow flow = getLatestResponse(Flow.class);
         _coordinatorCredits.set(flow.getLinkCredit().longValue());
         return this;
     }
 
+    private void txDefaultUnexpectedResponseHandler(Response<?> r)
+    {
+        if (r == null || r.getBody() == null || !(r.getBody() instanceof Attach || r.getBody() instanceof Flow))
+        {
+            throw new IllegalStateException(String.format("Could not attach coordinator link. Got %s", r));
+        }
+    }
+
     public Interaction txnDeclare() throws Exception
     {
         sendPayloadToCoordinator(new Declare(), _transactionalState.getHandle());
@@ -1284,6 +1314,13 @@ public class Interaction extends AbstractInteraction<Interaction>
         return this;
     }
 
+    public Interaction assertLatestResponse(Consumer<Response<?>> assertion)
+    {
+        Response<?> latestResponse = getLatestResponse();
+        assertion.accept(latestResponse);
+        return this;
+    }
+
     public void detachEndCloseUnconditionally() throws Exception
     {
         detachClose(true).detach().end().close().sync();
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/anonymousterminus/AnonymousTerminusTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/anonymousterminus/AnonymousTerminusTest.java
index 4748f10..58864b4 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/anonymousterminus/AnonymousTerminusTest.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/anonymousterminus/AnonymousTerminusTest.java
@@ -20,19 +20,19 @@
  */
 package org.apache.qpid.tests.protocol.v1_0.extensions.anonymousterminus;
 
-
-import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.hasItemInArray;
 import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.oneOf;
 import static org.junit.Assume.assumeThat;
 
 import java.net.InetSocketAddress;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -58,6 +58,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Flow;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Open;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Role;
 import org.apache.qpid.server.util.StringUtil;
+import org.apache.qpid.tests.protocol.Response;
 import org.apache.qpid.tests.protocol.SpecificationTest;
 import org.apache.qpid.tests.protocol.v1_0.FrameTransport;
 import org.apache.qpid.tests.protocol.v1_0.Interaction;
@@ -193,7 +194,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
             Rejected rejected = (Rejected)dispositionState;
             Error error = rejected.getError();
             assertThat(error, is(notNullValue()));
-            assertThat(error.getCondition(), is(equalTo(AmqpError.NOT_FOUND)));
+            assertThat(error.getCondition(), is(oneOf(AmqpError.NOT_FOUND, AmqpError.NOT_ALLOWED)));
             assertThat(error.getInfo(), is(notNullValue()));
             assertThat(error.getInfo().get(DELIVERY_TAG), is(equalTo(_deliveryTag)));
         }
@@ -253,7 +254,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
             interaction.begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -287,7 +288,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
             interaction.begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -332,7 +333,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
             interaction.begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -380,7 +381,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
             interaction.begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -451,7 +452,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
                        .consumeResponse(Begin.class)
 
                        // attaching coordinator link with supported outcomes Accepted and Rejected
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -516,7 +517,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
             interaction.begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, Accepted.ACCEPTED_SYMBOL)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected, Accepted.ACCEPTED_SYMBOL)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -555,7 +556,7 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
                    .open().consumeResponse(Open.class);
 
         Open open = interaction.getLatestResponse(Open.class);
-        assumeThat(Arrays.asList(open.getOfferedCapabilities()), hasItem(ANONYMOUS_RELAY));
+        assumeThat(open.getOfferedCapabilities(), hasItemInArray((ANONYMOUS_RELAY)));
         return interaction;
     }
 
@@ -574,4 +575,9 @@ public class AnonymousTerminusTest extends BrokerAdminUsingTestBase
         assumeThat(flow.getLinkCredit(), is(greaterThan(UnsignedInteger.ZERO)));
     }
 
+    private void coordinatorAttachExpected(final Response<?> response)
+    {
+        assertThat(response, is(notNullValue()));
+        assumeThat(response.getBody(), anyOf(instanceOf(Attach.class), instanceOf(Flow.class)));
+    }
 }
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/qpid/queue/QueueDeletionTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/qpid/queue/QueueDeletionTest.java
index 8cd435b..dff32cc 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/qpid/queue/QueueDeletionTest.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/extensions/qpid/queue/QueueDeletionTest.java
@@ -21,12 +21,14 @@
 package org.apache.qpid.tests.protocol.v1_0.extensions.qpid.queue;
 
 import static org.apache.qpid.tests.utils.BrokerAdmin.KIND_BROKER_J;
+import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.is;
+import static org.junit.Assume.assumeThat;
 
 import java.net.InetSocketAddress;
 
@@ -139,7 +141,7 @@ public class QueueDeletionTest extends BrokerAdminUsingTestBase
                                        .begin()
                                        .consumeResponse(Begin.class)
 
-                                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                        .txnDeclare()
 
                                        .attachRole(Role.SENDER)
@@ -192,7 +194,7 @@ public class QueueDeletionTest extends BrokerAdminUsingTestBase
                                        .begin()
                                        .consumeResponse(Begin.class)
 
-                                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                        .txnDeclare()
 
                                        .attachRole(Role.RECEIVER)
@@ -276,4 +278,10 @@ public class QueueDeletionTest extends BrokerAdminUsingTestBase
         assertThat(error, is(notNullValue()));
         assertThat(error.getCondition(), is(equalTo(TransactionError.TRANSACTION_ROLLBACK)));
     }
+
+    private void coordinatorAttachExpected(final Response<?> response)
+    {
+        assertThat(response, is(notNullValue()));
+        assumeThat(response.getBody(), anyOf(instanceOf(Attach.class), instanceOf(Flow.class)));
+    }
 }
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
index 7b42edb..792bf30 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/messaging/TransferTest.java
@@ -1066,7 +1066,7 @@ public class TransferTest extends BrokerAdminUsingTestBase
             Flow flow = interaction.getLatestResponse(Flow.class);
             assumeThat("insufficient credit for the test", flow.getLinkCredit().intValue(), is(greaterThan(2)));
 
-            interaction.txnAttachCoordinatorLink(UnsignedInteger.ONE)
+            interaction.txnAttachCoordinatorLink(UnsignedInteger.ONE, this::coordinatorAttachExpected)
                        .txnDeclare();
 
             interaction.transferDeliveryId()
@@ -1183,7 +1183,7 @@ public class TransferTest extends BrokerAdminUsingTestBase
                 deliveryIds.add(interaction.getLatestDeliveryId());
             }
 
-            interaction.txnAttachCoordinatorLink(UnsignedInteger.ONE)
+            interaction.txnAttachCoordinatorLink(UnsignedInteger.ONE, this::coordinatorAttachExpected)
                        .txnDeclare();
 
             interaction.dispositionSettled(true)
@@ -1260,4 +1260,10 @@ public class TransferTest extends BrokerAdminUsingTestBase
     {
         assumeThat(attach.getRcvSettleMode(), is(equalTo(ReceiverSettleMode.SECOND)));
     }
+
+    private void coordinatorAttachExpected(final Response<?> response)
+    {
+        assertThat(response, is(notNullValue()));
+        assumeThat(response.getBody(), anyOf(instanceOf(Attach.class), instanceOf(Flow.class)));
+    }
 }
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/DischargeTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/DischargeTest.java
index a22c8fc..f14a306 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/DischargeTest.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/DischargeTest.java
@@ -22,6 +22,7 @@ package org.apache.qpid.tests.protocol.v1_0.transaction;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.qpid.tests.utils.BrokerAdmin.KIND_BROKER_J;
+import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.notNullValue;
@@ -53,6 +54,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Open;
 import org.apache.qpid.server.protocol.v1_0.type.transport.ReceiverSettleMode;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Role;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Transfer;
+import org.apache.qpid.tests.protocol.Response;
 import org.apache.qpid.tests.protocol.SpecificationTest;
 import org.apache.qpid.tests.protocol.v1_0.FrameTransport;
 import org.apache.qpid.tests.protocol.v1_0.Interaction;
@@ -86,7 +88,7 @@ public class DischargeTest extends BrokerAdminUsingTestBase
                        .open().consumeResponse(Open.class)
                        .begin().consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, Rejected.REJECTED_SYMBOL)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected, Rejected.REJECTED_SYMBOL)
                        .txnDeclare();
 
             assertThat(interaction.getCoordinatorLatestDeliveryState(), is(instanceOf(Declared.class)));
@@ -99,10 +101,7 @@ public class DischargeTest extends BrokerAdminUsingTestBase
             final Error error = ((Rejected) interaction.getCoordinatorLatestDeliveryState()).getError();
             assertThat(error, is(notNullValue()));
 
-            if (KIND_BROKER_J.equals(getBrokerAdmin().getKind()))
-            {
-                assertThat(error.getCondition(), is(equalTo(TransactionError.UNKNOWN_ID)));
-            }
+            assertThat(error.getCondition(), is(equalTo(TransactionError.UNKNOWN_ID)));
         }
     }
 
@@ -121,7 +120,7 @@ public class DischargeTest extends BrokerAdminUsingTestBase
             interaction.negotiateProtocol().consumeResponse()
                                            .open().consumeResponse(Open.class)
                                            .begin().consumeResponse(Begin.class)
-                                           .txnAttachCoordinatorLink(UnsignedInteger.ZERO, Accepted.ACCEPTED_SYMBOL)
+                                           .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected, Accepted.ACCEPTED_SYMBOL)
                                            .txnDeclare();
 
             assertThat(interaction.getCoordinatorLatestDeliveryState(), is(instanceOf(Declared.class)));
@@ -135,10 +134,7 @@ public class DischargeTest extends BrokerAdminUsingTestBase
             final Error error = detachResponse.getError();
             assertThat(error, is(notNullValue()));
 
-            if (KIND_BROKER_J.equals(getBrokerAdmin().getKind()))
-            {
-                assertThat(error.getCondition(), is(equalTo(TransactionError.UNKNOWN_ID)));
-            }
+            assertThat(error.getCondition(), is(equalTo(TransactionError.UNKNOWN_ID)));
         }
     }
 
@@ -157,7 +153,7 @@ public class DischargeTest extends BrokerAdminUsingTestBase
                        .open().consumeResponse(Open.class)
                        .begin().consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.RECEIVER)
@@ -215,7 +211,7 @@ public class DischargeTest extends BrokerAdminUsingTestBase
                        .open().consumeResponse(Open.class)
                        .begin().consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -256,7 +252,7 @@ public class DischargeTest extends BrokerAdminUsingTestBase
                        .open().consumeResponse(Open.class)
                        .begin().consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.SENDER)
@@ -287,4 +283,9 @@ public class DischargeTest extends BrokerAdminUsingTestBase
         assertThat(receivedMessage, is(equalTo(getTestName())));
     }
 
+    private void coordinatorAttachExpected(final Response<?> response)
+    {
+        assertThat(response, is(notNullValue()));
+        assumeThat(response.getBody(), anyOf(instanceOf(Attach.class), instanceOf(Flow.class)));
+    }
 }
diff --git a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/TransactionalTransferTest.java b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/TransactionalTransferTest.java
index 0827209..938e144 100644
--- a/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/TransactionalTransferTest.java
+++ b/systests/protocol-tests-amqp-1-0/src/test/java/org/apache/qpid/tests/protocol/v1_0/transaction/TransactionalTransferTest.java
@@ -20,6 +20,7 @@
  */
 package org.apache.qpid.tests.protocol.v1_0.transaction;
 
+import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -32,6 +33,7 @@ import java.net.InetSocketAddress;
 import java.util.Collections;
 import java.util.List;
 
+import org.hamcrest.Matchers;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -93,7 +95,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                                                          .begin()
                                                          .consumeResponse(Begin.class)
 
-                                                         .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                                         .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                                          .txnDeclare()
 
                                                          .attachRole(Role.SENDER)
@@ -141,7 +143,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                                                          .begin()
                                                          .consumeResponse(Begin.class)
 
-                                                         .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                                         .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                                          .txnDeclare()
 
                                                          .attachRole(Role.SENDER)
@@ -191,7 +193,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                                                          .begin()
                                                          .consumeResponse(Begin.class)
 
-                                                         .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                                         .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                                          .txnDeclare()
 
                                                          .attachRole(Role.SENDER)
@@ -245,7 +247,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                                               .open().consumeResponse(Open.class)
                                               .begin().consumeResponse(Begin.class)
 
-                                              .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                              .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                               .txnDeclare()
 
                                               .attachRole(Role.SENDER)
@@ -285,7 +287,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                        .begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.RECEIVER)
@@ -334,7 +336,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                        .begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.RECEIVER)
@@ -387,7 +389,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                                                   .open().consumeResponse(Open.class)
                                                   .begin().consumeResponse(Begin.class)
 
-                                                  .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                                  .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                                   .txnDeclare()
 
                                                   .attachRole(Role.RECEIVER)
@@ -448,7 +450,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                        .begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.RECEIVER)
@@ -509,7 +511,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                        .begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.RECEIVER)
@@ -575,7 +577,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                        .begin()
                        .consumeResponse(Begin.class)
 
-                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                       .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                        .txnDeclare()
 
                        .attachRole(Role.RECEIVER)
@@ -640,7 +642,7 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
                                               .begin()
                                               .consumeResponse(Begin.class)
 
-                                              .txnAttachCoordinatorLink(UnsignedInteger.ZERO)
+                                              .txnAttachCoordinatorLink(UnsignedInteger.ZERO, this::coordinatorAttachExpected)
                                               .txnDeclare()
 
                                               .attachRole(Role.RECEIVER)
@@ -709,4 +711,10 @@ public class TransactionalTransferTest extends BrokerAdminUsingTestBase
     {
         assumeThat(attach.getRcvSettleMode(), is(equalTo(ReceiverSettleMode.SECOND)));
     }
+
+    private void coordinatorAttachExpected(final Response<?> response)
+    {
+        assertThat(response, is(notNullValue()));
+        assumeThat(response.getBody(), anyOf(instanceOf(Attach.class), instanceOf(Flow.class)));
+    }
 }


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