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 3ed11479 PROTON-2802 support test Attach with null 
initial-delivery-cout
3ed11479 is described below

commit 3ed11479d585d16a3b5433a698edd861bc38ec4d
Author: Timothy Bish <[email protected]>
AuthorDate: Tue Mar 12 17:02:57 2024 -0400

    PROTON-2802 support test Attach with null initial-delivery-cout
    
    Allows a test script to send an Attach response with the initial
    delivery count set to null.
---
 .../test/driver/actions/AttachInjectAction.java       | 19 +++++++++++++++++++
 .../test/driver/expectations/AttachExpectation.java   |  3 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git 
a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/actions/AttachInjectAction.java
 
b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/actions/AttachInjectAction.java
index e19f6e57..8435417a 100644
--- 
a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/actions/AttachInjectAction.java
+++ 
b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/actions/AttachInjectAction.java
@@ -60,6 +60,7 @@ public class AttachInjectAction extends 
AbstractPerformativeInjectAction<Attach>
 
     private boolean explicitlyNullName;
     private boolean explicitlyNullHandle;
+    private boolean explicitlyNullDeliveryCount;
     private boolean nullSourceRequired;
     private boolean nullTargetRequired;
 
@@ -72,6 +73,18 @@ public class AttachInjectAction extends 
AbstractPerformativeInjectAction<Attach>
         return attach;
     }
 
+    public boolean isExplicitlyNullName() {
+        return explicitlyNullName;
+    }
+
+    public boolean isExplicitlyNullHandle() {
+        return explicitlyNullHandle;
+    }
+
+    public boolean isExplicitlyNullDeliveryCount() {
+        return explicitlyNullDeliveryCount;
+    }
+
     public AttachInjectAction withName(String name) {
         explicitlyNullName = name == null;
         attach.setName(name);
@@ -239,6 +252,12 @@ public class AttachInjectAction extends 
AbstractPerformativeInjectAction<Attach>
         return this;
     }
 
+    public AttachInjectAction withNullInitialDeliveryCount() {
+        attach.setInitialDeliveryCount(null);
+        explicitlyNullDeliveryCount = true;
+        return this;
+    }
+
     public AttachInjectAction withInitialDeliveryCount(long 
initialDeliveryCount) {
         
attach.setInitialDeliveryCount(UnsignedInteger.valueOf(initialDeliveryCount));
         return this;
diff --git 
a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java
 
b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java
index 6a767d1f..aa951f15 100644
--- 
a/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java
+++ 
b/protonj2-test-driver/src/main/java/org/apache/qpid/protonj2/test/driver/expectations/AttachExpectation.java
@@ -221,7 +221,8 @@ public class AttachExpectation extends 
AbstractExpectation<Attach> {
                 }
             }
 
-            if (response.getPerformative().getInitialDeliveryCount() == null) {
+
+            if (response.getPerformative().getInitialDeliveryCount() == null 
&& !response.isExplicitlyNullDeliveryCount()) {
                 Role role = Role.valueOf(response.getPerformative().getRole());
                 if (role == Role.SENDER) {
                     response.withInitialDeliveryCount(0);


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

Reply via email to