diff options
author | Alex Rudyy <orudyy@apache.org> | 2013-07-17 16:10:32 +0000 |
---|---|---|
committer | Alex Rudyy <orudyy@apache.org> | 2013-07-17 16:10:32 +0000 |
commit | 286ece348bd9f70fc4eddfb990df59a3156745b0 (patch) | |
tree | 3e1bc3978d0ef0844ded6736b508a005c8bfdee9 | |
parent | 326e756f2ff38c46f9fb7fcd73f178bc6e2afbd6 (diff) | |
download | qpid-python-286ece348bd9f70fc4eddfb990df59a3156745b0.tar.gz |
QPID-4994: Remove redundant binding URL options for subscription name and client id
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1504185 13f79535-47bb-0310-9956-ffa450edef68
4 files changed, 41 insertions, 39 deletions
diff --git a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java index e13180424b..4c558906b3 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java +++ b/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.RejectBehaviour; import org.apache.qpid.exchange.ExchangeDefaults; +import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.url.AMQBindingURL; import org.apache.qpid.url.BindingURL; @@ -180,18 +181,6 @@ public class DestinationURLTest extends TestCase assertTrue("Failed to throw an URISyntaxException when both the bindingkey and routingkey is specified",exceptionThrown); } - - public void testDestinationWithDurableTopic() throws URISyntaxException - { - - String url = "topic://amq.topic//testTopicD?durable='true'&autodelete='true'&clientid='test'&subscription='testQueueD'"; - - AMQBindingURL dest = new AMQBindingURL(url); - - assertTrue(dest.getExchangeClass().equalsCharSequence("topic")); - assertTrue(dest.getExchangeName().equalsCharSequence("amq.topic")); - assertTrue(dest.getQueueName().equalsCharSequence("test:testQueueD")); - } public void testExchangeOptionsNotPresent() throws URISyntaxException { @@ -374,6 +363,46 @@ public class DestinationURLTest extends TestCase assertNull("Reject behaviour is unexpected", dest.getRejectBehaviour()); } + public void testBindingUrlWithoutDestinationAndQueueName() throws Exception + { + AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic//?routingkey='testTopic'"); + assertEquals("Unexpected queue name", AMQShortString.EMPTY_STRING, bindingURL.getQueueName()); + assertEquals("Unexpected destination", AMQShortString.EMPTY_STRING, bindingURL.getDestinationName()); + assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey()); + } + + public void testBindingUrlWithoutDestinationAndMissedQueueName() throws Exception + { + AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic/?routingkey='testTopic'"); + assertEquals("Unexpected queue name", AMQShortString.EMPTY_STRING, bindingURL.getQueueName()); + assertEquals("Unexpected destination", AMQShortString.EMPTY_STRING, bindingURL.getDestinationName()); + assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey()); + } + + public void testBindingUrlWithoutQueueName() throws Exception + { + AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic/destination/?routingkey='testTopic'"); + assertEquals("Unexpected queue name", AMQShortString.EMPTY_STRING, bindingURL.getQueueName()); + assertEquals("Unexpected destination", AMQShortString.valueOf("destination"), bindingURL.getDestinationName()); + assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey()); + } + + public void testBindingUrlWithQueueNameWithoutDestination() throws Exception + { + AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic//queueName?routingkey='testTopic'"); + assertEquals("Unexpected queue name", AMQShortString.valueOf("queueName"), bindingURL.getQueueName()); + assertEquals("Unexpected destination", AMQShortString.EMPTY_STRING, bindingURL.getDestinationName()); + assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey()); + } + + public void testBindingUrlWithQueueNameAndDestination() throws Exception + { + AMQBindingURL bindingURL = new AMQBindingURL("topic://amq.topic/destination/queueName?routingkey='testTopic'"); + assertEquals("Unexpected queue name", AMQShortString.valueOf("queueName"), bindingURL.getQueueName()); + assertEquals("Unexpected destination", AMQShortString.valueOf("destination"), bindingURL.getDestinationName()); + assertEquals("Unexpected routing key", AMQShortString.valueOf("testTopic"), bindingURL.getRoutingKey()); + } + public static junit.framework.Test suite() { return new junit.framework.TestSuite(DestinationURLTest.class); diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java b/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java index 3b9a0baab2..11a5a3ad62 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java @@ -56,7 +56,6 @@ public class AMQBindingURL implements BindingURL { BindingURLParser parser = new BindingURLParser(); parser.parse(_url,this); - processOptions(); _logger.debug("URL Parsed: " + this); } @@ -80,10 +79,6 @@ public class AMQBindingURL implements BindingURL setExchangeName(new AMQShortString(exchangeName)); } - private void processOptions() throws URISyntaxException - { - } - public String getURL() { return _url; diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java b/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java index 61585443b1..80a1ae540b 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURL.java @@ -32,8 +32,6 @@ public interface BindingURL public static final String OPTION_AUTODELETE = "autodelete"; public static final String OPTION_DURABLE = "durable"; public static final String OPTION_BROWSE = "browse"; - public static final String OPTION_CLIENTID = "clientid"; - public static final String OPTION_SUBSCRIPTION = "subscription"; public static final String OPTION_ROUTING_KEY = "routingkey"; public static final String OPTION_BINDING_KEY = "bindingkey"; public static final String OPTION_EXCHANGE_AUTODELETE = "exchangeautodelete"; diff --git a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java b/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java index ab9568b15e..2adac843ef 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/url/BindingURLParser.java @@ -419,26 +419,6 @@ public class BindingURLParser { throw new URISyntaxException(String.valueOf(_url),"It is illegal to specify both a routingKey and a bindingKey in the same URL",-1); } - - // check for durable subscriptions - if (_bindingURL.getExchangeClass().equals(ExchangeDefaults.TOPIC_EXCHANGE_CLASS)) - { - String queueName = null; - if (Boolean.parseBoolean(_bindingURL.getOption(BindingURL.OPTION_DURABLE))) - { - if (_bindingURL.containsOption(BindingURL.OPTION_CLIENTID) && _bindingURL.containsOption(BindingURL.OPTION_SUBSCRIPTION)) - { - queueName = _bindingURL.getOption(BindingURL.OPTION_CLIENTID) + ":" + _bindingURL.getOption(BindingURL.OPTION_SUBSCRIPTION); - } - else - { - throw new URISyntaxException(String.valueOf(_url),"Durable subscription must have values for " + BindingURL.OPTION_CLIENTID - + " and " + BindingURL.OPTION_SUBSCRIPTION , -1); - - } - } - _bindingURL.setQueueName(queueName); - } } public static void main(String[] args) |