summaryrefslogtreecommitdiff
path: root/java/systests/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/systests/src')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
index fe2ea6ef10..328719813a 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
@@ -292,9 +292,10 @@ public class ConnectionTest extends QpidBrokerTestCase
}
}
- public void testClientIDVerification() throws Exception
+ public void testClientIDVerificationForSameUser() throws Exception
{
- System.setProperty("qpid.verify_client_id", "true");
+ setTestSystemProperty("qpid.verify_client_id", "true");
+
BrokerDetails broker = getBroker();
try
{
@@ -302,19 +303,34 @@ public class ConnectionTest extends QpidBrokerTestCase
"client_id", "test");
Connection con2 = new AMQConnection(broker.toString(), "guest", "guest",
- "client_id", "test");
+ "client_id", "test");
fail("The client should throw a ConnectionException stating the" +
" client ID is not unique");
}
catch (Exception e)
{
- assertTrue("Incorrect exception thrown",
+ assertTrue("Incorrect exception thrown: " + e.getMessage(),
e.getMessage().contains("ClientID must be unique"));
}
- finally
+ }
+
+ public void testClientIDVerificationForDifferentUsers() throws Exception
+ {
+ setTestSystemProperty("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(), "admin", "admin",
+ "client_id", "test");
+ }
+ catch (Exception e)
{
- System.setProperty("qpid.verify_client_id", "false");
+ fail("Unexpected exception thrown, client id was not unique but usernames were different! " + e.getMessage());
}
}