qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject [2/2] qpid-jms git commit: set the dynamic node properties map to indicate a delete-on-close lifetime policy for the temporary destinations
Date Mon, 05 Jan 2015 15:32:59 GMT
set the dynamic node properties map to indicate a delete-on-close lifetime policy for the temporary
destinations


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/372f0f2e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/372f0f2e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/372f0f2e

Branch: refs/heads/master
Commit: 372f0f2ee2df5144c22c13e8b2f0f92afd8df415
Parents: 382cfa2
Author: Robert Gemmell <robbie@apache.org>
Authored: Mon Jan 5 13:07:38 2015 +0000
Committer: Robert Gemmell <robbie@apache.org>
Committed: Mon Jan 5 13:08:17 2015 +0000

----------------------------------------------------------------------
 .../qpid/jms/provider/amqp/AmqpTemporaryDestination.java | 11 ++++++++++-
 .../org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java  |  6 ++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/372f0f2e/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
index 47c8832..048a5bc 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
@@ -16,7 +16,12 @@
  */
 package org.apache.qpid.jms.provider.amqp;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.qpid.jms.JmsDestination;
+import org.apache.qpid.proton.amqp.Symbol;
+import org.apache.qpid.proton.amqp.messaging.DeleteOnClose;
 import org.apache.qpid.proton.amqp.messaging.Source;
 import org.apache.qpid.proton.amqp.messaging.Target;
 import org.apache.qpid.proton.amqp.messaging.TerminusDurability;
@@ -42,6 +47,7 @@ import org.slf4j.LoggerFactory;
  */
 public class AmqpTemporaryDestination extends AmqpAbstractResource<JmsDestination, Sender>
{
 
+    public static final Symbol DYNAMIC_NODE_LIFETIME_POLICY = Symbol.valueOf("lifetime-policy");
     private static final String TEMP_QUEUE_CREATOR = "temp-queue-creator:";
     private static final String TEMP_TOPIC_CREATOR = "temp-topic-creator:";
 
@@ -105,7 +111,10 @@ public class AmqpTemporaryDestination extends AmqpAbstractResource<JmsDestinatio
         target.setDurable(TerminusDurability.NONE);
         target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
 
-        //TODO: set the dynamic node lifetime-policy
+        // Set the dynamic node lifetime-policy
+        Map<Symbol, Object> dynamicNodeProperties = new HashMap<Symbol, Object>();
+        dynamicNodeProperties.put(DYNAMIC_NODE_LIFETIME_POLICY, DeleteOnClose.getInstance());
+        target.setDynamicNodeProperties(dynamicNodeProperties);
 
         Sender sender = session.getProtonSession().sender(senderLinkName);
         sender.setSource(source);

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/372f0f2e/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
index 5a714a8..9863389 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/test/testpeer/TestAmqpPeer.java
@@ -20,6 +20,7 @@ package org.apache.qpid.jms.test.testpeer;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasEntry;
 import static org.hamcrest.Matchers.instanceOf;
 import static org.hamcrest.Matchers.notNullValue;
 import static org.hamcrest.Matchers.nullValue;
@@ -31,6 +32,7 @@ import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.qpid.jms.provider.amqp.AmqpTemporaryDestination;
 import org.apache.qpid.jms.test.testpeer.basictypes.ReceiverSettleMode;
 import org.apache.qpid.jms.test.testpeer.basictypes.Role;
 import org.apache.qpid.jms.test.testpeer.basictypes.SenderSettleMode;
@@ -56,6 +58,7 @@ import org.apache.qpid.jms.test.testpeer.describedtypes.sections.PropertiesDescr
 import org.apache.qpid.jms.test.testpeer.matchers.AttachMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.BeginMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.CloseMatcher;
+import org.apache.qpid.jms.test.testpeer.matchers.DeleteOnCloseMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.DetachMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.DispositionMatcher;
 import org.apache.qpid.jms.test.testpeer.matchers.EndMatcher;
@@ -437,11 +440,14 @@ public class TestAmqpPeer implements AutoCloseable
 
     public void expectTempQueueCreationAttach(final String dynamicAddress)
     {
+        DeleteOnCloseMatcher lifetimePolicyMatcher = new DeleteOnCloseMatcher();
+
         TargetMatcher targetMatcher = new TargetMatcher();
         targetMatcher.withAddress(nullValue());
         targetMatcher.withDynamic(equalTo(true));
         targetMatcher.withDurable(equalTo(TerminusDurability.NONE));
         targetMatcher.withExpiryPolicy(equalTo(TerminusExpiryPolicy.LINK_DETACH));
+        targetMatcher.withDynamicNodeProperties(hasEntry(equalTo(AmqpTemporaryDestination.DYNAMIC_NODE_LIFETIME_POLICY),
lifetimePolicyMatcher));
 
         final AttachMatcher attachMatcher = new AttachMatcher()
                 .withName(notNullValue())


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


Mime
View raw message