You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2016/03/21 21:15:42 UTC
[3/5] qpid-interop-test git commit: QPIDIT-22: Updated AMQP and types
test to latest Proton C++ API.
QPIDIT-22: Updated AMQP and types test to latest Proton C++ API.
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/901635ad
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/901635ad
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/901635ad
Branch: refs/heads/master
Commit: 901635ad72f222ad11892dbc3163150afbca2349
Parents: ab9f27a
Author: Kim van der Riet <kp...@apache.org>
Authored: Thu Mar 17 12:59:19 2016 -0400
Committer: Kim van der Riet <kp...@apache.org>
Committed: Thu Mar 17 12:59:19 2016 -0400
----------------------------------------------------------------------
.../qpid-proton-cpp/src/qpidit/QpidItErrors.cpp | 5 +-
.../qpid-proton-cpp/src/qpidit/QpidItErrors.hpp | 2 +-
.../src/qpidit/shim/AmqpReceiver.cpp | 12 +-
.../src/qpidit/shim/AmqpSender.cpp | 10 +-
.../src/qpidit/shim/JmsReceiver.cpp | 36 +++---
.../src/qpidit/shim/JmsReceiver.hpp | 2 +-
.../src/qpidit/shim/JmsSender.cpp | 76 ++++++------
.../src/qpidit/shim/JmsSender.hpp | 4 +-
.../qpid-interop-test/jms/jms_message_tests.py | 119 +++++++++++++++++++
9 files changed, 193 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 9287fdc..0545263 100644
--- a/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.cpp
+++ b/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.cpp
@@ -22,6 +22,7 @@
#include "qpidit/QpidItErrors.hpp"
#include <json/reader.h>
+#include <string.h>
namespace qpidit
{
@@ -64,8 +65,8 @@ namespace qpidit
// --- IncorrectMessageBodyLengthError ---
- IncorrectMessageBodyLengthError::IncorrectMessageBodyLengthError(int expected, int found) :
- std::runtime_error(MSG("Incorrect body length found in message body: expected: " << expected
+ 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))
{}
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.hpp
----------------------------------------------------------------------
diff --git a/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.hpp b/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.hpp
index 2beaecb..3632af6 100644
--- a/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.hpp
+++ b/shims/qpid-proton-cpp/src/qpidit/QpidItErrors.hpp
@@ -74,7 +74,7 @@ namespace qpidit
class IncorrectMessageBodyLengthError: public std::runtime_error
{
public:
- IncorrectMessageBodyLengthError(int expected, int found);
+ IncorrectMessageBodyLengthError(const std::string& context, int expected, int found);
virtual ~IncorrectMessageBodyLengthError() throw();
};
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 25985fa..66795f3 100644
--- a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.cpp
+++ b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpReceiver.cpp
@@ -23,8 +23,8 @@
#include <iostream>
#include <json/json.h>
+#include <proton/types.hpp>
#include "proton/container.hpp"
-#include "proton/decimal.hpp"
#include "proton/event.hpp"
#include "qpidit/QpidItErrors.hpp"
@@ -126,13 +126,13 @@ namespace qpidit
_receivedValueList.append(oss.str());
} else if (_amqpType.compare("binary") == 0) {
checkMessageType(msg, proton::BINARY);
- _receivedValueList.append(msg.body().get<proton::amqp_binary>());
+ _receivedValueList.append(std::string(msg.body().get<proton::binary>()));
} else if (_amqpType.compare("string") == 0) {
checkMessageType(msg, proton::STRING);
- _receivedValueList.append(msg.body().get<proton::amqp_string>());
+ _receivedValueList.append(msg.body().get<std::string>());
} else if (_amqpType.compare("symbol") == 0) {
checkMessageType(msg, proton::SYMBOL);
- _receivedValueList.append(msg.body().get<proton::amqp_symbol>());
+ _receivedValueList.append(msg.body().get<proton::symbol>());
} else if (_amqpType.compare("list") == 0) {
checkMessageType(msg, proton::LIST);
Json::Value jsonList(Json::arrayValue);
@@ -166,7 +166,7 @@ namespace qpidit
//static
Json::Value& AmqpReceiver::getMap(Json::Value& jsonMap, const proton::value& val) {
std::map<proton::value, proton::value> msgMap;
- val.decode() >> proton::to_map(msgMap);
+ val.get(msgMap);
for (std::map<proton::value, proton::value>::const_iterator i = msgMap.begin(); i != msgMap.end(); ++i) {
switch (i->second.type()) {
case proton::LIST:
@@ -196,7 +196,7 @@ namespace qpidit
//static
Json::Value& AmqpReceiver::getSequence(Json::Value& jsonList, const proton::value& val) {
std::vector<proton::value> msgList;
- val.decode() >> proton::to_sequence(msgList);
+ val.get(msgList);
for (std::vector<proton::value>::const_iterator i=msgList.begin(); i!=msgList.end(); ++i) {
switch ((*i).type()) {
case proton::LIST:
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 9b3613c..e1c8bf7 100644
--- a/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.cpp
+++ b/shims/qpid-proton-cpp/src/qpidit/shim/AmqpSender.cpp
@@ -154,24 +154,24 @@ namespace qpidit
msg.body(val);
} else if (_amqpType.compare("binary") == 0) {
//setStringValue<proton::amqp_binary>(msg, testValue.asString());
- proton::amqp_binary val(testValue.asString());
+ proton::binary val(testValue.asString());
msg.body(val);
} else if (_amqpType.compare("string") == 0) {
//setStringValue<proton::amqp_string>(msg, testValue.asString());
- proton::amqp_string val(testValue.asString());
+ std::string val(testValue.asString());
msg.body(val);
} else if (_amqpType.compare("symbol") == 0) {
//setStringValue<proton::amqp_symbol>(msg, testValue.asString());
- proton::amqp_symbol val(testValue.asString());
+ proton::symbol val(testValue.asString());
msg.body(val);
} else if (_amqpType.compare("list") == 0) {
std::vector<proton::value> list;
processList(list, testValue);
- msg.body(proton::as<proton::LIST>(list));
+ msg.body(list);
} else if (_amqpType.compare("map") == 0) {
std::map<std::string, proton::value> map;
processMap(map, testValue);
- msg.body(proton::as<proton::MAP>(map));
+ msg.body(map);
} else if (_amqpType.compare("array") == 0) {
/*
std::vector<proton::value> array;
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 2320824..1ec3083 100644
--- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.cpp
+++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.cpp
@@ -34,7 +34,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");
+ proton::symbol JmsReceiver::s_jmsMessageTypeAnnotationKey("x-opt-jms-msg-type");
std::map<std::string, int8_t>JmsReceiver::s_jmsMessageTypeAnnotationValues = initializeJmsMessageTypeAnnotationMap();
@@ -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<int8_t>()) {
+ switch (msg.message_annotations()[proton::symbol("x-opt-jms-msg-type")].get<int8_t>()) {
case JMS_MESSAGE_TYPE:
receiveJmsMessage(msg);
break;
@@ -142,7 +142,7 @@ namespace qpidit
} else if (subType.compare("byte") == 0) {
_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>()));
+ _receivedSubTypeList.append(Json::Value(std::string(val.get<proton::binary>())));
} else if (subType.compare("char") == 0) {
std::ostringstream oss;
oss << (char)val.get<wchar_t>();
@@ -160,7 +160,7 @@ namespace qpidit
} else if (subType.compare("short") == 0) {
_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>()));
+ _receivedSubTypeList.append(Json::Value(val.get<std::string>()));
} else {
throw qpidit::UnknownJmsMessageSubTypeError(subType);
}
@@ -172,46 +172,46 @@ namespace qpidit
throw qpidit::IncorrectMessageBodyTypeError(_jmsMessageType, "JMS_BYTESMESSAGE_TYPE");
}
std::string subType(_subTypeList[_subTypeIndex]);
- proton::amqp_binary body = msg.body().get<proton::amqp_binary>();
+ proton::binary body = msg.body().get<proton::binary>();
if (subType.compare("boolean") == 0) {
- if (body.size() != 1) throw IncorrectMessageBodyLengthError(1, body.size());
+ if (body.size() != 1) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=boolean", 1, body.size());
_receivedSubTypeList.append(body[0] ? Json::Value("True") : Json::Value("False"));
} else if (subType.compare("byte") == 0) {
- if (body.size() != sizeof(int8_t)) throw IncorrectMessageBodyLengthError(sizeof(int8_t), body.size());
+ if (body.size() != sizeof(int8_t)) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=byte", sizeof(int8_t), body.size());
int8_t val = *((int8_t*)body.data());
_receivedSubTypeList.append(Json::Value(toHexStr<int8_t>(val)));
} else if (subType.compare("bytes") == 0) {
- _receivedSubTypeList.append(Json::Value(body));
+ _receivedSubTypeList.append(Json::Value(std::string(body)));
} else if (subType.compare("char") == 0) {
- if (body.size() != sizeof(uint16_t)) throw IncorrectMessageBodyLengthError(sizeof(uint16_t), body.size());
+ if (body.size() != sizeof(uint16_t)) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=char", sizeof(uint16_t), body.size());
// TODO: This is ugly: ignoring first byte - handle UTF-16 correctly
char c = body[1];
std::ostringstream oss;
oss << c;
_receivedSubTypeList.append(Json::Value(oss.str()));
} else if (subType.compare("double") == 0) {
- if (body.size() != sizeof(int64_t)) throw IncorrectMessageBodyLengthError(sizeof(int64_t), body.size());
+ if (body.size() != sizeof(int64_t)) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=double", sizeof(int64_t), body.size());
int64_t val = be64toh(*((int64_t*)body.data()));
_receivedSubTypeList.append(Json::Value(toHexStr<int64_t>(val, true, false)));
} else if (subType.compare("float") == 0) {
- if (body.size() != sizeof(int32_t)) throw IncorrectMessageBodyLengthError(sizeof(int32_t), body.size());
+ if (body.size() != sizeof(int32_t)) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=float", sizeof(int32_t), body.size());
int32_t val = be32toh(*((int32_t*)body.data()));
_receivedSubTypeList.append(Json::Value(toHexStr<int32_t>(val, true, false)));
} else if (subType.compare("long") == 0) {
- if (body.size() != sizeof(int64_t)) throw IncorrectMessageBodyLengthError(sizeof(int64_t), body.size());
+ if (body.size() != sizeof(int64_t)) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=long", sizeof(int64_t), body.size());
int64_t val = be64toh(*((int64_t*)body.data()));
_receivedSubTypeList.append(Json::Value(toHexStr<int64_t>(val)));
} else if (subType.compare("int") == 0) {
- if (body.size() != sizeof(int32_t)) throw IncorrectMessageBodyLengthError(sizeof(int32_t), body.size());
+ if (body.size() != sizeof(int32_t)) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=int", sizeof(int32_t), body.size());
int32_t val = be32toh(*((int32_t*)body.data()));
_receivedSubTypeList.append(Json::Value(toHexStr<int32_t>(val)));
} else if (subType.compare("short") == 0) {
- if (body.size() != sizeof(int16_t)) throw IncorrectMessageBodyLengthError(sizeof(int16_t), body.size());
+ if (body.size() != sizeof(int16_t)) throw IncorrectMessageBodyLengthError("JmsReceiver::receiveJmsBytesMessage, subType=short", sizeof(int16_t), body.size());
int16_t val = be16toh(*((int16_t*)body.data()));
_receivedSubTypeList.append(Json::Value(toHexStr<int16_t>(val)));
} else if (subType.compare("string") == 0) {
// TODO: decode string size in first two bytes and check string size
- _receivedSubTypeList.append(Json::Value(body.substr(2)));
+ _receivedSubTypeList.append(Json::Value(std::string(body).substr(2)));
} else {
throw qpidit::UnknownJmsMessageSubTypeError(subType);
}
@@ -230,7 +230,7 @@ namespace qpidit
} else if (subType.compare("byte") == 0) {
_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>()));
+ _receivedSubTypeList.append(Json::Value(std::string(i->get<proton::binary>())));
} else if (subType.compare("char") == 0) {
std::ostringstream oss;
oss << (char)i->get<wchar_t>();
@@ -248,7 +248,7 @@ namespace qpidit
} else if (subType.compare("short") == 0) {
_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>()));
+ _receivedSubTypeList.append(Json::Value(i->get<std::string>()));
} else {
throw qpidit::UnknownJmsMessageSubTypeError(subType);
}
@@ -260,7 +260,7 @@ namespace qpidit
if(_jmsMessageType.compare("JMS_TEXTMESSAGE_TYPE") != 0) {
throw qpidit::IncorrectMessageBodyTypeError(_jmsMessageType, "JMS_TEXTMESSAGE_TYPE");
}
- _receivedSubTypeList.append(Json::Value(msg.body().get<proton::amqp_string>()));
+ _receivedSubTypeList.append(Json::Value(msg.body().get<std::string>()));
}
//static
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 22bd337..dda1204 100644
--- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.hpp
+++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsReceiver.hpp
@@ -37,7 +37,7 @@ namespace qpidit
class JmsReceiver : public proton::handler
{
protected:
- static proton::amqp_symbol s_jmsMessageTypeAnnotationKey;
+ static proton::symbol s_jmsMessageTypeAnnotationKey;
static std::map<std::string, int8_t>s_jmsMessageTypeAnnotationValues;
const std::string _brokerUrl;
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 e1874d9..3d81cc4 100644
--- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp
+++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.cpp
@@ -36,7 +36,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");
+ proton::symbol JmsSender::s_jmsMessageTypeAnnotationKey("x-opt-jms-msg-type");
std::map<std::string, int8_t>JmsSender::s_jmsMessageTypeAnnotationValues = initializeJmsMessageTypeAnnotationMap();
JmsSender::JmsSender(const std::string& brokerUrl,
@@ -112,59 +112,59 @@ namespace qpidit
}
proton::message& JmsSender::setBytesMessage(proton::message& msg, const std::string& subType, const std::string& testValueStr) {
- proton::amqp_binary bin;
+ proton::binary bin;
if (subType.compare("boolean") == 0) {
- if (testValueStr.compare("False") == 0) bin.assign("\x00", 1);
- else if (testValueStr.compare("True") == 0) bin.assign("\x01", 1);
+ if (testValueStr.compare("False") == 0) bin.push_back(char(0));
+ else if (testValueStr.compare("True") == 0) bin.push_back(char(1));
else throw InvalidTestValueError(subType, testValueStr);
} else if (subType.compare("byte") == 0) {
uint8_t val = getIntegralValue<int8_t>(testValueStr);
- bin.assign((char*)&val, sizeof(val));
+ bin.push_back(char(val));
} else if (subType.compare("bytes") == 0) {
- bin.assign(testValueStr);
+ bin.assign(testValueStr.begin(), testValueStr.end());
} else if (subType.compare("char") == 0) {
char val[2];
val[0] = 0;
if (testValueStr[0] == '\\') { // Format: '\xNN'
- val[1] = (char)getIntegralValue<char>(testValueStr.substr(2));
+ bin.push_back(getIntegralValue<char>(testValueStr.substr(2)));
} else { // Format: 'c'
- val[1] = testValueStr[0];
+ bin.push_back(testValueStr[0]);
}
- bin.assign(val, sizeof(val));
} else if (subType.compare("double") == 0) {
uint64_t val;
try {
val = htobe64(std::strtoul(testValueStr.data(), NULL, 16));
} catch (const std::exception& e) { throw qpidit::InvalidTestValueError("double", testValueStr); }
- bin.assign((char*)&val, sizeof(val));
+ bin.assign(sizeof(val), val);
} 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((char*)&val, sizeof(val));
+ bin.assign(sizeof(val), val);
} else if (subType.compare("long") == 0) {
uint64_t val = htobe64(getIntegralValue<uint64_t>(testValueStr));
- bin.assign((char*)&val, sizeof(val));
+ bin.assign(sizeof(val), val);
} else if (subType.compare("int") == 0) {
uint32_t val = htobe32(getIntegralValue<uint32_t>(testValueStr));
- bin.assign((char*)&val, sizeof(val));
+ bin.assign(sizeof(val), val);
} else if (subType.compare("short") == 0) {
uint16_t val = htobe16(getIntegralValue<int16_t>(testValueStr));
- bin.assign((char*)&val, sizeof(val));
+ bin.assign(sizeof(val), val);
} else if (subType.compare("string") == 0) {
std::ostringstream oss;
uint16_t strlen = htobe16((uint16_t)testValueStr.size());
oss.write((char*)&strlen, sizeof(strlen));
oss << testValueStr;
- bin.assign(oss.str());
+ std::string os = oss.str();
+ bin.assign(os.begin(), os.end());
} else {
throw qpidit::UnknownJmsMessageSubTypeError(subType);
}
msg.body(bin);
msg.inferred(true);
- msg.content_type(proton::amqp_symbol("application/octet-stream"));
- msg.message_annotations()[proton::amqp_symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_BYTESMESSAGE_TYPE"];
+ msg.content_type(proton::symbol("application/octet-stream"));
+ msg.message_annotations()[proton::symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_BYTESMESSAGE_TYPE"];
return msg;
}
@@ -180,7 +180,7 @@ namespace qpidit
} else if (subType.compare("byte") == 0) {
m[mapKey] = int8_t(getIntegralValue<int8_t>(testValueStr));
} else if (subType.compare("bytes") == 0) {
- m[mapKey] = proton::amqp_binary(testValueStr);
+ m[mapKey] = proton::binary(testValueStr);
} else if (subType.compare("char") == 0) {
wchar_t val;
if (testValueStr[0] == '\\') { // Format: '\xNN'
@@ -200,34 +200,34 @@ namespace qpidit
} else if (subType.compare("short") == 0) {
m[mapKey] = getIntegralValue<int16_t>(testValueStr);
} else if (subType.compare("string") == 0) {
- m[mapKey] = proton::amqp_string(testValueStr);
+ m[mapKey] = testValueStr;
} else {
throw qpidit::UnknownJmsMessageSubTypeError(subType);
}
msg.inferred(false);
msg.body(m);
- msg.message_annotations()[proton::amqp_symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_MAPMESSAGE_TYPE"];
+ msg.message_annotations()[proton::symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_MAPMESSAGE_TYPE"];
return msg;
}
proton::message& JmsSender::setObjectMessage(proton::message& msg, const std::string& subType, const Json::Value& testValue) {
msg.body(getJavaObjectBinary(subType, testValue.asString()));
msg.inferred(true);
- msg.content_type(proton::amqp_symbol("application/x-java-serialized-object"));
- msg.message_annotations()[proton::amqp_symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_OBJECTMESSAGE_TYPE"];
+ msg.content_type(proton::symbol("application/x-java-serialized-object"));
+ msg.message_annotations()[proton::symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_OBJECTMESSAGE_TYPE"];
return msg;
}
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(false));
- else if (testValueStr.compare("True") == 0) l.push_back(proton::value(true));
+ if (testValueStr.compare("False") == 0) l.push_back(false);
+ else if (testValueStr.compare("True") == 0) l.push_back(true);
else throw InvalidTestValueError(subType, testValueStr);
} else if (subType.compare("byte") == 0) {
- l.push_back(proton::value(int8_t(getIntegralValue<int8_t>(testValueStr))));
+ l.push_back(int8_t(getIntegralValue<int8_t>(testValueStr)));
} else if (subType.compare("bytes") == 0) {
- l.push_back(proton::value(proton::amqp_binary(testValueStr)));
+ l.push_back(proton::binary(testValueStr));
} else if (subType.compare("char") == 0) {
wchar_t val;
if (testValueStr[0] == '\\') { // Format: '\xNN'
@@ -235,45 +235,45 @@ namespace qpidit
} else { // Format: 'c'
val = testValueStr[0];
}
- l.push_back(proton::value(val));
+ l.push_back(val);
} else if (subType.compare("double") == 0) {
- l.push_back(proton::value(getFloatValue<double, uint64_t>(testValueStr)));
+ l.push_back(getFloatValue<double, uint64_t>(testValueStr));
} else if (subType.compare("float") == 0) {
- l.push_back(proton::value(getFloatValue<float, uint32_t>(testValueStr)));
+ l.push_back(getFloatValue<float, uint32_t>(testValueStr));
} else if (subType.compare("int") == 0) {
- l.push_back(proton::value(getIntegralValue<int32_t>(testValueStr)));
+ l.push_back(getIntegralValue<int32_t>(testValueStr));
} else if (subType.compare("long") == 0) {
- l.push_back(proton::value(getIntegralValue<int64_t>(testValueStr)));
+ l.push_back(getIntegralValue<int64_t>(testValueStr));
} else if (subType.compare("short") == 0) {
- l.push_back(proton::value(getIntegralValue<int16_t>(testValueStr)));
+ l.push_back(getIntegralValue<int16_t>(testValueStr));
} else if (subType.compare("string") == 0) {
- l.push_back(proton::value(proton::amqp_string(testValueStr)));
+ l.push_back(testValueStr);
} else {
throw qpidit::UnknownJmsMessageSubTypeError(subType);
}
msg.body(l);
msg.inferred(true);
- msg.message_annotations()[proton::amqp_symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_STREAMMESSAGE_TYPE"];
+ msg.message_annotations()[proton::symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_STREAMMESSAGE_TYPE"];
return msg;
}
proton::message& JmsSender::setTextMessage(proton::message& msg, const Json::Value& testValue) {
msg.body(testValue.asString());
msg.inferred(false);
- msg.message_annotations()[proton::amqp_symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_TEXTMESSAGE_TYPE"];
+ msg.message_annotations()[proton::symbol("x-opt-jms-msg-type")] = s_jmsMessageTypeAnnotationValues["JMS_TEXTMESSAGE_TYPE"];
return msg;
}
//static
- proton::amqp_binary JmsSender::getJavaObjectBinary(const std::string& javaClassName, const std::string& valAsString) {
- proton::amqp_binary javaObjectBinary;
+ proton::binary JmsSender::getJavaObjectBinary(const std::string& javaClassName, const std::string& valAsString) {
+ proton::binary javaObjectBinary;
char buf[1024];
int bytesRead;
FILE* fp = ::popen("java -cp target/JavaObjUtils.jar org.apache.qpid.interop_test.obj_util.JavaObjToBytes javaClassStr", "rb");
if (fp == NULL) { throw qpidit::PopenError(errno); }
do {
bytesRead = ::fread(buf, 1, sizeof(buf), fp);
- javaObjectBinary.append(buf, bytesRead);
+ javaObjectBinary.insert(javaObjectBinary.end(), &buf[0], &buf[bytesRead-1]);
} while (bytesRead == sizeof(buf));
int status = ::pclose(fp);
if (status == -1) {
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 913f400..5ad5e86 100644
--- a/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp
+++ b/shims/qpid-proton-cpp/src/qpidit/shim/JmsSender.hpp
@@ -39,7 +39,7 @@ namespace qpidit
class JmsSender : public proton::handler
{
protected:
- static proton::amqp_symbol s_jmsMessageTypeAnnotationKey;
+ static proton::symbol s_jmsMessageTypeAnnotationKey;
static std::map<std::string, int8_t>s_jmsMessageTypeAnnotationValues;
const std::string _brokerUrl;
@@ -63,7 +63,7 @@ namespace qpidit
proton::message& setStreamMessage(proton::message& msg, const std::string& subType, const std::string& testValue);
proton::message& setTextMessage(proton::message& msg, const Json::Value& testValue);
- static proton::amqp_binary getJavaObjectBinary(const std::string& javaClassName, const std::string& valAsString);
+ static proton::binary getJavaObjectBinary(const std::string& javaClassName, const std::string& valAsString);
static uint32_t getTotalNumMessages(const Json::Value& testValueMap);
static std::map<std::string, int8_t> initializeJmsMessageTypeAnnotationMap();
http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/901635ad/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 244b235..b92d98c 100755
--- a/src/py/qpid-interop-test/jms/jms_message_tests.py
+++ b/src/py/qpid-interop-test/jms/jms_message_tests.py
@@ -51,10 +51,129 @@ 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-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org