From 1896a5d32c87555877edd1dafc1bd34e3fcf5683 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 8 Oct 2008 00:36:42 +0000 Subject: rubygen/framing.0-10/constants.rb: create functions for all 3 exception subclasses. client: added session suspend/resume functions, resume not implemented yet. ClientSessionTest: enabled compilation of suspend/resume tests with expected failures. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@702674 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/ClientSessionTest.cpp | 64 ++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 33 deletions(-) (limited to 'cpp/src/tests/ClientSessionTest.cpp') diff --git a/cpp/src/tests/ClientSessionTest.cpp b/cpp/src/tests/ClientSessionTest.cpp index 0b46d39047..85497ace5d 100644 --- a/cpp/src/tests/ClientSessionTest.cpp +++ b/cpp/src/tests/ClientSessionTest.cpp @@ -162,41 +162,39 @@ QPID_AUTO_TEST_CASE(testDispatcherThread) BOOST_CHECK_EQUAL(boost::lexical_cast(i), listener.messages[i].getData()); } -// FIXME aconway 2008-05-26: Re-enable with final resume implementation. -// -// QPID_AUTO_TEST_CASE_EXPECTED_FAILURES(testSuspend0Timeout, 1) -// { -// ClientSessionFixture fix; -// fix.session.suspend(); // session has 0 timeout. -// try { -// fix.connection.resume(fix.session); -// BOOST_FAIL("Expected InvalidArgumentException."); -// } catch(const InternalErrorException&) {} -// } +QPID_AUTO_TEST_CASE_EXPECTED_FAILURES(testSuspend0Timeout, 1) +{ + ClientSessionFixture fix; + fix.session.suspend(); // session has 0 timeout. + try { + fix.connection.resume(fix.session); + BOOST_FAIL("Expected InvalidArgumentException."); + } catch(const InternalErrorException&) {} +} -// QPID_AUTO_TEST_CASE_EXPECTED_FAILURES(testUseSuspendedError, 1) -// { -// ClientSessionFixture fix; -// fix.session =fix.session.timeout(60); -// fix.session.suspend(); -// try { -// fix.session.exchangeQuery(name="amq.fanout"); -// BOOST_FAIL("Expected session suspended exception"); -// } catch(const CommandInvalidException&) {} -// } +QPID_AUTO_TEST_CASE(testUseSuspendedError) +{ + ClientSessionFixture fix; + fix.session.timeout(60); + fix.session.suspend(); + try { + fix.session.exchangeQuery(arg::exchange="amq.fanout"); + BOOST_FAIL("Expected session suspended exception"); + } catch(const NotAttachedException&) {} +} -// QPID_AUTO_TEST_CASE_EXPECTED_FAILURES(testSuspendResume, 1) -// { -// ClientSessionFixture fix; -// fix.session.timeout(60); -// fix.declareSubscribe(); -// fix.session.suspend(); -// // Make sure we are still subscribed after resume. -// fix.connection.resume(fix.session); -// fix.session.messageTransfer(content=TransferContent("my-message", "my-queue")); -// FrameSet::shared_ptr msg = fix.session.get(); -// BOOST_CHECK_EQUAL(string("my-message"), msg->getContent()); -// } +QPID_AUTO_TEST_CASE_EXPECTED_FAILURES(testSuspendResume, 1) +{ + ClientSessionFixture fix; + fix.session.timeout(60); + fix.declareSubscribe(); + fix.session.suspend(); + // Make sure we are still subscribed after resume. + fix.connection.resume(fix.session); + fix.session.messageTransfer(arg::content=TransferContent("my-message", "my-queue")); + FrameSet::shared_ptr msg = fix.session.get(); + BOOST_CHECK_EQUAL(string("my-message"), msg->getContent()); +} QPID_AUTO_TEST_CASE(testSendToSelf) { -- cgit v1.2.1