Repository: qpid-interop-test Updated Branches: refs/heads/master bcd3684c6 -> c1e7146ff
QPIDIT-22: Updated c++ shims for latest changes to Proton c++ API. WIP - JMS shims not working, issues with AMQP types 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/ab84b0ee Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/ab84b0ee Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/ab84b0ee Branch: refs/heads/master Commit: ab84b0eee90b33912ccad8e9a0ee8b5660f413a0 Parents: bcd3684 Author: Kim van der Riet <kp...@apache.org> Authored: Mon Mar 14 16:00:01 2016 -0400 Committer: Kim van der Riet <kp...@apache.org> Committed: Mon Mar 14 16:00:01 2016 -0400 ---------------------------------------------------------------------- shims/qpid-jms/java-build.sh | 2 +- .../src/qpidit/shim/AmqpReceiver.cpp | 36 +++--- .../src/qpidit/shim/AmqpReceiver.hpp | 6 + .../src/qpidit/shim/AmqpSender.cpp | 116 +++++++++--------- .../src/qpidit/shim/AmqpSender.hpp | 7 ++ .../src/qpidit/shim/JmsReceiver.cpp | 40 +++---- .../src/qpidit/shim/JmsReceiver.hpp | 4 +- .../src/qpidit/shim/JmsSender.cpp | 42 +++---- .../src/qpidit/shim/JmsSender.hpp | 4 +- .../qpid-interop-test/jms/jms_message_tests.py | 119 ------------------- 10 files changed, 134 insertions(+), 242 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/shims/qpid-jms/java-build.sh ---------------------------------------------------------------------- diff --git a/shims/qpid-jms/java-build.sh b/shims/qpid-jms/java-build.sh index 0ddc0ea..587c5ca 100755 --- a/shims/qpid-jms/java-build.sh +++ b/shims/qpid-jms/java-build.sh @@ -12,7 +12,7 @@ for d in ${QPID_JMS_CLIENT_LOCATION}/*; do done # TODO: get this from the above list, which needs sorting to find latest version by default -JMS_VERSION=0.8.0-SNAPSHOT +JMS_VERSION=0.9.0-SNAPSHOT echo "Current qpid-jms client version: ${JMS_VERSION}" JMS_API=${MVN_LOCAL_REPOSITORY}/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar:${QPID_JMS_CLIENT_LOCATION}/${JMS_VERSION}/qpid-jms-client-${JMS_VERSION}.jar http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.cpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.cpp b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.cpp index 972f139..25985fa 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.cpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.cpp @@ -24,6 +24,7 @@ #include <iostream> #include <json/json.h> #include "proton/container.hpp" +#include "proton/decimal.hpp" #include "proton/event.hpp" #include "qpidit/QpidItErrors.hpp" @@ -61,52 +62,51 @@ namespace qpidit _receivedValueList.append("None"); } else if (_amqpType.compare("boolean") == 0) { checkMessageType(msg, proton::BOOLEAN); - _receivedValueList.append(msg.body().get<proton::amqp_boolean>() ? "True": "False"); + _receivedValueList.append(msg.body().get<bool>() ? "True": "False"); } else if (_amqpType.compare("ubyte") == 0) { checkMessageType(msg, proton::UBYTE); - _receivedValueList.append(toHexStr<proton::amqp_ubyte>(msg.body().get<proton::amqp_ubyte>())); + _receivedValueList.append(toHexStr<uint8_t>(msg.body().get<uint8_t>())); } else if (_amqpType.compare("ushort") == 0) { checkMessageType(msg, proton::USHORT); - _receivedValueList.append(toHexStr<proton::amqp_ushort>(msg.body().get<proton::amqp_ushort>())); + _receivedValueList.append(toHexStr<uint16_t>(msg.body().get<uint16_t>())); } else if (_amqpType.compare("uint") == 0) { checkMessageType(msg, proton::UINT); - _receivedValueList.append(toHexStr<proton::amqp_uint>(msg.body().get<proton::amqp_uint>())); + _receivedValueList.append(toHexStr<uint32_t>(msg.body().get<uint32_t>())); } else if (_amqpType.compare("ulong") == 0) { checkMessageType(msg, proton::ULONG); - _receivedValueList.append(toHexStr<proton::amqp_ulong>(msg.body().get<proton::amqp_ulong>())); + _receivedValueList.append(toHexStr<uint64_t>(msg.body().get<uint64_t>())); } else if (_amqpType.compare("byte") == 0) { checkMessageType(msg, proton::BYTE); - _receivedValueList.append(toHexStr<proton::amqp_byte>(msg.body().get<proton::amqp_byte>())); + _receivedValueList.append(toHexStr<int8_t>(msg.body().get<int8_t>())); } else if (_amqpType.compare("short") == 0) { checkMessageType(msg, proton::SHORT); - _receivedValueList.append(toHexStr<proton::amqp_short>(msg.body().get<proton::amqp_short>())); + _receivedValueList.append(toHexStr<int16_t>(msg.body().get<int16_t>())); } else if (_amqpType.compare("int") == 0) { checkMessageType(msg, proton::INT); - _receivedValueList.append(toHexStr<proton::amqp_int>(msg.body().get<proton::amqp_int>())); + _receivedValueList.append(toHexStr<int32_t>(msg.body().get<int32_t>())); } else if (_amqpType.compare("long") == 0) { checkMessageType(msg, proton::LONG); - _receivedValueList.append(toHexStr<proton::amqp_long>(msg.body().get<proton::amqp_long>())); + _receivedValueList.append(toHexStr<int64_t>(msg.body().get<int64_t>())); } else if (_amqpType.compare("float") == 0) { checkMessageType(msg, proton::FLOAT); - proton::amqp_float f = msg.body().get<proton::amqp_float>(); + float f = msg.body().get<float>(); _receivedValueList.append(toHexStr<uint32_t>(*((uint32_t*)&f), true)); } else if (_amqpType.compare("double") == 0) { checkMessageType(msg, proton::DOUBLE); - proton::amqp_double d = msg.body().get<proton::amqp_double>(); + double d = msg.body().get<double>(); _receivedValueList.append(toHexStr<uint64_t>(*((uint64_t*)&d), true)); } else if (_amqpType.compare("decimal32") == 0) { checkMessageType(msg, proton::DECIMAL32); - _receivedValueList.append(toHexStr<uint32_t>(msg.body().get<proton::amqp_decimal32>(), true)); + _receivedValueList.append(byteArrayToHexStr(msg.body().get<proton::decimal32>())); } else if (_amqpType.compare("decimal64") == 0) { checkMessageType(msg, proton::DECIMAL64); - _receivedValueList.append(toHexStr<uint64_t>(msg.body().get<proton::amqp_decimal64>(), true)); + _receivedValueList.append(byteArrayToHexStr(msg.body().get<proton::decimal64>())); } else if (_amqpType.compare("decimal128") == 0) { checkMessageType(msg, proton::DECIMAL128); - proton::amqp_decimal128 d128(msg.body().get<proton::amqp_decimal128>()); - _receivedValueList.append(stringToHexStr(std::string(d128.value.bytes, 16))); + _receivedValueList.append(byteArrayToHexStr(msg.body().get<proton::decimal128>())); } else if (_amqpType.compare("char") == 0) { checkMessageType(msg, proton::CHAR); - wchar_t c = msg.body().get<proton::amqp_char>(); + wchar_t c = msg.body().get<wchar_t>(); std::stringstream oss; if (c < 0x7f && std::iswprint(c)) { oss << (char)c; @@ -117,12 +117,12 @@ namespace qpidit } else if (_amqpType.compare("timestamp") == 0) { checkMessageType(msg, proton::TIMESTAMP); std::ostringstream oss; - oss << "0x" << std::hex << msg.body().get<proton::amqp_timestamp>().milliseconds; + oss << "0x" << std::hex << msg.body().get<proton::timestamp>().milliseconds(); _receivedValueList.append(oss.str()); } else if (_amqpType.compare("uuid") == 0) { checkMessageType(msg, proton::UUID); std::ostringstream oss; - oss << msg.body().get<proton::amqp_uuid>(); + oss << msg.body().get<proton::uuid>(); _receivedValueList.append(oss.str()); } else if (_amqpType.compare("binary") == 0) { checkMessageType(msg, proton::BINARY); http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.hpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.hpp b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.hpp index 8b011f0..aed9678 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.hpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.hpp @@ -66,6 +66,12 @@ namespace qpidit oss << (sizeof(T) == 1 ? (int)val & 0xff : sizeof(T) == 2 ? val & 0xffff : sizeof(T) == 4 ? val & 0xffffffff : val); return oss.str(); } + + template<size_t N> static std::string byteArrayToHexStr(const proton::byte_array<N>& val) { + std::ostringstream oss; + oss << val; + return oss.str(); + } }; } /* namespace shim */ http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.cpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.cpp b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.cpp index 138eb45..9b3613c 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.cpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.cpp @@ -21,10 +21,10 @@ #include "qpidit/shim/AmqpSender.hpp" -#include <iomanip> #include <iostream> #include <json/json.h> #include "proton/container.hpp" +#include "proton/decimal.hpp" #include "proton/event.hpp" namespace qpidit @@ -83,55 +83,48 @@ namespace qpidit if (_amqpType.compare("null") == 0) { std::string testValueStr(testValue.asString()); if (testValueStr.compare("None") != 0) { throw qpidit::InvalidTestValueError(_amqpType, testValueStr); } - msg.body(proton::amqp_null()); + proton::value v; //proton::null n; + msg.body(v); //msg.body(n); } else if (_amqpType.compare("boolean") == 0) { std::string testValueStr(testValue.asString()); if (testValueStr.compare("True") == 0) { - msg.body(proton::amqp_boolean(true)); + msg.body(true); } else if (testValueStr.compare("False") == 0) { - msg.body(proton::amqp_boolean(false)); + msg.body(false); } else { throw qpidit::InvalidTestValueError(_amqpType, testValueStr); } } else if (_amqpType.compare("ubyte") == 0) { - setIntegralValue<proton::amqp_ubyte>(msg, testValue.asString(), true); + setIntegralValue<uint8_t>(msg, testValue.asString(), true); } else if (_amqpType.compare("ushort") == 0) { - setIntegralValue<proton::amqp_ushort>(msg, testValue.asString(), true); + setIntegralValue<uint16_t>(msg, testValue.asString(), true); } else if (_amqpType.compare("uint") == 0) { - setIntegralValue<proton::amqp_uint>(msg, testValue.asString(), true); + setIntegralValue<uint32_t>(msg, testValue.asString(), true); } else if (_amqpType.compare("ulong") == 0) { - setIntegralValue<proton::amqp_ulong>(msg, testValue.asString(), true); + setIntegralValue<uint64_t>(msg, testValue.asString(), true); } else if (_amqpType.compare("byte") == 0) { - setIntegralValue<proton::amqp_byte>(msg, testValue.asString(), false); + setIntegralValue<int8_t>(msg, testValue.asString(), false); } else if (_amqpType.compare("short") == 0) { - setIntegralValue<proton::amqp_short>(msg, testValue.asString(), false); + setIntegralValue<int16_t>(msg, testValue.asString(), false); } else if (_amqpType.compare("int") == 0) { - setIntegralValue<proton::amqp_int>(msg, testValue.asString(), false); + setIntegralValue<int32_t>(msg, testValue.asString(), false); } else if (_amqpType.compare("long") == 0) { - setIntegralValue<proton::amqp_long>(msg, testValue.asString(), false); + setIntegralValue<int64_t>(msg, testValue.asString(), false); } else if (_amqpType.compare("float") == 0) { - setFloatValue<proton::amqp_float, uint32_t>(msg, testValue.asString()); + setFloatValue<float, uint32_t>(msg, testValue.asString()); } else if (_amqpType.compare("double") == 0) { - setFloatValue<proton::amqp_double, uint64_t>(msg, testValue.asString()); + setFloatValue<double, uint64_t>(msg, testValue.asString()); } else if (_amqpType.compare("decimal32") == 0) { - proton::amqp_decimal32 val; - val.value = std::strtoul(testValue.asString().data(), NULL, 16); + proton::decimal32 val; + hexStringToBytearray(val, testValue.asString().substr(2)); msg.body(val); } else if (_amqpType.compare("decimal64") == 0) { - proton::amqp_decimal64 val; - val.value = std::strtoul(testValue.asString().data(), NULL, 16); + proton::decimal64 val; + hexStringToBytearray(val, testValue.asString().substr(2)); msg.body(val); } else if (_amqpType.compare("decimal128") == 0) { - std::string testValueStr(testValue.asString()); - if (testValueStr.size() != 34) { throw qpidit::InvalidTestValueError(_amqpType, testValueStr); } - - const std::string s1 = testValueStr.substr(2, 16); - uint64_t p1 = std::strtoul(s1.data(), NULL, 16); - const std::string s2 = testValueStr.substr(18, 16); - uint64_t p2 = std::strtoul(s2.data(), NULL, 16); - - proton::amqp_decimal128 val; - uint64ToChar16((char*)val.value.bytes, p1, p2); + proton::decimal128 val; + hexStringToBytearray(val, testValue.asString().substr(2)); msg.body(val); } else if (_amqpType.compare("char") == 0) { std::string charStr = testValue.asString(); @@ -143,31 +136,34 @@ namespace qpidit } else { //TODO throw format error } - msg.body(proton::amqp_char(val)); + msg.body(val); } else if (_amqpType.compare("timestamp") == 0) { - proton::amqp_timestamp val; - val.milliseconds = std::strtoul(testValue.asString().data(), NULL, 16); + proton::timestamp val(std::strtoul(testValue.asString().data(), NULL, 16)); msg.body(val); } else if (_amqpType.compare("uuid") == 0) { - std::string testValueStr(testValue.asString()); - if (testValueStr.size() != 36) { throw qpidit::InvalidTestValueError(_amqpType, testValueStr); } + proton::uuid val; + std::string uuidStr(testValue.asString()); // Expected format: "00000000-0000-0000-0000-000000000000" - std::ostringstream oss1; - oss1 << testValueStr.substr(0, 8) << testValueStr.substr(9, 4) << testValueStr.substr(14, 4); - uint64_t p1 = std::strtoul(oss1.str().data(), NULL, 16); - std::ostringstream oss2; - oss2 << testValueStr.substr(19, 4) << testValueStr.substr(24); - uint64_t p2 = std::strtoul(oss2.str().data(), NULL, 16); - - proton::amqp_uuid val; - uint64ToChar16((char*)val.value.bytes, p1, p2); + // ^ ^ ^ ^ ^ + // start index -> 0 9 14 19 24 + hexStringToBytearray(val, uuidStr.substr(0, 8), 0, 4); + hexStringToBytearray(val, uuidStr.substr(9, 4), 4, 2); + hexStringToBytearray(val, uuidStr.substr(14, 4), 6, 2); + hexStringToBytearray(val, uuidStr.substr(19, 4), 8, 2); + hexStringToBytearray(val, uuidStr.substr(24, 12), 10, 6); msg.body(val); } else if (_amqpType.compare("binary") == 0) { - setStringValue<proton::amqp_binary>(msg, testValue.asString()); + //setStringValue<proton::amqp_binary>(msg, testValue.asString()); + proton::amqp_binary val(testValue.asString()); + msg.body(val); } else if (_amqpType.compare("string") == 0) { - setStringValue<proton::amqp_string>(msg, testValue.asString()); + //setStringValue<proton::amqp_string>(msg, testValue.asString()); + proton::amqp_string val(testValue.asString()); + msg.body(val); } else if (_amqpType.compare("symbol") == 0) { - setStringValue<proton::amqp_symbol>(msg, testValue.asString()); + //setStringValue<proton::amqp_symbol>(msg, testValue.asString()); + proton::amqp_symbol val(testValue.asString()); + msg.body(val); } else if (_amqpType.compare("list") == 0) { std::vector<proton::value> list; processList(list, testValue); @@ -203,18 +199,20 @@ namespace qpidit proton::value AmqpSender::extractProtonValue(const Json::Value& val) { switch (val.type()) { case Json::nullValue: - proton::amqp_null n; - return proton::value(n); + { + proton::value v; //proton::null n; + return v; //proton::value(n); + } case Json::intValue: - return proton::value(proton::amqp_int(val.asInt())); + return proton::value(val.asInt()); case Json::uintValue: - return proton::value(proton::amqp_uint(val.asUInt())); + return proton::value(val.asUInt()); case Json::realValue: - return proton::value(proton::amqp_double(val.asDouble())); + return proton::value(val.asDouble()); case Json::stringValue: - return proton::value(proton::amqp_string(val.asString())); + return proton::value(val.asString()); case Json::booleanValue: - return proton::value(proton::amqp_boolean(val.asBool())); + return proton::value(val.asBool()); default:; } } @@ -242,17 +240,17 @@ namespace qpidit } else { proton::value v; if ((*i).isNull()) - v = proton::amqp_null(); - if ((*i).isBool()) - v = proton::amqp_boolean((*i).asBool()); + ; + else if ((*i).isBool()) + v = (*i).asBool(); else if ((*i).isInt()) - v = proton::amqp_int((*i).asInt()); + v = (*i).asInt(); else if ((*i).isUInt()) - v = proton::amqp_uint((*i).asUInt()); + v = (*i).asUInt(); else if ((*i).isDouble()) - v = proton::amqp_double((*i).asDouble()); + v = (*i).asDouble(); else if ((*i).isString()) - v = proton::amqp_string((*i).asString()); + v = (*i).asString(); else ; // TODO handle this case array.push_back(v); http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.hpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.hpp b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.hpp index 79f5ba0..b44431b 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.hpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.hpp @@ -22,6 +22,7 @@ #ifndef SRC_QPIDIT_SHIM_AMQPSENDER_HPP_ #define SRC_QPIDIT_SHIM_AMQPSENDER_HPP_ +#include <iomanip> #include <json/value.h> #include "proton/handler.hpp" #include "proton/message.hpp" @@ -61,6 +62,12 @@ namespace qpidit static void processList(std::vector<proton::value>& list, const Json::Value& testValues); static void processMap(std::map<std::string, proton::value>& map, const Json::Value& testValues); + template<size_t N> static void hexStringToBytearray(proton::byte_array<N>& ba, const std::string s, size_t fromArrayIndex = 0, size_t arrayLen = N) { + for (size_t i=0; i<arrayLen; ++i) { + ba[fromArrayIndex + i] = (char)std::strtoul(s.substr(2*i, 2).c_str(), NULL, 16); + } + } + // 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> void setFloatValue(proton::message& msg, const std::string& testValueStr) { http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.cpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.cpp b/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.cpp index ef899ec..2320824 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.cpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.cpp @@ -35,7 +35,7 @@ namespace qpidit typedef enum {JMS_MESSAGE_TYPE=0, JMS_OBJECTMESSAGE_TYPE, JMS_MAPMESSAGE_TYPE, JMS_BYTESMESSAGE_TYPE, JMS_STREAMMESSAGE_TYPE, JMS_TEXTMESSAGE_TYPE} jmsMessageType_t; //static proton::amqp_symbol JmsReceiver::s_jmsMessageTypeAnnotationKey("x-opt-jms-msg-type"); - std::map<std::string, proton::amqp_byte>JmsReceiver::s_jmsMessageTypeAnnotationValues = initializeJmsMessageTypeAnnotationMap(); + std::map<std::string, int8_t>JmsReceiver::s_jmsMessageTypeAnnotationValues = initializeJmsMessageTypeAnnotationMap(); JmsReceiver::JmsReceiver(const std::string& brokerUrl, @@ -66,7 +66,7 @@ namespace qpidit void JmsReceiver::on_message(proton::event &e) { proton::message& msg = e.message(); if (_received < _expected) { - switch (msg.message_annotations()[proton::amqp_symbol("x-opt-jms-msg-type")].get<proton::amqp_byte>()) { + switch (msg.message_annotations()[proton::amqp_symbol("x-opt-jms-msg-type")].get<int8_t>()) { case JMS_MESSAGE_TYPE: receiveJmsMessage(msg); break; @@ -138,27 +138,27 @@ namespace qpidit } proton::value val = i->second; if (subType.compare("boolean") == 0) { - _receivedSubTypeList.append(val.get<proton::amqp_boolean>() ? Json::Value("True") : Json::Value("False")); + _receivedSubTypeList.append(val.get<bool>() ? Json::Value("True") : Json::Value("False")); } else if (subType.compare("byte") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<int8_t>(val.get<proton::amqp_byte>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int8_t>(val.get<int8_t>()))); } else if (subType.compare("bytes") == 0) { _receivedSubTypeList.append(Json::Value(val.get<proton::amqp_binary>())); } else if (subType.compare("char") == 0) { std::ostringstream oss; - oss << (char)val.get<proton::amqp_char>(); + oss << (char)val.get<wchar_t>(); _receivedSubTypeList.append(Json::Value(oss.str())); } else if (subType.compare("double") == 0) { - proton::amqp_double d = val.get<proton::amqp_double>(); + double d = val.get<double>(); _receivedSubTypeList.append(Json::Value(toHexStr<int64_t>(*((int64_t*)&d), true, false))); } else if (subType.compare("float") == 0) { - proton::amqp_float f = val.get<proton::amqp_float>(); + float f = val.get<float>(); _receivedSubTypeList.append(Json::Value(toHexStr<int32_t>(*((int32_t*)&f), true, false))); } else if (subType.compare("int") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<int32_t>(val.get<proton::amqp_int>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int32_t>(val.get<int32_t>()))); } else if (subType.compare("long") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<int64_t>(val.get<proton::amqp_long>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int64_t>(val.get<int64_t>()))); } else if (subType.compare("short") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<int16_t>(val.get<proton::amqp_short>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int16_t>(val.get<int16_t>()))); } else if (subType.compare("string") == 0) { _receivedSubTypeList.append(Json::Value(val.get<proton::amqp_string>())); } else { @@ -226,27 +226,27 @@ namespace qpidit msg.body().get(l); for (std::vector<proton::value>::const_iterator i=l.begin(); i!=l.end(); ++i) { if (subType.compare("boolean") == 0) { - _receivedSubTypeList.append(i->get<proton::amqp_boolean>() ? Json::Value("True") : Json::Value("False")); + _receivedSubTypeList.append(i->get<bool>() ? Json::Value("True") : Json::Value("False")); } else if (subType.compare("byte") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<proton::amqp_byte>(i->get<proton::amqp_byte>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int8_t>(i->get<int8_t>()))); } else if (subType.compare("bytes") == 0) { _receivedSubTypeList.append(Json::Value(i->get<proton::amqp_binary>())); } else if (subType.compare("char") == 0) { std::ostringstream oss; - oss << (char)i->get<proton::amqp_char>(); + oss << (char)i->get<wchar_t>(); _receivedSubTypeList.append(Json::Value(oss.str())); } else if (subType.compare("double") == 0) { - proton::amqp_double d = i->get<proton::amqp_double>(); + double d = i->get<double>(); _receivedSubTypeList.append(Json::Value(toHexStr<int64_t>(*((int64_t*)&d), true, false))); } else if (subType.compare("float") == 0) { - proton::amqp_float f = i->get<proton::amqp_float>(); + float f = i->get<float>(); _receivedSubTypeList.append(Json::Value(toHexStr<int32_t>(*((int32_t*)&f), true, false))); } else if (subType.compare("int") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<proton::amqp_int>(i->get<proton::amqp_int>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int32_t>(i->get<int32_t>()))); } else if (subType.compare("long") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<proton::amqp_long>(i->get<proton::amqp_long>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int64_t>(i->get<int64_t>()))); } else if (subType.compare("short") == 0) { - _receivedSubTypeList.append(Json::Value(toHexStr<proton::amqp_short>(i->get<proton::amqp_short>()))); + _receivedSubTypeList.append(Json::Value(toHexStr<int16_t>(i->get<int16_t>()))); } else if (subType.compare("string") == 0) { _receivedSubTypeList.append(Json::Value(i->get<proton::amqp_string>())); } else { @@ -264,8 +264,8 @@ namespace qpidit } //static - std::map<std::string, proton::amqp_byte> JmsReceiver::initializeJmsMessageTypeAnnotationMap() { - std::map<std::string, proton::amqp_byte> m; + std::map<std::string, int8_t> JmsReceiver::initializeJmsMessageTypeAnnotationMap() { + std::map<std::string, int8_t> m; m["JMS_MESSAGE_TYPE"] = JMS_MESSAGE_TYPE; m["JMS_OBJECTMESSAGE_TYPE"] = JMS_OBJECTMESSAGE_TYPE; m["JMS_MAPMESSAGE_TYPE"] = JMS_MAPMESSAGE_TYPE; http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.hpp ---------------------------------------------------------------------- diff --git a/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.hpp b/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.hpp index df96fde..22bd337 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.hpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.hpp @@ -38,7 +38,7 @@ namespace qpidit { protected: static proton::amqp_symbol s_jmsMessageTypeAnnotationKey; - static std::map<std::string, proton::amqp_byte>s_jmsMessageTypeAnnotationValues; + static std::map<std::string, int8_t>s_jmsMessageTypeAnnotationValues; const std::string _brokerUrl; const std::string _jmsMessageType; @@ -67,7 +67,7 @@ namespace qpidit void receiveJmsStreamMessage(const proton::message& msg); void receiveJmsTextMessage(const proton::message& msg); - static std::map<std::string, proton::amqp_byte> initializeJmsMessageTypeAnnotationMap(); + static std::map<std::string, int8_t> initializeJmsMessageTypeAnnotationMap(); // Format signed numbers in negative hex format if signedFlag is true, ie -0xNNNN, positive numbers in 0xNNNN format template<typename T> static std::string toHexStr(T val, bool fillFlag = false, bool signedFlag = true) { http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/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 24e954b..e1874d9 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp @@ -37,7 +37,7 @@ namespace qpidit typedef enum {JMS_MESSAGE_TYPE=0, JMS_OBJECTMESSAGE_TYPE, JMS_MAPMESSAGE_TYPE, JMS_BYTESMESSAGE_TYPE, JMS_STREAMMESSAGE_TYPE, JMS_TEXTMESSAGE_TYPE} jmsMessageType_t; //static proton::amqp_symbol JmsSender::s_jmsMessageTypeAnnotationKey("x-opt-jms-msg-type"); - std::map<std::string, proton::amqp_byte>JmsSender::s_jmsMessageTypeAnnotationValues = initializeJmsMessageTypeAnnotationMap(); + std::map<std::string, int8_t>JmsSender::s_jmsMessageTypeAnnotationValues = initializeJmsMessageTypeAnnotationMap(); JmsSender::JmsSender(const std::string& brokerUrl, const std::string& jmsMessageType, @@ -174,11 +174,11 @@ namespace qpidit std::string mapKey(oss.str()); std::map<std::string, proton::value> m; if (subType.compare("boolean") == 0) { - if (testValueStr.compare("False") == 0) m[mapKey] = proton::amqp_boolean(false); - else if (testValueStr.compare("True") == 0) m[mapKey] = proton::amqp_boolean(true); + if (testValueStr.compare("False") == 0) m[mapKey] = false; + else if (testValueStr.compare("True") == 0) m[mapKey] = true; else throw InvalidTestValueError(subType, testValueStr); } else if (subType.compare("byte") == 0) { - m[mapKey] = proton::amqp_byte(getIntegralValue<int8_t>(testValueStr)); + m[mapKey] = int8_t(getIntegralValue<int8_t>(testValueStr)); } else if (subType.compare("bytes") == 0) { m[mapKey] = proton::amqp_binary(testValueStr); } else if (subType.compare("char") == 0) { @@ -188,17 +188,17 @@ namespace qpidit } else { // Format: 'c' val = testValueStr[0]; } - m[mapKey] = proton::amqp_char(val); + m[mapKey] = val; } else if (subType.compare("double") == 0) { - m[mapKey] = proton::amqp_double(getFloatValue<double, uint64_t>(testValueStr)); + m[mapKey] = getFloatValue<double, uint64_t>(testValueStr); } else if (subType.compare("float") == 0) { - m[mapKey] = proton::amqp_float(getFloatValue<float, uint32_t>(testValueStr)); + m[mapKey] = getFloatValue<float, uint32_t>(testValueStr); } else if (subType.compare("int") == 0) { - m[mapKey] = proton::amqp_int(getIntegralValue<int32_t>(testValueStr)); + m[mapKey] = getIntegralValue<int32_t>(testValueStr); } else if (subType.compare("long") == 0) { - m[mapKey] = proton::amqp_long(getIntegralValue<int64_t>(testValueStr)); + m[mapKey] = getIntegralValue<int64_t>(testValueStr); } else if (subType.compare("short") == 0) { - m[mapKey] = proton::amqp_short(getIntegralValue<int16_t>(testValueStr)); + m[mapKey] = getIntegralValue<int16_t>(testValueStr); } else if (subType.compare("string") == 0) { m[mapKey] = proton::amqp_string(testValueStr); } else { @@ -221,11 +221,11 @@ namespace qpidit proton::message& JmsSender::setStreamMessage(proton::message& msg, const std::string& subType, const std::string& testValueStr) { std::vector<proton::value> l; if (subType.compare("boolean") == 0) { - if (testValueStr.compare("False") == 0) l.push_back(proton::value(proton::amqp_boolean(false))); - else if (testValueStr.compare("True") == 0) l.push_back(proton::value(proton::amqp_boolean(true))); + if (testValueStr.compare("False") == 0) l.push_back(proton::value(false)); + else if (testValueStr.compare("True") == 0) l.push_back(proton::value(true)); else throw InvalidTestValueError(subType, testValueStr); } else if (subType.compare("byte") == 0) { - l.push_back(proton::value(proton::amqp_byte(getIntegralValue<int8_t>(testValueStr)))); + l.push_back(proton::value(int8_t(getIntegralValue<int8_t>(testValueStr)))); } else if (subType.compare("bytes") == 0) { l.push_back(proton::value(proton::amqp_binary(testValueStr))); } else if (subType.compare("char") == 0) { @@ -235,17 +235,17 @@ namespace qpidit } else { // Format: 'c' val = testValueStr[0]; } - l.push_back(proton::value(proton::amqp_char(val))); + l.push_back(proton::value(val)); } else if (subType.compare("double") == 0) { - l.push_back(proton::value(proton::amqp_double(getFloatValue<double, uint64_t>(testValueStr)))); + l.push_back(proton::value(getFloatValue<double, uint64_t>(testValueStr))); } else if (subType.compare("float") == 0) { - l.push_back(proton::value(proton::amqp_float(getFloatValue<float, uint32_t>(testValueStr)))); + l.push_back(proton::value(getFloatValue<float, uint32_t>(testValueStr))); } else if (subType.compare("int") == 0) { - l.push_back(proton::value(proton::amqp_int(getIntegralValue<int32_t>(testValueStr)))); + l.push_back(proton::value(getIntegralValue<int32_t>(testValueStr))); } else if (subType.compare("long") == 0) { - l.push_back(proton::value(proton::amqp_long(getIntegralValue<int64_t>(testValueStr)))); + l.push_back(proton::value(getIntegralValue<int64_t>(testValueStr))); } else if (subType.compare("short") == 0) { - l.push_back(proton::value(proton::amqp_short(getIntegralValue<int16_t>(testValueStr)))); + l.push_back(proton::value(getIntegralValue<int16_t>(testValueStr))); } else if (subType.compare("string") == 0) { l.push_back(proton::value(proton::amqp_string(testValueStr))); } else { @@ -292,8 +292,8 @@ namespace qpidit } //static - std::map<std::string, proton::amqp_byte> JmsSender::initializeJmsMessageTypeAnnotationMap() { - std::map<std::string, proton::amqp_byte> m; + std::map<std::string, int8_t> JmsSender::initializeJmsMessageTypeAnnotationMap() { + std::map<std::string, int8_t> m; m["JMS_MESSAGE_TYPE"] = JMS_MESSAGE_TYPE; m["JMS_OBJECTMESSAGE_TYPE"] = JMS_OBJECTMESSAGE_TYPE; m["JMS_MAPMESSAGE_TYPE"] = JMS_MAPMESSAGE_TYPE; http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/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 7ffca2c..913f400 100644 --- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp +++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp @@ -40,7 +40,7 @@ namespace qpidit { protected: static proton::amqp_symbol s_jmsMessageTypeAnnotationKey; - static std::map<std::string, proton::amqp_byte>s_jmsMessageTypeAnnotationValues; + static std::map<std::string, int8_t>s_jmsMessageTypeAnnotationValues; const std::string _brokerUrl; const std::string _jmsMessageType; @@ -66,7 +66,7 @@ namespace qpidit static proton::amqp_binary getJavaObjectBinary(const std::string& javaClassName, const std::string& valAsString); static uint32_t getTotalNumMessages(const Json::Value& testValueMap); - static std::map<std::string, proton::amqp_byte> initializeJmsMessageTypeAnnotationMap(); + static std::map<std::string, int8_t> initializeJmsMessageTypeAnnotationMap(); // 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 http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/ab84b0ee/src/py/qpid-interop-test/jms/jms_message_tests.py ---------------------------------------------------------------------- diff --git a/src/py/qpid-interop-test/jms/jms_message_tests.py b/src/py/qpid-interop-test/jms/jms_message_tests.py index b92d98c..244b235 100755 --- a/src/py/qpid-interop-test/jms/jms_message_tests.py +++ b/src/py/qpid-interop-test/jms/jms_message_tests.py @@ -51,129 +51,10 @@ class JmsMessageTypes(TestTypeMap): TYPE_SUBMAP = { 'boolean': ['True', 'False'], - 'byte': ['-0x80', - '-0x1', - '0x0', - '0x7f'], - 'bytes': [b'', - b'12345', - b'Hello, world', - b'\\x01\\x02\\x03\\x04\\x05abcde\\x80\\x81\\xfe\\xff', - b'The quick brown fox jumped over the lazy dog 0123456789.' * 100], - 'char': ['a', - 'Z', - '\x01', - '\x7f'], - 'double': ['0x0000000000000000', # 0.0 - '0x8000000000000000', # -0.0 - '0x400921fb54442eea', # pi (3.14159265359) positive decimal - '0xc005bf0a8b145fcf', # -e (-2.71828182846) negative decimal - '0x0000000000000001', # Smallest positive denormalized number - '0x8000000000000001', # Smallest negative denormalized number - '0x000fffffffffffff', # Largest positive denormalized number - '0x8010000000000000', # Largest negative denormalized number - '0x7fefffffffffffff', # Largest positive normalized number - '0xffefffffffffffff', # Largest negative normalized number - '0x7ff0000000000000', # +Infinity - '0xfff0000000000000', # -Infinity - '0x7ff8000000000000'], # +NaN - 'float': ['0x00000000', # 0.0 - '0x80000000', # -0.0 - '0x40490fdb', # pi (3.14159265359) positive decimal - '0xc02df854', # -e (-2.71828182846) negative decimal - '0x00000001', # Smallest positive denormalized number - '0x80000001', # Smallest negative denormalized number - '0x007fffff', # Largest positive denormalized number - '0x807fffff', # Largest negative denormalized number - '0x00800000', # Smallest positive normalized number - '0x80800000', # Smallest negative normalized number - '0x7f7fffff', # Largest positive normalized number - '0xff7fffff', # Largest negative normalized number - #'0x7f800000', # +Infinity # PROTON-1149 - fails on RHEL7 - #'0xff800000', # -Infinity # PROTON-1149 - fails on RHEL7 - '0x7fc00000'], # +NaN - 'int': ['-0x80000000', - '-0x81', - '-0x80', - '-0x1', - '0x0', - '0x7f', - '0x80', - '0x7fffffff'], - 'long': ['-0x8000000000000000', - '-0x81', - '-0x80', - '-0x1', - '0x0', - '0x7f', - '0x80', - '0x7fffffffffffffff'], - 'short': ['-0x8000', - '-0x1', - '0x0', - '0x7fff'], - 'string': ['', - 'Hello, world', - '"Hello, world"', - "Charlie's \"peach\"", - 'Charlie\'s "peach"', - 'The quick brown fox jumped over the lazy dog 0123456789.' * 100] } TYPE_MAP = { 'JMS_BYTESMESSAGE_TYPE': TYPE_SUBMAP, - 'JMS_MAPMESSAGE_TYPE': TYPE_SUBMAP, -# 'JMS_OBJECTMESSAGE_TYPE': { -# 'java.lang.Boolean': ['true', -# 'false'], -# 'java.lang.Byte': ['-128', -# '0', -# '127'], -# 'java.lang.Character': [u'a', -# u'Z'], -# 'java.lang.Double': ['0.0', -# '3.141592654', -# '-2.71828182846'], -# 'java.lang.Float': ['0.0', -# '3.14159', -# '-2.71828'], -# 'java.lang.Integer': ['-2147483648', -# '-129', -# '-128', -# '-1', -# '0', -# '127', -# '128', -# '2147483647'], -# 'java.lang.Long' : ['-9223372036854775808', -# '-129', -# '-128', -# '-1', -# '0', -# '127', -# '128', -# '9223372036854775807'], -# 'java.lang.Short': ['-32768', -# '-129', -# '-128', -# '-1', -# '0', -# '127', -# '128', -# '32767'], -# 'java.lang.String': [u'', -# u'Hello, world', -# u'"Hello, world"', -# u"Charlie's \"peach\"", -# u'Charlie\'s "peach"'] -# }, - 'JMS_STREAMMESSAGE_TYPE': TYPE_SUBMAP, - 'JMS_TEXTMESSAGE_TYPE': {'text': ['', - 'Hello, world', - '"Hello, world"', - "Charlie's \"peach\"", - 'Charlie\'s "peach"', - 'The quick brown fox jumped over the lazy dog 0123456789.' * 100]} } BROKER_SKIP = {} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org