summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2013-03-06 22:20:23 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2013-03-06 22:20:23 +0000
commitb154cdb711e8f93a2da51a1a10fa2c244b946748 (patch)
tree9def76d7b3ea4661a94bc9157d99d85efd0e94ed /qpid/java
parent89aa2dcbe70954e8c83993cee306a910beae8844 (diff)
downloadqpid-python-b154cdb711e8f93a2da51a1a10fa2c244b946748.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@1453594 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java24
1 files changed, 24 insertions, 0 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 375626a2fa..eda5eb3f0a 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
@@ -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());
+ }
+ }
+ }
}