qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grk...@apache.org
Subject svn commit: r979210 - in /qpid/branches/0.5.x-dev/qpid/java/client/src: main/java/org/apache/qpid/client/AMQConnectionURL.java test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
Date Mon, 26 Jul 2010 09:27:23 GMT
Author: grkvlt
Date: Mon Jul 26 09:27:21 2010
New Revision: 979210

URL: http://svn.apache.org/viewvc?rev=979210&view=rev
Log:
QPID-2697: Print AMQConnectionURL options

Modified:
    qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java
    qpid/branches/0.5.x-dev/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java

Modified: qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java?rev=979210&r1=979209&r2=979210&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionURL.java
Mon Jul 26 09:27:21 2010
@@ -254,14 +254,22 @@ public class AMQConnectionURL implements
 
     private String optionsToString()
     {
-        StringBuffer sb = new StringBuffer();
-
-        sb.append("?" + OPTIONS_BROKERLIST + "='");
-
+        StringBuffer sb = new StringBuffer("?");
+        
+        if (!_options.isEmpty())
+        {
+            for (Map.Entry<String, String> option : _options.entrySet())
+            {
+                sb.append(option.getKey()).append("='").append(option.getValue()).append("'");
+                sb.append(URLHelper.DEFAULT_OPTION_SEPERATOR);
+            }
+        }
+        
+        sb.append(OPTIONS_BROKERLIST).append("='");
         for (BrokerDetails service : _brokers)
         {
             sb.append(service.toString());
-            sb.append(';');
+            sb.append(URLHelper.BROKER_SEPARATOR);
         }
 
         sb.deleteCharAt(sb.length() - 1);

Modified: qpid/branches/0.5.x-dev/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java?rev=979210&r1=979209&r2=979210&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
Mon Jul 26 09:27:21 2010
@@ -536,6 +536,18 @@ public class ConnectionURLTest extends T
         assertTrue(connectionurl.getOption("timeout").equals("200"));
         assertTrue(connectionurl.getOption("immediatedelivery").equals("true"));
     }
+    
+    /**
+     * Test that options other than failover and brokerlist are returned in the string representation.
+     * <p>
+     * QPID-2697
+     */
+    public void testOptionToString() throws Exception
+    {
+        ConnectionURL url = new AMQConnectionURL("amqp://user:pass@temp/test?maxprefetch='12345'&brokerlist='tcp://localhost:5672'");
+        
+        assertTrue("String representation should contain options and values", url.toString().contains("maxprefetch='12345'"));
+    }
 
     public static junit.framework.Test suite()
     {



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message