Author: ritchiem
Date: Tue Nov 28 05:05:27 2006
New Revision: 480031

URL: http://svn.apache.org/viewvc?view=rev&rev=480031
Log:
QPID-71

Moved some tests from ConnectionURLTest to BrokerDetailsTest to better reflect 
the actual class being tested.

Added:
    
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/
    
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
   (with props)
Modified:
    
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java

Added: 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java?view=auto&rev=480031
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
 (added)
+++ 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
 Tue Nov 28 05:05:27 2006
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  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
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.    
+ *
+ * 
+ */
+package org.apache.qpid.test.unit.client.BrokerDetails;
+
+import junit.framework.TestCase;
+import org.apache.qpid.client.AMQBrokerDetails;
+import org.apache.qpid.url.URLSyntaxException;
+
+public class BrokerDetailsTest extends TestCase
+{
+
+    public void testMultiParameters() throws URLSyntaxException
+    {
+        String url = 
"tcp://localhost:5672?timeout='200',immediatedelivery='true'";
+
+        AMQBrokerDetails broker = new AMQBrokerDetails(url);
+
+        assertTrue(broker.getOption("timeout").equals("200"));
+        assertTrue(broker.getOption("immediatedelivery").equals("true"));
+    }
+
+    public void testVMBroker() throws URLSyntaxException
+    {
+        String url = "vm://:2";
+
+        AMQBrokerDetails broker = new AMQBrokerDetails(url);
+        assertTrue(broker.getTransport().equals("vm"));
+        assertEquals(broker.getPort(), 2);
+    }
+
+    public void testTransportsDefaultToTCP() throws URLSyntaxException
+    {
+        String url = "localhost:5672";
+
+        AMQBrokerDetails broker = new AMQBrokerDetails(url);
+        assertTrue(broker.getTransport().equals("tcp"));
+    }
+
+    public void testCheckDefaultPort() throws URLSyntaxException
+    {
+        String url = "tcp://localhost";
+
+        AMQBrokerDetails broker = new AMQBrokerDetails(url);
+        assertTrue(broker.getPort() == AMQBrokerDetails.DEFAULT_PORT);
+    }
+
+    public void testBothDefaults() throws URLSyntaxException
+    {
+        String url = "localhost";
+
+        AMQBrokerDetails broker = new AMQBrokerDetails(url);
+
+        assertTrue(broker.getTransport().equals("tcp"));
+        assertTrue(broker.getPort() == AMQBrokerDetails.DEFAULT_PORT);
+    }
+
+    public void testWrongOptionSeparatorInBroker()
+    {
+        String url = "tcp://localhost:5672+option='value'";
+        try
+        {
+            new AMQBrokerDetails(url);
+        }
+        catch (URLSyntaxException urise)
+        {
+            assertTrue(urise.getReason().equals("Illegal character in port 
number"));
+        }
+
+    }
+
+    public static junit.framework.Test suite()
+    {
+        return new junit.framework.TestSuite(BrokerDetailsTest.class);
+    }
+}

Propchange: 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java?view=diff&rev=480031&r1=480030&r2=480031
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
 Tue Nov 28 05:05:27 2006
@@ -310,29 +310,7 @@
         assertTrue(connectionurl.getBrokerCount() == 1);
     }
 
-    // FIXME Connection now parses but result is wrong QPID-71
-    /*
-    public void testWrongOptionSeparatorInBroker()
-    {
-        String url = 
"amqp://user:@/test?brokerlist='tcp://localhost:5672+option='value''";
-
-        try
-        {
-            AMQConnectionURL connection = new AMQConnectionURL(url);
 
-            Float version = 
Float.parseFloat(System.getProperty("java.specification.version"));
-            if (version > 1.5)
-            {
-                fail("URL Should not parse on Java " + version + " Connection 
is:" + connection);
-            }
-        }
-        catch (URLSyntaxException urise)
-        {
-            assertTrue(urise.getReason().equals("Illegal character in port 
number"));
-        }
-
-    }
-    */
 
     public void testWrongOptionSeparatorInOptions()
     {
@@ -349,18 +327,6 @@
 
     }
 
-    public void testTransportsDefaultToTCP() throws URLSyntaxException
-    {
-        String url = 
"amqp://guest:guest@/test?brokerlist='localhost:5672;myhost:5673'&failover='roundrobin'";
-
-        AMQConnectionURL connection = new AMQConnectionURL(url);
-
-        BrokerDetails broker = connection.getBrokerDetails(0);
-        assertTrue(broker.getTransport().equals("tcp"));
-
-        broker = connection.getBrokerDetails(1);
-        assertTrue(broker.getTransport().equals("tcp"));
-    }
 
     public void testNoUserDetailsProvidedWithClientID()
 


Reply via email to