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 a9bf299  PROTON-2524 Additional tweaks to Receiver and add more test 
validations
a9bf299 is described below

commit a9bf299ed08ca5ebad11f913eaa6eb2d1d09a8ae
Author: Timothy Bish <[email protected]>
AuthorDate: Fri Mar 25 19:32:49 2022 -0400

    PROTON-2524 Additional tweaks to Receiver and add more test validations
    
    Fire the disposition and credit refill check without making a circle
    through the delivery API which results in the same async work task being
    created.
---
 .../qpid/protonj2/client/impl/ClientReceiver.java    |  3 ++-
 .../qpid/protonj2/client/impl/ReceiverTest.java      | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientReceiver.java
 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientReceiver.java
index 2142999..f3dd627 100644
--- 
a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientReceiver.java
+++ 
b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientReceiver.java
@@ -41,6 +41,7 @@ import org.apache.qpid.protonj2.client.util.FifoDeliveryQueue;
 import org.apache.qpid.protonj2.engine.Connection;
 import org.apache.qpid.protonj2.engine.Engine;
 import org.apache.qpid.protonj2.engine.IncomingDelivery;
+import org.apache.qpid.protonj2.types.messaging.Accepted;
 import org.apache.qpid.protonj2.types.messaging.Released;
 import org.apache.qpid.protonj2.types.transport.DeliveryState;
 import org.slf4j.Logger;
@@ -146,7 +147,7 @@ public final class ClientReceiver implements Receiver {
             ClientDelivery delivery = 
messageQueue.dequeue(units.toMillis(timeout));
             if (delivery != null) {
                 if (options.autoAccept()) {
-                    
delivery.disposition(org.apache.qpid.protonj2.client.DeliveryState.accepted(), 
options.autoSettle());
+                    asyncApplyDisposition(delivery.protonDelivery(), 
Accepted.getInstance(), options.autoSettle());
                 } else {
                     asyncReplenishCreditIfNeeded();
                 }
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 0ef9d90..feaf692 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
@@ -2680,8 +2680,8 @@ public class ReceiverTest extends 
ImperativeClientTestCase {
           peer.waitForScriptToComplete();
           if (autoAccept)
           {
-              peer.expectDisposition();
-              peer.expectDisposition();
+              peer.expectDisposition().withFirst(0);
+              peer.expectDisposition().withFirst(1);
           }
 
           // Consume messages 1 and 2 which should not provoke credit 
replenishment
@@ -2692,7 +2692,7 @@ public class ReceiverTest extends 
ImperativeClientTestCase {
           peer.waitForScriptToComplete();
           if (autoAccept)
           {
-              peer.expectDisposition();
+              peer.expectDisposition().withFirst(2);
           }
           peer.expectFlow().withLinkCredit(3);
 
@@ -2703,8 +2703,8 @@ public class ReceiverTest extends 
ImperativeClientTestCase {
           peer.waitForScriptToComplete();
           if (autoAccept)
           {
-              peer.expectDisposition();
-              peer.expectDisposition();
+              peer.expectDisposition().withFirst(3);
+              peer.expectDisposition().withFirst(4);
           }
 
           // Consume messages 4 and 5 which should not provoke credit 
replenishment
@@ -2716,7 +2716,7 @@ public class ReceiverTest extends 
ImperativeClientTestCase {
           peer.waitForScriptToComplete();
           if (autoAccept)
           {
-              peer.expectDisposition();
+              peer.expectDisposition().withFirst(5);
           }
           peer.expectFlow().withLinkCredit(6);
 
@@ -2729,8 +2729,8 @@ public class ReceiverTest extends 
ImperativeClientTestCase {
           peer.waitForScriptToComplete();
           if (autoAccept)
           {
-              peer.expectDisposition();
-              peer.expectDisposition();
+              peer.expectDisposition().withFirst(6);
+              peer.expectDisposition().withFirst(7);
           }
 
           // Consume deliveries 7 and 8 which should not flow as we should be
@@ -2742,8 +2742,8 @@ public class ReceiverTest extends 
ImperativeClientTestCase {
           peer.waitForScriptToComplete();
           if (autoAccept)
           {
-              peer.expectDisposition();
-              peer.expectDisposition();
+              peer.expectDisposition().withFirst(8);
+              peer.expectDisposition().withFirst(9);
           }
 
           // Now consume 9 and 10 but we still shouldn't flow more credit 
because

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to