summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2007-11-05 11:19:49 +0000
committerMartin Ritchie <ritchiem@apache.org>2007-11-05 11:19:49 +0000
commit6a05d876c5f1e9975ea62b30da0ed7c663019c16 (patch)
tree01853179980fbbe85ae6f476928895e5cd2db82e
parent7bca4dd5eabee4e8742b09b6b8e3ce80cae3577d (diff)
downloadqpid-python-6a05d876c5f1e9975ea62b30da0ed7c663019c16.tar.gz
Additional Test for ConnectionURLTest, ensuring retries are correctly parsed.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@591960 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java49
1 files changed, 43 insertions, 6 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
index bfbba61913..6c872a0e10 100644
--- a/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
+++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
@@ -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 @@ public class ConnectionURLTest extends TestCase
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 @@ public class ConnectionURLTest extends TestCase
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");
}