This is an automated email from the ASF dual-hosted git repository.
tabish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-protonj2.git
The following commit(s) were added to refs/heads/main by this push:
new 60c3a02 PROTON-2524 Fix intermittent test failure
60c3a02 is described below
commit 60c3a026e3bf9b74168dcf3c6ba05f07ec071f03
Author: Timothy Bish <[email protected]>
AuthorDate: Mon Mar 28 14:26:31 2022 -0400
PROTON-2524 Fix intermittent test failure
Ensure that expected async processing from last call is completed before
moving onto next operation to prevent test from failing due to frames
not being in the expect order scripted.
---
.../qpid/protonj2/client/impl/ReceiverTest.java | 10 ++++++++++
.../engine/impl/ProtonIncomingDelivery.java | 22 +++++++++++++---------
.../engine/impl/ProtonOutgoingDelivery.java | 7 +++++++
3 files changed, 30 insertions(+), 9 deletions(-)
diff --git
a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java
b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java
index feaf692..8f88e35 100644
---
a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java
+++
b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReceiverTest.java
@@ -2690,12 +2690,17 @@ public class ReceiverTest extends
ImperativeClientTestCase {
assertNotNull(receiver.receive()); // #2
peer.waitForScriptToComplete();
+ peer.expectAttach().ofSender().respond();
+ peer.expectDetach().respond();
if (autoAccept)
{
peer.expectDisposition().withFirst(2);
}
peer.expectFlow().withLinkCredit(3);
+ // Ensure that no additional frames from last receive overlap with
this one
+ connection.openSender("test").openFuture().get().close();
+
// Now consume message 3 which will trip the replenish barrier and
the
// credit should be updated to reflect that we still have 7 queued
assertNotNull(receiver.receive()); // #3
@@ -2714,12 +2719,17 @@ public class ReceiverTest extends
ImperativeClientTestCase {
assertNotNull(receiver.receive()); // #5
peer.waitForScriptToComplete();
+ peer.expectAttach().ofSender().respond();
+ peer.expectDetach().respond();
if (autoAccept)
{
peer.expectDisposition().withFirst(5);
}
peer.expectFlow().withLinkCredit(6);
+ // Ensure that no additional frames from last receive overlap with
this one
+ connection.openSender("test").openFuture().get().close();
+
// Consume number 6 which means we only have 4 outstanding plus the
three
// that we sent last time we flowed which is 70% of possible
prefetch so
// we should flow to top off credit which would be 6 since we have
four
diff --git
a/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonIncomingDelivery.java
b/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonIncomingDelivery.java
index 89d0d40..e3e63e2 100644
---
a/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonIncomingDelivery.java
+++
b/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonIncomingDelivery.java
@@ -57,12 +57,9 @@ public class ProtonIncomingDelivery implements
IncomingDelivery {
private EventHandler<IncomingDelivery> deliveryUpdatedEventHandler = null;
/**
- * @param link
- * The link that this delivery is associated with
- * @param deliveryId
- * The Delivery Id that is assigned to this delivery.
- * @param deliveryTag
- * The delivery tag assigned to this delivery
+ * @param link The link that this delivery is associated with
+ * @param deliveryId The Delivery Id that is assigned to this delivery.
+ * @param deliveryTag The delivery tag assigned to this delivery
*/
public ProtonIncomingDelivery(ProtonReceiver link, long deliveryId,
DeliveryTag deliveryTag) {
this.deliveryId = deliveryId;
@@ -180,7 +177,7 @@ public class ProtonIncomingDelivery implements
IncomingDelivery {
return disposition(localState, true);
}
- //----- Payload access
+ // ----- Payload access
@Override
public int available() {
@@ -259,7 +256,7 @@ public class ProtonIncomingDelivery implements
IncomingDelivery {
return this;
}
- //----- Incoming Delivery event handlers
+ // ----- Incoming Delivery event handlers
@Override
public ProtonIncomingDelivery
deliveryReadHandler(EventHandler<IncomingDelivery> handler) {
@@ -291,7 +288,7 @@ public class ProtonIncomingDelivery implements
IncomingDelivery {
return deliveryUpdatedEventHandler;
}
- //----- Internal methods to manage the Delivery
+ // ----- Internal methods to manage the Delivery
@Override
public int getTransferCount() {
@@ -365,4 +362,11 @@ public class ProtonIncomingDelivery implements
IncomingDelivery {
return this;
}
+
+ @Override
+ public String toString() {
+ return "ProtonIncomingDelivery { " +
+ "deliveryId = " + deliveryId + ", " +
+ "deliveryTag = " + deliveryTag + " };";
+ }
}
diff --git
a/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonOutgoingDelivery.java
b/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonOutgoingDelivery.java
index 19e1548..b550504 100644
---
a/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonOutgoingDelivery.java
+++
b/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonOutgoingDelivery.java
@@ -258,6 +258,13 @@ public class ProtonOutgoingDelivery implements
OutgoingDelivery {
return deliveryUpdatedEventHandler;
}
+ @Override
+ public String toString() {
+ return "ProtonOutgoingDelivery { " +
+ "deliveryId = " + deliveryId + ", " +
+ "deliveryTag = " + deliveryTag + " };";
+ }
+
//----- Internal methods meant only for use by Proton resources
private void tryRetireDeliveryTag() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]