diff options
author | Gordon Sim <gsim@apache.org> | 2008-04-14 16:56:35 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2008-04-14 16:56:35 +0000 |
commit | 6fde75b10b8d71a06fcf7ae6026473b4693165f5 (patch) | |
tree | eef33ca733d3c5cf0430f5f7fedfe0f59b71aa8d /cpp/src | |
parent | dcaa8582a323d445fee5fdb46a25f2bcf3f89d58 (diff) | |
download | qpid-python-6fde75b10b8d71a06fcf7ae6026473b4693165f5.tar.gz |
Use the errata file for final 0-10 that has a type code for xids without which dtx.recover can't work.
Return the indoubt xids as an array of struct32s each of which contains an encoded xid.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@647903 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/SessionAdapter.cpp | 18 | ||||
-rw-r--r-- | cpp/src/qpid/broker/SessionAdapter.h | 3 | ||||
-rw-r--r-- | cpp/src/qpid/framing/FieldValue.cpp | 8 | ||||
-rw-r--r-- | cpp/src/qpid/framing/FieldValue.h | 6 | ||||
-rwxr-xr-x | cpp/src/tests/python_tests | 2 |
5 files changed, 26 insertions, 11 deletions
diff --git a/cpp/src/qpid/broker/SessionAdapter.cpp b/cpp/src/qpid/broker/SessionAdapter.cpp index 8093c7c174..b7985e9ed8 100644 --- a/cpp/src/qpid/broker/SessionAdapter.cpp +++ b/cpp/src/qpid/broker/SessionAdapter.cpp @@ -452,12 +452,11 @@ void SessionAdapter::TxHandlerImpl::rollback() std::string SessionAdapter::DtxHandlerImpl::convert(const framing::Xid010& xid) { - std::stringstream out; - out << xid.getFormat() << xid.getGlobalId() << xid.getBranchId(); - return out.str(); + std::string encoded; + encode(xid, encoded); + return encoded; } - void SessionAdapter::DtxHandlerImpl::select() { state.selectDtx(); @@ -543,13 +542,14 @@ Dtx010RecoverResult SessionAdapter::DtxHandlerImpl::recover() { std::set<std::string> xids; getBroker().getStore().collectPreparedXids(xids); - - //TODO: remove the need to copy from one container type to another - std::vector<std::string> data; + /* + * create array of long structs + */ + Array indoubt(0xAB); for (std::set<std::string>::iterator i = xids.begin(); i != xids.end(); i++) { - data.push_back(*i); + boost::shared_ptr<FieldValue> xid(new Struct32Value(*i)); + indoubt.add(xid); } - Array indoubt(data); return Dtx010RecoverResult(indoubt); } diff --git a/cpp/src/qpid/broker/SessionAdapter.h b/cpp/src/qpid/broker/SessionAdapter.h index a77f1b5d77..0cbbd13777 100644 --- a/cpp/src/qpid/broker/SessionAdapter.h +++ b/cpp/src/qpid/broker/SessionAdapter.h @@ -27,6 +27,7 @@ #include "qpid/framing/AMQP_ServerOperations.h" #include "qpid/framing/reply_exceptions.h" #include "qpid/framing/SequenceSet.h" +#include "qpid/framing/StructHelper.h" #include <vector> #include <boost/function.hpp> @@ -222,7 +223,7 @@ class Queue; void rollback(); }; - class DtxHandlerImpl : public Dtx010Handler, public HandlerHelper + class DtxHandlerImpl : public Dtx010Handler, public HandlerHelper, private framing::StructHelper { std::string convert(const framing::Xid010& xid); diff --git a/cpp/src/qpid/framing/FieldValue.cpp b/cpp/src/qpid/framing/FieldValue.cpp index cbda061209..8171a94ef2 100644 --- a/cpp/src/qpid/framing/FieldValue.cpp +++ b/cpp/src/qpid/framing/FieldValue.cpp @@ -119,6 +119,14 @@ Str16Value::Str16Value(const std::string& v) : reinterpret_cast<const uint8_t*>(v.data()+v.size()))) {} +Struct32Value::Struct32Value(const std::string& v) : + FieldValue( + 0xAB, + new VariableWidthValue<4>( + reinterpret_cast<const uint8_t*>(v.data()), + reinterpret_cast<const uint8_t*>(v.data()+v.size()))) +{} + IntegerValue::IntegerValue(int v) : FieldValue(0x21, new FixedWidthValue<4>(v)) { diff --git a/cpp/src/qpid/framing/FieldValue.h b/cpp/src/qpid/framing/FieldValue.h index 272670d102..d7efc4d22d 100644 --- a/cpp/src/qpid/framing/FieldValue.h +++ b/cpp/src/qpid/framing/FieldValue.h @@ -212,6 +212,12 @@ class Str16Value : public FieldValue { Str16Value(const std::string& v); }; +class Struct32Value : public FieldValue { + public: + Struct32Value(const std::string& v); +}; + + /* * Basic integer value encodes as signed 32 bit */ diff --git a/cpp/src/tests/python_tests b/cpp/src/tests/python_tests index f35cb16480..4360992a2e 100755 --- a/cpp/src/tests/python_tests +++ b/cpp/src/tests/python_tests @@ -12,7 +12,7 @@ run() { if test -d ../../../python ; then cd ../../../python - run 0-10 cpp_failing_0-10.txt + run 0-10-errata cpp_failing_0-10.txt test -z "$QPID_NO_PREVIEW" && run ../specs/amqp.0-10-preview.xml cpp_failing_0-10_preview.txt else echo Warning: python tests not found. |