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 | 2237d8a3bd1b79dfbf78804cc7c6f48fca60fa45 (patch) | |
| tree | 86ef332fe1d72ca788caf0c59f660eb93d10f9b7 | |
| parent | 9365abf6a98a94a5c604a134ba523fe3793fd526 (diff) | |
| download | qpid-python-2237d8a3bd1b79dfbf78804cc7c6f48fca60fa45.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@1144532 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java | 42 | ||||
| -rw-r--r-- | qpid/java/test-profiles/JavaExcludes | 2 |
2 files changed, 35 insertions, 9 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java index d17ead13aa..124e756fad 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java +++ b/qpid/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/qpid/java/test-profiles/JavaExcludes b/qpid/java/test-profiles/JavaExcludes index 409ba9d832..57d7681e9c 100644 --- a/qpid/java/test-profiles/JavaExcludes +++ b/qpid/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 |
