QPIDIT-22: Updated AMQP and types test to latest Proton C++ API. Files missed in last commit
Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/4f9b9ac6 Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/4f9b9ac6 Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/4f9b9ac6 Branch: refs/heads/master Commit: 4f9b9ac68f17137fd985342eb4acfdc4107ed1f1 Parents: 901635a Author: Kim van der Riet <kp...@apache.org> Authored: Thu Mar 17 13:00:12 2016 -0400 Committer: Kim van der Riet <kp...@apache.org> Committed: Thu Mar 17 13:00:12 2016 -0400 ---------------------------------------------------------------------- .../qpid-proton-cpp/src/qpidit/QpidItErrors.cpp | 4 ++-- .../src/qpidit/shim/JmsSender.cpp | 22 +++++++++++++------- .../src/qpidit/shim/JmsSender.hpp | 6 ++++++ 3 files changed, 23 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4f9b9ac6/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.cpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.cpp b/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.cpp index 0545263..4802787 100644 --- a/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.cpp +++ b/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.cpp @@ -66,8 +66,8 @@ namespace qpidit // --- IncorrectMessageBodyLengthError --- IncorrectMessageBodyLengthError::IncorrectMessageBodyLengthError(const std::string& context, int expected, int found) : - std::runtime_error(MSG(context << ": Incorrect body length found in message body: expected: " << expected - << "; found " << found)) + std::runtime_error(MSG(context << ": Incorrect body length found in message body: expected: " + << expected << "; found " << found)) {} IncorrectMessageBodyLengthError::~IncorrectMessageBodyLengthError() throw() {} http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4f9b9ac6/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp index 3d81cc4..432f370 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp @@ -123,8 +123,7 @@ namespace qpidit } else if (subType.compare("bytes") == 0) { bin.assign(testValueStr.begin(), testValueStr.end()); } else if (subType.compare("char") == 0) { - char val[2]; - val[0] = 0; + bin.push_back(char(0)); if (testValueStr[0] == '\\') { // Format: '\xNN' bin.push_back(getIntegralValue<char>(testValueStr.substr(2))); } else { // Format: 'c' @@ -135,22 +134,31 @@ namespace qpidit try { val = htobe64(std::strtoul(testValueStr.data(), NULL, 16)); } catch (const std::exception& e) { throw qpidit::InvalidTestValueError("double", testValueStr); } - bin.assign(sizeof(val), val); + numToBinary(val, bin); + //for (int i=0; i<sizeof(val); ++i) { + // bin.push_back(* ((char*)&val + i)); + // } } else if (subType.compare("float") == 0) { uint32_t val; try { val = htobe32((uint32_t)std::strtoul(testValueStr.data(), NULL, 16)); } catch (const std::exception& e) { throw qpidit::InvalidTestValueError("float", testValueStr); } - bin.assign(sizeof(val), val); + numToBinary(val, bin); + //for (int i=0; i<sizeof(val); ++i) { + // bin.push_back(* ((char*)&val + i)); + //} } else if (subType.compare("long") == 0) { uint64_t val = htobe64(getIntegralValue<uint64_t>(testValueStr)); - bin.assign(sizeof(val), val); + numToBinary(val, bin); + //bin.assign(sizeof(val), val); } else if (subType.compare("int") == 0) { uint32_t val = htobe32(getIntegralValue<uint32_t>(testValueStr)); - bin.assign(sizeof(val), val); + numToBinary(val, bin); + //bin.assign(sizeof(val), val); } else if (subType.compare("short") == 0) { uint16_t val = htobe16(getIntegralValue<int16_t>(testValueStr)); - bin.assign(sizeof(val), val); + numToBinary(val, bin); + //bin.assign(sizeof(val), val); } else if (subType.compare("string") == 0) { std::ostringstream oss; uint16_t strlen = htobe16((uint16_t)testValueStr.size()); http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/4f9b9ac6/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp index 5ad5e86..be5d660 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp @@ -68,6 +68,12 @@ namespace qpidit static std::map<std::string, int8_t> initializeJmsMessageTypeAnnotationMap(); + template<typename T> static T numToBinary(T n, proton::binary& b) { + for (int i=0; i<sizeof(n); ++i) { + b.push_back(* ((char*)&n + i)); + } + } + // Set message body to floating type T through integral type U // Used to convert a hex string representation of a float or double to a float or double template<typename T, typename U> T getFloatValue(const std::string& testValueStr) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org