You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2008/02/27 20:59:14 UTC

svn commit: r631697 - /incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java

Author: rajith
Date: Wed Feb 27 11:59:13 2008
New Revision: 631697

URL: http://svn.apache.org/viewvc?rev=631697&view=rev
Log:
Added another test to check for URISyntaxException when both routingkey and bindingkey is specified

Modified:
    incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java?rev=631697&r1=631696&r2=631697&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/destinationurl/DestinationURLTest.java Wed Feb 27 11:59:13 2008
@@ -23,11 +23,17 @@
 import junit.framework.TestCase;
 
 import org.apache.qpid.exchange.ExchangeDefaults;
+import org.apache.qpid.test.unit.basic.PropertyValueTest;
 import org.apache.qpid.url.AMQBindingURL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.net.URISyntaxException;
 
 public class DestinationURLTest extends TestCase
 {
+    private static final Logger _logger = LoggerFactory.getLogger(DestinationURLTest.class);
+
     public void testFullURL() throws URISyntaxException
     {
 
@@ -141,7 +147,7 @@
     public void testDestinationWithMultiBindingKeys() throws URISyntaxException
     {
 
-        String url = "exchangeClass://exchangeName/Destination/?bindingKey='key1',bindingKey='key2'";
+        String url = "exchangeClass://exchangeName/Destination/?bindingkey='key1',bindingkey='key2'";
 
         AMQBindingURL dest = new AMQBindingURL(url);
 
@@ -151,6 +157,26 @@
         assertTrue(dest.getQueueName().equals(""));
 
         assertTrue(dest.getBindingKeys().length == 2);
+    }
+
+    // You can only specify only a routing key or binding key, but not both.
+    public void testDestinationIfOnlyRoutingKeyOrBindingKeyIsSpecified() throws URISyntaxException
+    {
+
+        String url = "exchangeClass://exchangeName/Destination/?bindingkey='key1',routingkey='key2'";
+        boolean exceptionThrown = false;
+        try
+        {
+
+            AMQBindingURL dest = new AMQBindingURL(url);
+        }
+        catch(URISyntaxException e)
+        {
+            exceptionThrown = true;
+            _logger.info("Exception thrown",e);
+        }
+
+        assertTrue("Failed to throw an URISyntaxException when both the bindingkey and routingkey is specified",exceptionThrown);
     }
 
     public static junit.framework.Test suite()