You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2015/01/05 18:35:13 UTC
[2/3] qpid-jms git commit: add capability to indicate dynamic node
type as TemporaryTopic, match on this in tests,
add explicit Session#createTemporaryTopic test
add capability to indicate dynamic node type as TemporaryTopic, match on this in tests, add explicit Session#createTemporaryTopic test
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/8cad0607
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/8cad0607
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/8cad0607
Branch: refs/heads/master
Commit: 8cad0607b58ba012131899fda629078ea8cc2cbc
Parents: 84e8989
Author: Robert Gemmell <ro...@apache.org>
Authored: Mon Jan 5 15:52:06 2015 +0000
Committer: Robert Gemmell <ro...@apache.org>
Committed: Mon Jan 5 15:52:06 2015 +0000
----------------------------------------------------------------------
.../provider/amqp/AmqpTemporaryDestination.java | 7 ++++++-
.../jms/integration/SessionIntegrationTest.java | 22 ++++++++++++++++++++
.../qpid/jms/test/testpeer/TestAmqpPeer.java | 14 ++++++++++---
3 files changed, 39 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8cad0607/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 af78455..b1af06a 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
@@ -49,6 +49,7 @@ public class AmqpTemporaryDestination extends AmqpAbstractResource<JmsDestinatio
public static final Symbol DYNAMIC_NODE_LIFETIME_POLICY = Symbol.valueOf("lifetime-policy");
public static final Symbol TEMP_QUEUE_CAPABILITY = Symbol.valueOf("temporary-queue");//TODO: decide location of constant
+ public static final Symbol TEMP_TOPIC_CAPABILITY = Symbol.valueOf("temporary-topic");//TODO: decide location of constant
private static final String TEMP_QUEUE_CREATOR = "temp-queue-creator:";
private static final String TEMP_TOPIC_CREATOR = "temp-topic-creator:";
@@ -118,7 +119,11 @@ public class AmqpTemporaryDestination extends AmqpAbstractResource<JmsDestinatio
target.setDynamicNodeProperties(dynamicNodeProperties);
// Set the capability to indicate the node type being created
- target.setCapabilities(TEMP_QUEUE_CAPABILITY);
+ if (resource.isQueue()) {
+ target.setCapabilities(TEMP_QUEUE_CAPABILITY);
+ } else {
+ target.setCapabilities(TEMP_TOPIC_CAPABILITY);
+ }
Sender sender = session.getProtonSession().sender(senderLinkName);
sender.setSource(source);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8cad0607/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index 90e8e02..126bba9 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -40,6 +40,7 @@ import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.TopicSubscriber;
@@ -171,6 +172,27 @@ public class SessionIntegrationTest extends QpidJmsTestCase {
}
@Test(timeout = 5000)
+ public void testCreateTemporaryTopic() throws Exception {
+ try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
+ Connection connection = testFixture.establishConnecton(testPeer);
+ connection.start();
+
+ testPeer.expectBegin(true);
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ String dynamicAddress = "myTempTopicAddress";
+ testPeer.expectTempTopicCreationAttach(dynamicAddress);
+
+ TemporaryTopic tempTopic = session.createTemporaryTopic();
+ assertNotNull("TemporaryTopic object was null", tempTopic);
+ assertNotNull("TemporaryTopic name was null", tempTopic.getTopicName());
+ assertEquals("TemporaryTopic name not as expected", dynamicAddress, tempTopic.getTopicName());
+
+ testPeer.waitForAllHandlersToComplete(1000);
+ }
+ }
+
+ @Test(timeout = 5000)
public void testCreateDurableTopicSubscriber() throws Exception {
try (TestAmqpPeer testPeer = new TestAmqpPeer(IntegrationTestFixture.PORT);) {
Connection connection = testFixture.establishConnecton(testPeer);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8cad0607/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 f7498f9..1edc3bf 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
@@ -441,15 +441,23 @@ public class TestAmqpPeer implements AutoCloseable
public void expectTempQueueCreationAttach(final String dynamicAddress)
{
- DeleteOnCloseMatcher lifetimePolicyMatcher = new DeleteOnCloseMatcher();
+ expectTempNodeCreationAttach(dynamicAddress, AmqpTemporaryDestination.TEMP_QUEUE_CAPABILITY);
+ }
+ public void expectTempTopicCreationAttach(final String dynamicAddress)
+ {
+ expectTempNodeCreationAttach(dynamicAddress, AmqpTemporaryDestination.TEMP_TOPIC_CAPABILITY);
+ }
+
+ public void expectTempNodeCreationAttach(final String dynamicAddress, final Symbol nodeTypeCapability)
+ {
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));
- targetMatcher.withCapabilities(arrayContaining(AmqpTemporaryDestination.TEMP_QUEUE_CAPABILITY));
+ targetMatcher.withDynamicNodeProperties(hasEntry(equalTo(AmqpTemporaryDestination.DYNAMIC_NODE_LIFETIME_POLICY), new DeleteOnCloseMatcher()));
+ targetMatcher.withCapabilities(arrayContaining(nodeTypeCapability));
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