qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r1144532 - in /qpid/trunk/qpid/java: systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java test-profiles/JavaExcludes
Date Fri, 08 Jul 2011 22:45:21 GMT
Author: rajith
Date: Fri Jul  8 22:45:21 2011
New Revision: 1144532

URL: http://svn.apache.org/viewvc?rev=1144532&view=rev
Log:
QPID-3269
Added a test case to ensure clientID verification works.
Excluded from the java broker tests as the java broker does not verify
the uniqueness of the session names.

Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
    qpid/trunk/qpid/java/test-profiles/JavaExcludes

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java?rev=1144532&r1=1144531&r2=1144532&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
Fri Jul  8 22:45:21 2011
@@ -85,17 +85,17 @@ public class ConnectionTest extends Qpid
 
 
             AMQSession sess = (AMQSession) conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            
-            sess.declareExchange(new AMQShortString("test.direct"), 
+
+            sess.declareExchange(new AMQShortString("test.direct"),
                     ExchangeDefaults.DIRECT_EXCHANGE_CLASS, false);
 
-            sess.declareExchange(new AMQShortString("tmp.direct"), 
+            sess.declareExchange(new AMQShortString("tmp.direct"),
                     ExchangeDefaults.DIRECT_EXCHANGE_CLASS, false);
 
-            sess.declareExchange(new AMQShortString("tmp.topic"), 
+            sess.declareExchange(new AMQShortString("tmp.topic"),
                     ExchangeDefaults.TOPIC_EXCHANGE_CLASS, false);
 
-            sess.declareExchange(new AMQShortString("test.topic"), 
+            sess.declareExchange(new AMQShortString("test.topic"),
                     ExchangeDefaults.TOPIC_EXCHANGE_CLASS, false);
 
             QueueSession queueSession = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -111,7 +111,7 @@ public class ConnectionTest extends Qpid
             queueSession.close();
 
             TopicSession topicSession = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-            
+
             AMQTopic topic = (AMQTopic) topicSession.createTopic("silly.topic");
 
             assertEquals(topic.getExchangeName().toString(), "test.topic");
@@ -269,7 +269,7 @@ public class ConnectionTest extends Qpid
         }
         connection.close();
     }
-    
+
     public void testUnsupportedSASLMechanism() throws Exception
     {
         BrokerDetails broker = getBroker();
@@ -287,11 +287,37 @@ public class ConnectionTest extends Qpid
         {
             assertTrue("Incorrect exception thrown",
                        e.getMessage().contains("The following SASL mechanisms " +
-                       "[MY_MECH]"  + 
+                       "[MY_MECH]"  +
                        " specified by the client are not supported by the broker"));
         }
     }
 
+    public void testClientIDVerification() throws Exception
+    {
+        System.setProperty("qpid.verify_client_id", "true");
+        BrokerDetails broker = getBroker();
+        try
+        {
+            Connection con = new AMQConnection(broker.toString(), "guest", "guest",
+                                        "client_id", "test");
+
+            Connection con2 = new AMQConnection(broker.toString(), "guest", "guest",
+                    "client_id", "test");
+
+            fail("The client should throw a ConnectionException stating the" +
+                    " client ID is not unique");
+        }
+        catch (Exception e)
+        {
+            assertTrue("Incorrect exception thrown",
+                       e.getMessage().contains("ClientID must be unique"));
+        }
+        finally
+        {
+            System.setProperty("qpid.verify_client_id", "false");
+        }
+    }
+
     public static junit.framework.Test suite()
     {
         return new junit.framework.TestSuite(ConnectionTest.class);

Modified: qpid/trunk/qpid/java/test-profiles/JavaExcludes
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/JavaExcludes?rev=1144532&r1=1144531&r2=1144532&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/JavaExcludes (original)
+++ qpid/trunk/qpid/java/test-profiles/JavaExcludes Fri Jul  8 22:45:21 2011
@@ -86,4 +86,4 @@ org.apache.qpid.server.persistent.NoLoca
 // Excluding here does not reduce test coverage.
 org.apache.qpid.server.configuration.ServerConfigurationFileTest#*
 
-
+org.apache.qpid.test.unit.client.connection.ConnectionTest#testClientIDVerification



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


Mime
View raw message