diff options
Diffstat (limited to 'qpid/cpp/src/tests')
| -rw-r--r-- | qpid/cpp/src/tests/ClientSessionTest.cpp | 24 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/InProcessBroker.h | 4 |
2 files changed, 27 insertions, 1 deletions
diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp index 1d59fbed33..2495a06fa4 100644 --- a/qpid/cpp/src/tests/ClientSessionTest.cpp +++ b/qpid/cpp/src/tests/ClientSessionTest.cpp @@ -60,6 +60,8 @@ class ClientSessionTest : public CppUnit::TestCase CPPUNIT_TEST(testQueueQuery); CPPUNIT_TEST(testTransfer); CPPUNIT_TEST(testDispatcher); + CPPUNIT_TEST(testSuspendResume); + CPPUNIT_TEST(testSuspendResumeErrors); CPPUNIT_TEST_SUITE_END(); boost::shared_ptr<Connector> broker; @@ -139,6 +141,28 @@ public: } void testSuspendResume() { + session = connection.newSession(60); + session.suspend(); + try { + session.exchangeQuery_(name="amq.fanout"); + CPPUNIT_FAIL("Expected session suspended exception"); + } catch(...) {} + connection.resume(session); + session.exchangeQuery_(name="amq.fanout"); + // FIXME aconway 2007-09-25: build up session state and confirm + //it survives the resume + } + + void testSuspendResumeErrors() { + session.suspend(); // session has 0 timeout. + try { + session.exchangeQuery_(name="amq.fanout"); + CPPUNIT_FAIL("Expected suspended session exception"); + } catch(...) {} + try { + connection.resume(session); + CPPUNIT_FAIL("Expected no such session exception."); + } catch(...) {} } }; diff --git a/qpid/cpp/src/tests/InProcessBroker.h b/qpid/cpp/src/tests/InProcessBroker.h index 531ebd8fa7..2a9f12771b 100644 --- a/qpid/cpp/src/tests/InProcessBroker.h +++ b/qpid/cpp/src/tests/InProcessBroker.h @@ -24,6 +24,7 @@ #include "qpid/broker/Connection.h" #include "qpid/client/Connector.h" #include "qpid/client/Connection.h" +#include "qpid/log/Statement.h" #include <vector> #include <iostream> @@ -101,7 +102,8 @@ class InProcessBroker : public client::Connector { ) : sender(sender_), conversation(conversation_), in(ih) {} void send(framing::AMQFrame& frame) { - //std::cout << (sender == CLIENT ? "C->S: " : "S->C: ") << frame << std::endl; + QPID_LOG(debug, + (sender==CLIENT ? "CLIENT: " : "BROKER: ") << frame); conversation.push_back(TaggedFrame(sender, frame)); in->received(frame); } |
