Author: gsim
Date: Mon Apr 14 09:56:35 2008
New Revision: 647903
URL: http://svn.apache.org/viewvc?rev=647903&view=rev
Log:
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.
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.h
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h
incubator/qpid/trunk/qpid/cpp/src/tests/python_tests
incubator/qpid/trunk/qpid/cpp/xml/extra.xml
incubator/qpid/trunk/qpid/python/qpid/testlib.py
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp?rev=647903&r1=647902&r2=647903&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp Mon Apr 14
09:56:35 2008
@@ -452,12 +452,11 @@
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 @@
{
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);
}
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.h?rev=647903&r1=647902&r2=647903&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.h Mon Apr 14
09:56:35 2008
@@ -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 @@
void rollback();
};
- class DtxHandlerImpl : public Dtx010Handler, public HandlerHelper
+ class DtxHandlerImpl : public Dtx010Handler, public HandlerHelper, private
framing::StructHelper
{
std::string convert(const framing::Xid010& xid);
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.cpp
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.cpp?rev=647903&r1=647902&r2=647903&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.cpp Mon Apr 14
09:56:35 2008
@@ -119,6 +119,14 @@
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))
{
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h?rev=647903&r1=647902&r2=647903&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/FieldValue.h Mon Apr 14
09:56:35 2008
@@ -212,6 +212,12 @@
Str16Value(const std::string& v);
};
+class Struct32Value : public FieldValue {
+ public:
+ Struct32Value(const std::string& v);
+};
+
+
/*
* Basic integer value encodes as signed 32 bit
*/
Modified: incubator/qpid/trunk/qpid/cpp/src/tests/python_tests
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/python_tests?rev=647903&r1=647902&r2=647903&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/python_tests (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/python_tests Mon Apr 14 09:56:35
2008
@@ -12,7 +12,7 @@
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.
Modified: incubator/qpid/trunk/qpid/cpp/xml/extra.xml
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/xml/extra.xml?rev=647903&r1=647902&r2=647903&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/xml/extra.xml (original)
+++ incubator/qpid/trunk/qpid/cpp/xml/extra.xml Mon Apr 14 09:56:35 2008
@@ -34,7 +34,7 @@
</domain>
<domain name="xid010">
- <struct size="short" pack="short">
+ <struct size="long" pack="short" type="1540">
<field name="format" domain="long" />
<field name="global-id" domain="shortstr" />
<field name="branch-id" domain="shortstr" />
Modified: incubator/qpid/trunk/qpid/python/qpid/testlib.py
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/testlib.py?rev=647903&r1=647902&r2=647903&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/testlib.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/testlib.py Mon Apr 14 09:56:35 2008
@@ -132,6 +132,8 @@
# Abbreviations for default settings.
if (self.specfile == "0-10"):
self.spec = load(self.get_spec_file("amqp.0-10.xml"))
+ elif (self.specfile == "0-10-errata"):
+ self.spec = load(self.get_spec_file("amqp.0-10-qpid-errata.xml"))
else:
if (self.specfile == "0-8"):
self.specfile = self.get_spec_file("amqp.0-8.xml")