You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2025/12/09 16:10:11 UTC

(qpid-protonj2) branch main updated: PROTON-2912 Clean up and add a test to cover the use case

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 6e143858 PROTON-2912 Clean up and add a test to cover the use case
6e143858 is described below

commit 6e143858779ff9596105ec4ef399be73678a69a5
Author: Timothy Bish <ta...@gmail.com>
AuthorDate: Tue Dec 9 11:10:01 2025 -0500

    PROTON-2912 Clean up and add a test to cover the use case
---
 .../org/apache/qpid/protonj2/client/impl/SenderTest.java | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/SenderTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/SenderTest.java
index 78fd08e9..a7fefc4a 100644
--- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/SenderTest.java
+++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/SenderTest.java
@@ -66,6 +66,7 @@ import org.apache.qpid.protonj2.client.exceptions.ClientOperationTimedOutExcepti
 import org.apache.qpid.protonj2.client.exceptions.ClientResourceRemotelyClosedException;
 import org.apache.qpid.protonj2.client.exceptions.ClientSendTimedOutException;
 import org.apache.qpid.protonj2.client.exceptions.ClientUnsupportedOperationException;
+import org.apache.qpid.protonj2.client.impl.ClientDeliveryState.ClientRejected;
 import org.apache.qpid.protonj2.client.test.ImperativeClientTestCase;
 import org.apache.qpid.protonj2.engine.DeliveryTagGenerator;
 import org.apache.qpid.protonj2.test.driver.ProtonTestServer;
@@ -76,6 +77,7 @@ import org.apache.qpid.protonj2.test.driver.matchers.messaging.DeliveryAnnotatio
 import org.apache.qpid.protonj2.test.driver.matchers.transport.TransferPayloadCompositeMatcher;
 import org.apache.qpid.protonj2.test.driver.matchers.types.EncodedAmqpValueMatcher;
 import org.apache.qpid.protonj2.types.DeliveryTag;
+import org.apache.qpid.protonj2.types.messaging.Rejected;
 import org.apache.qpid.protonj2.types.transport.AmqpError;
 import org.apache.qpid.protonj2.types.transport.LinkError;
 import org.apache.qpid.protonj2.types.transport.ReceiverSettleMode;
@@ -2470,7 +2472,11 @@ public class SenderTest extends ImperativeClientTestCase {
             peer.expectBegin().respond();
             peer.expectAttach().ofSender().respond();
             peer.remoteFlow().withLinkCredit(2).queue();
-            peer.expectTransfer().withNonNullPayload().withMore(false).respond().withSettled(true).withState().rejected();
+            peer.expectTransfer().withNonNullPayload()
+                                 .withMore(false)
+                                 .respond()
+                                 .withSettled(true)
+                                 .withState().rejected("RejectedA", "RejectedB");
             peer.start();
 
             URI remoteURI = peer.getServerURI();
@@ -2493,6 +2499,14 @@ public class SenderTest extends ImperativeClientTestCase {
             assertFalse(tracker.remoteState().isAccepted());
             assertTrue(tracker.remoteState().getType().equals(DeliveryState.Type.REJECTED));
 
+            ClientRejected remoteState = (ClientRejected) tracker.remoteState();
+            Rejected protonState = (Rejected) remoteState.getProtonDeliveryState();
+
+            assertNotNull(protonState);
+            assertNotNull(protonState.getError());
+            assertEquals("RejectedA", protonState.getError().getCondition().toString());
+            assertEquals("RejectedB", protonState.getError().getDescription());
+
             peer.waitForScriptToComplete(5, TimeUnit.SECONDS);
             peer.expectDetach().respond();
             peer.expectClose().respond();


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