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 26e2175f PROTON-2783 Check optional expectations if processing 
connection drop
26e2175f is described below

commit 26e2175f899a882cbf9e2827b3601aeb51942e8e
Author: Timothy Bish <[email protected]>
AuthorDate: Thu Dec 14 15:59:38 2023 -0500

    PROTON-2783 Check optional expectations if processing connection drop
    
    Check script when handling connection drop and discard optional
    expectations so that trailing connection drop expecatation can trigger
    test pass.
---
 .../apache/qpid/protonj2/test/driver/AMQPTestDriver.java   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/AMQPTestDriver.java
 
b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/AMQPTestDriver.java
index 7bbd2b88..61645bff 100644
--- 
a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/AMQPTestDriver.java
+++ 
b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/AMQPTestDriver.java
@@ -270,9 +270,17 @@ public class AMQPTestDriver implements 
Consumer<ByteBuffer> {
             // Check if the currently pending scripted expectation is for the 
connection
             // to drop in which case we remove it and unblock any waiters on 
the script
             // to complete, if this is the final scripted entry.
-            final ScriptedElement scriptEntry = script.peek();
-            if (scriptEntry instanceof ConnectionDropExpectation) {
-                processScript(script.poll());
+            while (true) {
+                final ScriptedElement scriptEntry = script.peek();
+
+                if (scriptEntry instanceof ConnectionDropExpectation) {
+                    processScript(script.poll());
+                    return;
+                } else if (scriptEntry.isOptional()) {
+                    script.poll();
+                } else {
+                    return;
+                }
             }
         }
     }


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

Reply via email to