diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2013-03-06 22:20:23 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2013-03-06 22:20:23 +0000 |
| commit | 93a511331449099ae89f52bcef626beb1d0586f9 (patch) | |
| tree | 4242651846d29f25666e0cab82c5c612ffea6853 /java | |
| parent | a23bc789330f50ef6222284ba8c4d51f5a1a22c5 (diff) | |
| download | qpid-python-93a511331449099ae89f52bcef626beb1d0586f9.tar.gz | |
QPID-3396 Added a test case to verify that if mech needs user password
and if they are not supplied and exception is thrown.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1453594 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 | 24 |
1 files changed, 24 insertions, 0 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 375626a2fa..eda5eb3f0a 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 @@ -351,4 +351,28 @@ public class ConnectionTest extends QpidBrokerTestCase { return new junit.framework.TestSuite(ConnectionTest.class); } + + public void testExceptionWhenUserPassIsRequired() throws Exception + { + AMQConnection conn = null; + try + { + BrokerDetails broker = getBroker(); + String url = "amqp:///test?brokerlist='" + broker + "'&sasl_mech='PLAIN'"; + conn = new AMQConnection(url); + conn.close(); + fail("Exception should be thrown as user name and password is required"); + } + catch (Exception e) + { + if (!e.getMessage().contains("Username and Password is required for the selected mechanism")) + { + if (conn != null && !conn.isClosed()) + { + conn.close(); + } + fail("Incorrect Exception thrown! The exception thrown is : " + e.getMessage()); + } + } + } } |
