summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-07-15 20:33:16 +0000
committerGordon Sim <gsim@apache.org>2010-07-15 20:33:16 +0000
commitcd34a17f5666c591e7da0313e0d8f919f7a545d8 (patch)
treecef5aae348b39f2738d0ced380538f856a75df4d /cpp/src
parente0f9d4157f823135515dbaa7b7eeb20db833f9ad (diff)
downloadqpid-python-cd34a17f5666c591e7da0313e0d8f919f7a545d8.tar.gz
QPID-2734: Tighter control over sasl related test; now passes when cyrus-sasl not in use.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@964571 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/tests/MessagingFixture.h8
-rw-r--r--cpp/src/tests/MessagingSessionTests.cpp7
2 files changed, 14 insertions, 1 deletions
diff --git a/cpp/src/tests/MessagingFixture.h b/cpp/src/tests/MessagingFixture.h
index c8ae86dbc3..18cdeb1701 100644
--- a/cpp/src/tests/MessagingFixture.h
+++ b/cpp/src/tests/MessagingFixture.h
@@ -113,6 +113,14 @@ struct MessagingFixture : public BrokerFixture
return connection;
}
+ /** Open a connection to the broker. */
+ qpid::messaging::Connection newConnection()
+ {
+ qpid::messaging::Connection connection(
+ (boost::format("amqp:tcp:localhost:%1%") % (broker->getPort(qpid::broker::Broker::TCP_TRANSPORT))).str());
+ return connection;
+ }
+
void ping(const qpid::messaging::Address& address)
{
messaging::Receiver r = session.createReceiver(address);
diff --git a/cpp/src/tests/MessagingSessionTests.cpp b/cpp/src/tests/MessagingSessionTests.cpp
index a23e8c3a9e..268bf3fbd3 100644
--- a/cpp/src/tests/MessagingSessionTests.cpp
+++ b/cpp/src/tests/MessagingSessionTests.cpp
@@ -772,7 +772,12 @@ QPID_AUTO_TEST_CASE(testExclusiveSubscriber)
QPID_AUTO_TEST_CASE(testAuthenticatedUsername)
{
MessagingFixture fix;
- BOOST_CHECK_EQUAL(fix.connection.getAuthenticatedUsername(), std::string("anonymous"));
+ Connection connection = fix.newConnection();
+ connection.setOption("sasl-mechanism", "PLAIN");
+ connection.setOption("username", "test-user");
+ connection.setOption("password", "ignored");
+ connection.open();
+ BOOST_CHECK_EQUAL(connection.getAuthenticatedUsername(), std::string("test-user"));
}
QPID_AUTO_TEST_CASE(testExceptionOnClosedConnection)