diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2011-07-08 22:45:21 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2011-07-08 22:45:21 +0000 |
| commit | a93e66a694626d4c27b44b097d4dbf1942ac127f (patch) | |
| tree | b94005cd33cc44f07805b2bd8737eebdadf1f86a /java | |
| parent | 68275bc471af92d51ba0f35e4ceb75fe4685c6c7 (diff) | |
| download | qpid-python-a93e66a694626d4c27b44b097d4dbf1942ac127f.tar.gz | |
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.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1144532 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java | 42 | ||||
| -rw-r--r-- | java/test-profiles/JavaExcludes | 2 |
2 files changed, 35 insertions, 9 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 d17ead13aa..124e756fad 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 @@ -85,17 +85,17 @@ public class ConnectionTest extends QpidBrokerTestCase 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 QpidBrokerTestCase 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 QpidBrokerTestCase } connection.close(); } - + public void testUnsupportedSASLMechanism() throws Exception { BrokerDetails broker = getBroker(); @@ -287,11 +287,37 @@ public class ConnectionTest extends QpidBrokerTestCase { 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); diff --git a/java/test-profiles/JavaExcludes b/java/test-profiles/JavaExcludes index 409ba9d832..57d7681e9c 100644 --- a/java/test-profiles/JavaExcludes +++ b/java/test-profiles/JavaExcludes @@ -86,4 +86,4 @@ org.apache.qpid.server.persistent.NoLocalAfterRecoveryTest#* // Excluding here does not reduce test coverage. org.apache.qpid.server.configuration.ServerConfigurationFileTest#* - +org.apache.qpid.test.unit.client.connection.ConnectionTest#testClientIDVerification |
