From fe71aef64d7c9e1e35a614721acda513bb785c2a Mon Sep 17 00:00:00 2001 From: "Yevhenii Dementieiev (GitHub)" <57259850+ydementieiev@users.noreply.github.com> Date: Wed, 29 Jan 2020 19:39:37 +0200 Subject: Update jsoncpp library (#3155) * Delete old version of jsoncpp lib and add new like submodule, change deprecated interface for new. * Logs output without extra special symbols * fixup! Delete old version of jsoncpp lib and add new like submodule, change deprecated interface for new. --- .../test/policy_manager_impl_test_base.cc | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/components/policy/policy_external/test/policy_manager_impl_test_base.cc') diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc index b3c85df65b..8c28d11a9f 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc @@ -39,8 +39,8 @@ #include "utils/file_system.h" -#include "json/reader.h" #include "utils/gen_hash.h" +#include "utils/jsoncpp_reader_wrapper.h" #include "policy/mock_pt_ext_representation.h" @@ -175,8 +175,8 @@ Json::Value createPTforLoad() { "}"); Json::Value table(Json::objectValue); - Json::Reader reader; - EXPECT_TRUE(reader.parse(load_table, table)); + utils::JsonReader reader; + EXPECT_TRUE(reader.parse(load_table, &table)); return table; } @@ -282,10 +282,11 @@ void PolicyManagerImplTest2::SetUp() { const Json::Value PolicyManagerImplTest2::GetPTU(const std::string& file_name) { // Get PTU std::ifstream ifile(file_name); - Json::Reader reader; + Json::CharReaderBuilder reader_builder; std::string json; Json::Value root(Json::objectValue); - if (ifile.is_open() && reader.parse(ifile, root, true)) { + if (ifile.is_open() && + Json::parseFromStream(reader_builder, ifile, &root, nullptr)) { json = root.toStyledString(); } ifile.close(); @@ -471,11 +472,11 @@ void PolicyManagerImplTest2:: // Expect all parameters are allowed std::ifstream ifile(update_file); - Json::Reader reader; + Json::CharReaderBuilder reader_builder; std::string json; Json::Value root(Json::objectValue); if (ifile.is_open()) { - reader.parse(ifile, root, true); + Json::parseFromStream(reader_builder, ifile, &root, nullptr) } json = root.toStyledString(); ifile.close(); @@ -578,10 +579,11 @@ void PolicyManagerImplTest2::CheckRpcPermissions( void PolicyManagerImplTest2::EmulatePTAppRevoked(const std::string& ptu_name) { std::ifstream ifile(ptu_name); - Json::Reader reader; + Json::CharReaderBuilder reader_builder; std::string json; Json::Value root(Json::objectValue); - if (ifile.is_open() && reader.parse(ifile, root, true)) { + if (ifile.is_open() && + Json::parseFromStream(reader_builder, ifile, &root, nullptr)) { // Emulate application is revoked root["policy_table"]["app_policies"]["1234"]["is_revoked"] = 1; json = root.toStyledString(); @@ -620,11 +622,11 @@ void PolicyManagerImplTest2::LoadPTUFromJsonFile( const std::string& update_file) { // Load Json to cache std::ifstream ifile(update_file); - Json::Reader reader; + Json::CharReaderBuilder reader_builder; std::string json; Json::Value root(Json::objectValue); if (ifile.is_open()) { - reader.parse(ifile, root, true); + Json::parseFromStream(reader_builder, ifile, &root, nullptr) } json = root.toStyledString(); ifile.close(); @@ -684,10 +686,11 @@ const Json::Value PolicyManagerImplTest_RequestTypes::GetPTU( const std::string& file_name) { // Get PTU std::ifstream ifile(file_name); - Json::Reader reader; + Json::CharReaderBuilder reader_builder; std::string json; Json::Value root(Json::objectValue); - if (ifile.is_open() && reader.parse(ifile, root, true)) { + if (ifile.is_open() && + Json::parseFromStream(reader_builder, ifile, &root, nullptr)) { json = root.toStyledString(); } ifile.close(); @@ -905,10 +908,11 @@ std::string PolicyManagerImplTest_ExternalConsent::PreparePTUWithNewGroup( using namespace rpc; std::ifstream ifile(preloaded_pt_filename_); - Json::Reader reader; + Json::CharReaderBuilder reader_builder; std::string json; Json::Value root(Json::objectValue); - if (ifile.is_open() && reader.parse(ifile, root, true)) { + if (ifile.is_open() && + Json::parseFromStream(reader_builder, ifile, &root, nullptr)) { Table t = PreparePTWithGroupsHavingExternalConsent(); ExternalConsentEntity entity_4(type, id); -- cgit v1.2.1 From 09c27c1d793164468f59d7b34bf57997e1cfbffe Mon Sep 17 00:00:00 2001 From: "Yevhenii Dementieiev (GitHub)" <57259850+ydementieiev@users.noreply.github.com> Date: Thu, 30 Jan 2020 18:00:59 +0200 Subject: Fix build witj external proprietary after update new jsoncpp lib (#3224) --- .../policy/policy_external/test/policy_manager_impl_test_base.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/policy/policy_external/test/policy_manager_impl_test_base.cc') diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc index 8c28d11a9f..9f363a223a 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc @@ -476,7 +476,7 @@ void PolicyManagerImplTest2:: std::string json; Json::Value root(Json::objectValue); if (ifile.is_open()) { - Json::parseFromStream(reader_builder, ifile, &root, nullptr) + Json::parseFromStream(reader_builder, ifile, &root, nullptr); } json = root.toStyledString(); ifile.close(); @@ -626,7 +626,7 @@ void PolicyManagerImplTest2::LoadPTUFromJsonFile( std::string json; Json::Value root(Json::objectValue); if (ifile.is_open()) { - Json::parseFromStream(reader_builder, ifile, &root, nullptr) + Json::parseFromStream(reader_builder, ifile, &root, nullptr); } json = root.toStyledString(); ifile.close(); -- cgit v1.2.1