summaryrefslogtreecommitdiff
path: root/cpp/src/tests/ResumeHandler.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-10-26 19:48:31 +0000
committerAlan Conway <aconway@apache.org>2007-10-26 19:48:31 +0000
commitf61e1ef7589da893b9b54448224dc0961515eb40 (patch)
tree258ac1fd99ac122b105ad90ad4394d8d544c5cbf /cpp/src/tests/ResumeHandler.cpp
parentc5294d471ade7a18c52ca7d4028a494011c82293 (diff)
downloadqpid-python-f61e1ef7589da893b9b54448224dc0961515eb40.tar.gz
Session resume support in client & broker: Client can resume a session
after voluntary suspend() or network failure. Frames lost in network failure are automatically re-transmitted for transparent re-connection. client::Session improvements: - Locking to avoid races between network & user threads. - Replaced client::StateManager with sys::StateMonitor - avoid heap allocation. qpid::Exception clean up: - use QPID_MSG consistently to format exception messages. - throw typed exceptions (in reply_exceptions.h) for AMQP exceptions. - re-throw correct typed exception on client for exceptions from broker. - Removed QpidError.h rubygen/templates/constants.rb: - constants.h: Added FOO_CLASS_ID and FOO_BAR_METHOD_ID constants. - reply_constants.h: Added throwReplyException(code, text) log::Logger: - Fixed shutdown race in Statement::~Initializer() git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@588761 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/ResumeHandler.cpp')
-rw-r--r--cpp/src/tests/ResumeHandler.cpp87
1 files changed, 0 insertions, 87 deletions
diff --git a/cpp/src/tests/ResumeHandler.cpp b/cpp/src/tests/ResumeHandler.cpp
deleted file mode 100644
index 1073e42a3c..0000000000
--- a/cpp/src/tests/ResumeHandler.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "qpid/framing/ResumeHandler.h"
-
-#define BOOST_AUTO_TEST_MAIN
-#include <boost/test/auto_unit_test.hpp>
-
-#include <vector>
-
-using namespace std;
-using namespace qpid::framing;
-
-AMQFrame& frame(const char* s) {
- static AMQFrame frame;
- frame.setBody(AMQContentBody(s));
- return frame;
-}
-
-struct Collector : public FrameHandler, public vector<AMQFrame> {
- void handle(AMQFrame& f) { push_back(f); }
-};
-
-
-namespace qpid {
-namespace framing {
-
-bool operator==(const AMQFrame& a, const AMQFrame& b) {
- const AMQContentBody* ab=dynamic_cast<const AMQContentBody*>(a.getBody());
- const AMQContentBody* bb=dynamic_cast<const AMQContentBody*>(b.getBody());
- return ab && bb && ab->getData() == bb->getData();
-}
-
-}} // namespace qpid::framing
-
-
-BOOST_AUTO_TEST_CASE(testSend) {
- AMQFrame f;
- ResumeHandler sender;
- Collector collect;
- sender.out.next = &collect;
- sender.out(frame("a"));
- BOOST_CHECK_EQUAL(1u, collect.size());
- BOOST_CHECK_EQUAL(frame("a"), collect[0]);
- sender.out(frame("b"));
- sender.out(frame("c"));
- sender.ackReceived(1); // ack a,b.
- sender.out(frame("d"));
- BOOST_CHECK_EQUAL(4u, collect.size());
- BOOST_CHECK_EQUAL(frame("d"), collect.back());
- // Now try a resend.
- collect.clear();
- sender.resend();
- BOOST_REQUIRE_EQUAL(collect.size(), 2u);
- BOOST_CHECK_EQUAL(frame("c"), collect[0]);
- BOOST_CHECK_EQUAL(frame("d"), collect[1]);
-}
-
-
-BOOST_AUTO_TEST_CASE(testReceive) {
- ResumeHandler receiver;
- Collector collect;
- receiver.in.next = &collect;
- receiver.in(frame("a"));
- receiver.in(frame("b"));
- BOOST_CHECK_EQUAL(receiver.getLastReceived().getValue(), 1u);
- receiver.in(frame("c"));
- BOOST_CHECK_EQUAL(receiver.getLastReceived().getValue(), 2u);
- BOOST_CHECK_EQUAL(3u, collect.size());
- BOOST_CHECK_EQUAL(frame("a"), collect[0]);
- BOOST_CHECK_EQUAL(frame("c"), collect[2]);
-}