You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2019/10/11 07:19:35 UTC
[qpid-proton] branch jd_2019-10_jsoncppversion updated:
ENTMQCL-1756 fix connect_config parsing tests when jsoncpp < 1.7.0
This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch jd_2019-10_jsoncppversion
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/jd_2019-10_jsoncppversion by this push:
new 5213b73 ENTMQCL-1756 fix connect_config parsing tests when jsoncpp < 1.7.0
5213b73 is described below
commit 5213b739c253680959e061cd14a0c5c30b0bca79
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Fri Oct 11 09:17:32 2019 +0200
ENTMQCL-1756 fix connect_config parsing tests when jsoncpp < 1.7.0
---
cpp/src/connect_config_test.cpp | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/cpp/src/connect_config_test.cpp b/cpp/src/connect_config_test.cpp
index 541dcdc..1649f7f 100644
--- a/cpp/src/connect_config_test.cpp
+++ b/cpp/src/connect_config_test.cpp
@@ -46,6 +46,8 @@
#include <proton/transport.h>
#include <proton/connection.h>
+#include <json/version.h>
+
// Windows has a different set of APIs for setting the environment
#ifdef _WIN32
#include <string.h>
@@ -119,11 +121,8 @@ void test_addr() {
// Hack to write strings with embedded '"' and newlines
#define RAW_STRING(...) #__VA_ARGS__
-void test_invalid() {
+void test_invalid_config() {
connection_options opts;
- ASSERT_THROWS_MSG(proton::error, "Missing '}'", configure(opts, "{"));
- ASSERT_THROWS_MSG(proton::error, "Syntax error", configure(opts, ""));
- ASSERT_THROWS_MSG(proton::error, "Missing ','", configure(opts, RAW_STRING({ "user":"x" "host":"y"})));
ASSERT_THROWS_MSG(proton::error, "expected string", configure(opts, RAW_STRING({ "scheme":true})));
ASSERT_THROWS_MSG(proton::error, "expected object", configure(opts, RAW_STRING({ "tls":""})));
ASSERT_THROWS_MSG(proton::error, "expected object", configure(opts, RAW_STRING({ "sasl":true})));
@@ -131,6 +130,22 @@ void test_invalid() {
ASSERT_THROWS_MSG(proton::error, "expected boolean", configure(opts, RAW_STRING({ "tls": { "verify":""}})));
}
+void test_invalid_json() {
+ connection_options opts;
+ // ancient versions of jsoncpp use a generic error message for parse errors
+ // in the exception, and print the detailed message to stderr
+ // https://github.com/open-source-parsers/jsoncpp/commit/6b10ce8c0d07ea07861e82f65f17d9fd6abd658d
+ if (std::make_tuple(JSONCPP_VERSION_MAJOR, JSONCPP_VERSION_MINOR) < std::make_tuple(1, 7)) {
+ ASSERT_THROWS_MSG(proton::error, "reader error", configure(opts, "{"));
+ ASSERT_THROWS_MSG(proton::error, "reader error", configure(opts, ""));
+ ASSERT_THROWS_MSG(proton::error, "reader error", configure(opts, RAW_STRING({ "user" : "x" "host" : "y"})));
+ } else {
+ ASSERT_THROWS_MSG(proton::error, "Missing '}'", configure(opts, "{"));
+ ASSERT_THROWS_MSG(proton::error, "Syntax error", configure(opts, ""));
+ ASSERT_THROWS_MSG(proton::error, "Missing ','", configure(opts, RAW_STRING({ "user":"x" "host":"y"})));
+ }
+}
+
// Extra classes to resolve clash of on_error in both messaging_handler and listen_handler
class messaging_handler : public proton::messaging_handler {
virtual void on_messaging_error(const error_condition&) = 0;
@@ -399,7 +414,8 @@ int main(int argc, char** argv) {
int failed = 0;
RUN_ARGV_TEST(failed, test_default_file());
RUN_ARGV_TEST(failed, test_addr());
- RUN_ARGV_TEST(failed, test_invalid());
+ RUN_ARGV_TEST(failed, test_invalid_config());
+ RUN_ARGV_TEST(failed, test_invalid_json());
RUN_ARGV_TEST(failed, test_default_connect().run());
RUN_ARGV_TEST(failed, test_almost_default_connect().run());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org