From 79f25ae18103afc16bd92abf8ed31df1992f13cf Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Tue, 13 Sep 2011 00:26:40 +0000 Subject: QPID-3428: make the Java broker validate 0-10 Session names, enabling it to satisfy the clients new ClientID verification feature. Misc updates to the clients verification process. Applied patch from Andrew MacBean git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1169982 13f79535-47bb-0310-9956-ffa450edef68 --- .../unit/client/connection/ConnectionTest.java | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'java/systests') 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()); } } -- cgit v1.2.1