From 6a793a2ad19b692e9fb5a053607be5a369ae36b3 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 31 Oct 2006 13:10:17 +0000 Subject: Some additional unit tests. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@469471 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/AccumulatedAck.cpp | 2 +- cpp/src/qpid/broker/Queue.cpp | 6 ++---- cpp/src/qpid/broker/TxAck.cpp | 2 +- cpp/src/qpid/broker/TxAck.h | 13 +++++++++++-- 4 files changed, 15 insertions(+), 8 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/broker/AccumulatedAck.cpp b/cpp/src/qpid/broker/AccumulatedAck.cpp index 86e1a5e786..060e940309 100644 --- a/cpp/src/qpid/broker/AccumulatedAck.cpp +++ b/cpp/src/qpid/broker/AccumulatedAck.cpp @@ -42,5 +42,5 @@ void AccumulatedAck::clear(){ } bool AccumulatedAck::covers(u_int64_t tag) const{ - return tag < range || find(individual.begin(), individual.end(), tag) != individual.end(); + return tag <= range || find(individual.begin(), individual.end(), tag) != individual.end(); } diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index 14a89f7a66..67fb6764be 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -165,15 +165,13 @@ bool Queue::canAutoDelete() const{ } void Queue::enqueue(Message::shared_ptr& msg, const string * const xid){ - bool persistent(false);//TODO: pull this from headers - if(persistent){ + if(store){ store->enqueue(msg, name, xid); } } void Queue::dequeue(Message::shared_ptr& msg, const string * const xid){ - bool persistent(false);//TODO: pull this from headers - if(persistent){ + if(store){ store->dequeue(msg, name, xid); } } diff --git a/cpp/src/qpid/broker/TxAck.cpp b/cpp/src/qpid/broker/TxAck.cpp index 7e787a463e..6dba6fd79d 100644 --- a/cpp/src/qpid/broker/TxAck.cpp +++ b/cpp/src/qpid/broker/TxAck.cpp @@ -22,7 +22,7 @@ using std::bind2nd; using std::mem_fun_ref; using namespace qpid::broker; -TxAck::TxAck(AccumulatedAck _acked, std::list& _unacked) : acked(_acked), unacked(_unacked){ +TxAck::TxAck(AccumulatedAck& _acked, std::list& _unacked) : acked(_acked), unacked(_unacked){ } diff --git a/cpp/src/qpid/broker/TxAck.h b/cpp/src/qpid/broker/TxAck.h index 645bf1b1b0..9046a89384 100644 --- a/cpp/src/qpid/broker/TxAck.h +++ b/cpp/src/qpid/broker/TxAck.h @@ -27,11 +27,20 @@ namespace qpid { namespace broker { + /** + * Defines the transactional behaviour for acks received by a + * transactional channel. + */ class TxAck : public TxOp{ - AccumulatedAck acked; + AccumulatedAck& acked; std::list& unacked; public: - TxAck(AccumulatedAck acked, std::list& unacked); + /** + * @param acked a representation of the accumulation of + * acks received + * @param unacked the record of delivered messages + */ + TxAck(AccumulatedAck& acked, std::list& unacked); virtual bool prepare() throw(); virtual void commit() throw(); virtual void rollback() throw(); -- cgit v1.2.1