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 a1609a75 PROTON-2739 Add some extra API for the Attach injection type a1609a75 is described below commit a1609a750933b11764d4d6da0d469a2848b09b23 Author: Timothy Bish <tabish...@gmail.com> AuthorDate: Tue Jun 20 16:21:38 2023 -0400 PROTON-2739 Add some extra API for the Attach injection type Allows for simpler test writing where the API names provide the values for enumeration types and string / symbol entries. --- .../test/driver/actions/AttachInjectAction.java | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) 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 2ced891c..3914edd9 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 @@ -23,6 +23,10 @@ import java.util.UUID; import org.apache.qpid.protonj2.test.driver.AMQPTestDriver; import org.apache.qpid.protonj2.test.driver.SessionTracker; +import org.apache.qpid.protonj2.test.driver.codec.messaging.DeleteOnClose; +import org.apache.qpid.protonj2.test.driver.codec.messaging.DeleteOnNoLinks; +import org.apache.qpid.protonj2.test.driver.codec.messaging.DeleteOnNoLinksOrMessages; +import org.apache.qpid.protonj2.test.driver.codec.messaging.DeleteOnNoMessages; import org.apache.qpid.protonj2.test.driver.codec.messaging.Outcome; import org.apache.qpid.protonj2.test.driver.codec.messaging.Source; import org.apache.qpid.protonj2.test.driver.codec.messaging.Target; @@ -372,11 +376,39 @@ public class AttachInjectAction extends AbstractPerformativeInjectAction<Attach> return this; } + public SourceBuilder withDurabilityOfNone() { + return withDurability(TerminusDurability.NONE); + } + + public SourceBuilder withDurabilityOfConfiguration() { + return withDurability(TerminusDurability.CONFIGURATION); + } + + public SourceBuilder withDurabilityOfUnsettledState() { + return withDurability(TerminusDurability.UNSETTLED_STATE); + } + public SourceBuilder withDurability(TerminusDurability durability) { source.setDurable(durability.getValue()); return this; } + public SourceBuilder withExpiryPolicyOnConnectionClose() { + return withExpiryPolicy(TerminusExpiryPolicy.CONNECTION_CLOSE); + } + + public SourceBuilder withExpiryPolicyOnSessionEnd() { + return withExpiryPolicy(TerminusExpiryPolicy.SESSION_END); + } + + public SourceBuilder withExpiryPolicyOnLinkDetach() { + return withExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH); + } + + public SourceBuilder withExpiryPolicyOfNever() { + return withExpiryPolicy(TerminusExpiryPolicy.NEVER); + } + public SourceBuilder withExpiryPolicy(TerminusExpiryPolicy expiryPolicy) { source.setExpiryPolicy(expiryPolicy.getPolicy()); return this; @@ -430,6 +462,30 @@ public class AttachInjectAction extends AbstractPerformativeInjectAction<Attach> return this; } + public SourceBuilder withLifetimePolicyOfDeleteOnClose() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnClose()); + } + + public SourceBuilder withLifetimePolicyOfDeleteOnNoLinks() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnNoLinks()); + } + + public SourceBuilder withLifetimePolicyOfDeleteOnNoLinksOrMessages() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnNoLinksOrMessages()); + } + + public SourceBuilder withLifetimePolicyOfDeleteOnNoNoMessages() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnNoMessages()); + } + + public SourceBuilder withDistributionModeOfCopy() { + return withDistributionMode("COPY"); + } + + public SourceBuilder withDistributionModeOfMove() { + return withDistributionMode("MOVE"); + } + public SourceBuilder withDistributionMode(String mode) { source.setDistributionMode(Symbol.valueOf(mode)); return this; @@ -502,11 +558,39 @@ public class AttachInjectAction extends AbstractPerformativeInjectAction<Attach> return this; } + public TargetBuilder withDurabilityOfNone() { + return withDurability(TerminusDurability.NONE); + } + + public TargetBuilder withDurabilityOfConfiguration() { + return withDurability(TerminusDurability.CONFIGURATION); + } + + public TargetBuilder withDurabilityOfUnsettledState() { + return withDurability(TerminusDurability.UNSETTLED_STATE); + } + public TargetBuilder withDurability(TerminusDurability durability) { target.setDurable(durability.getValue()); return this; } + public TargetBuilder withExpiryPolicyOnConnectionClose() { + return withExpiryPolicy(TerminusExpiryPolicy.CONNECTION_CLOSE); + } + + public TargetBuilder withExpiryPolicyOnSessionEnd() { + return withExpiryPolicy(TerminusExpiryPolicy.SESSION_END); + } + + public TargetBuilder withExpiryPolicyOnLinkDetach() { + return withExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH); + } + + public TargetBuilder withExpiryPolicyOfNever() { + return withExpiryPolicy(TerminusExpiryPolicy.NEVER); + } + public TargetBuilder withExpiryPolicy(TerminusExpiryPolicy expiryPolicy) { target.setExpiryPolicy(expiryPolicy.getPolicy()); return this; @@ -560,6 +644,22 @@ public class AttachInjectAction extends AbstractPerformativeInjectAction<Attach> return this; } + public TargetBuilder withLifetimePolicyOfDeleteOnClose() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnClose()); + } + + public TargetBuilder withLifetimePolicyOfDeleteOnNoLinks() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnNoLinks()); + } + + public TargetBuilder withLifetimePolicyOfDeleteOnNoLinksOrMessages() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnNoLinksOrMessages()); + } + + public TargetBuilder withLifetimePolicyOfDeleteOnNoNoMessages() { + return withDynamicNodeProperty("lifetime-policy", new DeleteOnNoMessages()); + } + public TargetBuilder withCapabilities(String... capabilities) { target.setCapabilities(TypeMapper.toSymbolArray(capabilities)); return this; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org