You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/11/05 12:19:51 UTC

svn commit: r591960 - /incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java

Author: ritchiem
Date: Mon Nov  5 03:19:49 2007
New Revision: 591960

URL: http://svn.apache.org/viewvc?rev=591960&view=rev
Log:
Additional Test for ConnectionURLTest, ensuring retries are correctly parsed.

Modified:
    incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java

Modified: incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java?rev=591960&r1=591959&r2=591960&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java (original)
+++ incubator/qpid/branches/M2.1/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java Mon Nov  5 03:19:49 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -78,6 +78,43 @@
         assertTrue(service.getPort() == 5672);
     }
 
+    public void testSingleTransportwithRetriesURL() throws URLSyntaxException
+    {
+        String url = "amqp://ritchiem:bob@/test?brokerlist='tcp://localhost:5672?retries='1';tcp://localhost:5672?retries='30';tcp://localhost:5672?retries='300''";
+
+        ConnectionURL connectionurl = new AMQConnectionURL(url);
+
+        assertTrue(connectionurl.getFailoverMethod() == null);
+        assertTrue(connectionurl.getUsername().equals("ritchiem"));
+        assertTrue(connectionurl.getPassword().equals("bob"));
+        assertTrue(connectionurl.getVirtualHost().equals("/test"));
+
+        assertTrue(connectionurl.getBrokerCount() == 3);
+
+        BrokerDetails service = connectionurl.getBrokerDetails(0);
+
+        assertTrue(service.getTransport().equals("tcp"));
+        assertTrue(service.getHost().equals("localhost"));
+        assertEquals(5672, service.getPort());
+        assertEquals("1", service.getOption(BrokerDetails.OPTIONS_RETRY));
+
+        service = connectionurl.getBrokerDetails(1);
+
+        assertTrue(service.getTransport().equals("tcp"));
+        assertTrue(service.getHost().equals("localhost"));
+        assertEquals(5672, service.getPort());
+        assertEquals("30", service.getOption(BrokerDetails.OPTIONS_RETRY));
+
+
+         service = connectionurl.getBrokerDetails(2);
+
+        assertTrue(service.getTransport().equals("tcp"));
+        assertTrue(service.getHost().equals("localhost"));
+        assertEquals(5672, service.getPort());
+        assertEquals("300", service.getOption(BrokerDetails.OPTIONS_RETRY));
+
+    }
+
     public void testSingleTransportUsernameBlankPasswordURL() throws URLSyntaxException
     {
         String url = "amqp://ritchiem:@/test?brokerlist='tcp://localhost:5672'";
@@ -463,13 +500,13 @@
 
         AMQConnectionURL conn = new AMQConnectionURL(url);
 
-        assertEquals(conn.getDefaultQueueExchangeName(),"test.direct");
+        assertEquals(conn.getDefaultQueueExchangeName(), "test.direct");
 
-        assertEquals(conn.getDefaultTopicExchangeName(),"test.topic");
+        assertEquals(conn.getDefaultTopicExchangeName(), "test.topic");
 
-        assertEquals(conn.getTemporaryQueueExchangeName(),"tmp.direct");
+        assertEquals(conn.getTemporaryQueueExchangeName(), "tmp.direct");
 
-        assertEquals(conn.getTemporaryTopicExchangeName(),"tmp.topic");
+        assertEquals(conn.getTemporaryTopicExchangeName(), "tmp.topic");
 
     }