Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions olp-cpp-sdk-authentication/src/AuthenticationClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ olp::client::HttpResponse AuthenticationClientImpl::CallAuth(

SignInResult AuthenticationClientImpl::ParseAuthResponse(
int status, std::stringstream& auth_response) {
boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(auth_response, ec);
return std::make_shared<SignInResultImpl>(
status, olp::http::HttpErrorToString(status),
Expand All @@ -228,7 +228,7 @@ SignInResult AuthenticationClientImpl::ParseAuthResponse(

SignInUserResult AuthenticationClientImpl::ParseUserAuthResponse(
int status, std::stringstream& auth_response) {
boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(auth_response, ec);
return std::make_shared<SignInUserResultImpl>(
status, olp::http::HttpErrorToString(status),
Expand Down Expand Up @@ -462,7 +462,7 @@ client::CancellationToken AuthenticationClientImpl::SignInMtls(

TimeResponse AuthenticationClientImpl::ParseTimeResponse(
std::stringstream& payload) {
boost::json::error_code ec;
boost::system::error_code ec;
auto json_value = boost::json::parse(payload, ec);

if (ec.failed() || !json_value.is_object()) {
Expand Down Expand Up @@ -688,7 +688,7 @@ client::CancellationToken AuthenticationClientImpl::SignUpHereUser(
return client::ApiError(status, response_text);
}

boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(response_text, ec);
return {std::make_shared<SignUpResultImpl>(
status, olp::http::HttpErrorToString(status),
Expand Down Expand Up @@ -737,7 +737,7 @@ client::CancellationToken AuthenticationClientImpl::SignOut(
return client::ApiError(status, response_text);
}

boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(response_text, ec);
return {std::make_shared<SignOutResultImpl>(
status, olp::http::HttpErrorToString(status),
Expand Down Expand Up @@ -774,7 +774,7 @@ client::CancellationToken AuthenticationClientImpl::IntrospectApp(
auto http_result = client.CallApi(kIntrospectAppEndpoint, "GET", {}, {}, {},
nullptr, {}, context);

boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(http_result.GetRawResponse(), ec);
if (http_result.GetStatus() != http::HttpStatusCode::OK) {
// HttpResult response can be error message or valid json with it.
Expand Down Expand Up @@ -820,7 +820,7 @@ client::CancellationToken AuthenticationClientImpl::Authorize(
GenerateAuthorizeBody(request),
kApplicationJson, context);

boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(http_result.GetRawResponse(), ec);
if (http_result.GetStatus() != http::HttpStatusCode::OK) {
// HttpResult response can be error message or valid json with it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ std::string Base64Encode(const Crypto::Sha256Digest& digest) {
}

Response<boost::json::object> Parse(client::HttpResponse& http_response) {
boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(http_response.GetRawResponse(), ec);
if (http_response.GetStatus() != http::HttpStatusCode::OK) {
// HttpResult response can be error message or valid json with it.
Expand Down
4 changes: 2 additions & 2 deletions olp-cpp-sdk-authentication/src/TokenEndpointImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void RetryDelay(const client::RetrySettings& retry_settings, size_t retry) {
}

TimeResponse ParseTimeResponse(const std::string& payload) {
boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(payload, ec);

if (!document.is_object()) {
Expand Down Expand Up @@ -330,7 +330,7 @@ SignInResponse TokenEndpointImpl::SignInClient(

SignInResult TokenEndpointImpl::ParseAuthResponse(
int status, std::stringstream& auth_response) {
boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(auth_response, ec);
return std::make_shared<SignInResultImpl>(
status, http::HttpErrorToString(status),
Expand Down
1 change: 1 addition & 0 deletions olp-cpp-sdk-core/include/olp/core/porting/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ optional<std::decay_t<T>> make_optional(T&& v) {
} // namespace olp

#else
#include <boost/move/utility.hpp>
#include <boost/optional.hpp>

namespace olp {
Expand Down
7 changes: 4 additions & 3 deletions olp-cpp-sdk-core/src/generated/parser/JsonParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <vector>

#include <boost/json/parse.hpp>
#include <boost/system/error_code.hpp>

#include "ParserWrapper.h"

Expand All @@ -33,7 +34,7 @@ namespace parser {

template <typename T>
inline T parse(const std::string& json) {
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand All @@ -45,7 +46,7 @@ inline T parse(const std::string& json) {
template <typename T>
inline T parse(std::stringstream& json_stream, bool& res) {
res = false;
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json_stream, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand All @@ -65,7 +66,7 @@ template <typename T>
inline T parse(const std::shared_ptr<std::vector<unsigned char>>& json_bytes) {
boost::json::string_view json(reinterpret_cast<char*>(json_bytes->data()),
json_bytes->size());
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand Down
6 changes: 3 additions & 3 deletions olp-cpp-sdk-core/tests/cache/DefaultCacheImplTest.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 HERE Europe B.V.
* Copyright (C) 2020-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -817,9 +817,9 @@ TEST_F(DefaultCacheImplTest, LruCacheEviction) {

const auto not_expired_key = prefix + std::to_string(0);

// Put data that expires after 10 sec and never promoted.
// Put data that expires after 60 sec and never promoted.
cache.Put(not_expired_key,
std::make_shared<std::vector<unsigned char>>(binary_data), 10);
std::make_shared<std::vector<unsigned char>>(binary_data), 60);

// overflow the mutable cache
auto count = 1u;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <vector>

#include <boost/json/parse.hpp>
#include <boost/system/error_code.hpp>

#include "ParserWrapper.h"

Expand All @@ -33,7 +34,7 @@ namespace parser {

template <typename T>
inline T parse(const std::string& json) {
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand All @@ -45,7 +46,7 @@ inline T parse(const std::string& json) {
template <typename T>
inline T parse(std::stringstream& json_stream, bool& res) {
res = false;
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json_stream, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand All @@ -65,7 +66,7 @@ template <typename T>
inline T parse(const std::shared_ptr<std::vector<unsigned char>>& json_bytes) {
boost::json::string_view json(reinterpret_cast<char*>(json_bytes->data()),
json_bytes->size());
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ constexpr unsigned long long int HashStringToInt(
PartitionsSaxHandler::PartitionsSaxHandler(PartitionCallback partition_callback)
: partition_callback_(std::move(partition_callback)) {}

bool PartitionsSaxHandler::on_object_begin(boost::json::error_code& ec) {
bool PartitionsSaxHandler::on_object_begin(boost::system::error_code& ec) {
if (state_ == State::kWaitForRootObject) {
state_ = State::kWaitForRootPartitions;
return CanContinue(ec);
Expand Down Expand Up @@ -131,7 +131,7 @@ bool PartitionsSaxHandler::on_object_end(std::size_t, error_code& ec) {
return CanContinue(ec);
}

bool PartitionsSaxHandler::on_array_begin(boost::json::error_code& ec) {
bool PartitionsSaxHandler::on_array_begin(boost::system::error_code& ec) {
// We expect only a single array in whol response
if (state_ != State::kWaitPartitionsArray) {
return NotSupported(ec);
Expand All @@ -143,7 +143,7 @@ bool PartitionsSaxHandler::on_array_begin(boost::json::error_code& ec) {
}

bool PartitionsSaxHandler::on_array_end(std::size_t,
boost::json::error_code& ec) {
boost::system::error_code& ec) {
if (state_ != State::kWaitForNextPartition) {
return NotSupported(ec);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <boost/json/error.hpp>
#include <boost/json/string_view.hpp>
#include <boost/json/system_error.hpp>
#include <boost/system/error_code.hpp>

#include <olp/dataservice/read/model/Partitions.h>

Expand All @@ -37,7 +37,7 @@ class PartitionsSaxHandler {
public:
using PartitionCallback = std::function<void(model::Partition)>;
using string_view = boost::json::string_view;
using error_code = boost::json::error_code;
using error_code = boost::system::error_code;

explicit PartitionsSaxHandler(PartitionCallback partition_callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ QuadTreeIndex::QuadTreeIndex(const cache::KeyValueCache::ValueTypePtr& data) {

QuadTreeIndex::QuadTreeIndex(const geo::TileKey& root, int depth,
std::stringstream& json_stream) {
boost::json::error_code ec;
boost::system::error_code ec;
auto parsed_value = boost::json::parse(json_stream, ec);

if (!parsed_value.is_object()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST(PartitionsSaxHandlerTest, NormalFlow) {

repository::PartitionsSaxHandler handler(callback);

boost::json::error_code error_code;
boost::system::error_code error_code;
ASSERT_TRUE(handler.on_object_begin(error_code));
ASSERT_TRUE(handler.on_key(kPartitions, len(kPartitions), error_code));
ASSERT_TRUE(handler.on_array_begin(error_code));
Expand Down Expand Up @@ -118,7 +118,7 @@ TEST(PartitionsSaxHandlerTest, WrongJSONStructure) {
auto callback = [&](model::Partition) {};

repository::PartitionsSaxHandler handler(callback);
boost::json::error_code error_code;
boost::system::error_code error_code;

// Initial state expects an object
ASSERT_FALSE(handler.on_key(kPartitions, len(kPartitions), error_code));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <vector>

#include <boost/json/parse.hpp>
#include <boost/system/error_code.hpp>

#include "ParserWrapper.h"

Expand All @@ -33,7 +34,7 @@ namespace parser {

template <typename T>
inline T parse(const std::string& json) {
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand All @@ -45,7 +46,7 @@ inline T parse(const std::string& json) {
template <typename T>
inline T parse(std::stringstream& json_stream, bool& res) {
res = false;
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json_stream, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand All @@ -65,7 +66,7 @@ template <typename T>
inline T parse(const std::shared_ptr<std::vector<unsigned char>>& json_bytes) {
boost::json::string_view json(reinterpret_cast<char*>(json_bytes->data()),
json_bytes->size());
boost::json::error_code ec;
boost::system::error_code ec;
auto value = boost::json::parse(json, ec);
T result{};
if (value.is_object() || value.is_array()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ bool AuthenticationTestUtils::CreateFacebookTestUser(
&user](const olp::http::NetworkResponse &network_response) {
user.token.status = network_response.GetStatus();
if (user.token.status == olp::http::HttpStatusCode::OK) {
boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(*payload, ec);
const bool is_valid = !ec.failed() && document.is_object() &&
document.as_object().contains(kAccessToken) &&
Expand Down Expand Up @@ -243,7 +243,7 @@ bool AuthenticationTestUtils::GetAccessTokenImpl(
&token](const olp::http::NetworkResponse &network_response) {
token.status = network_response.GetStatus();
if (token.status == olp::http::HttpStatusCode::OK) {
boost::json::error_code ec;
boost::system::error_code ec;
auto document = boost::json::parse(*payload, ec);
const bool is_valid = !ec.failed() && document.is_object() &&
document.as_object().contains(kAccessToken);
Expand Down
3 changes: 2 additions & 1 deletion tests/utils/mock-server-client/JsonHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <boost/json/parse.hpp>
#include <boost/json/value.hpp>
#include <boost/system/error_code.hpp>

namespace mockserver {

Expand Down Expand Up @@ -123,7 +124,7 @@ inline T parse(const boost::json::value& value, const std::string& name) {

template <typename T>
inline T parse(std::stringstream& json_stream) {
boost::json::error_code ec;
boost::system::error_code ec;
auto doc = boost::json::parse(json_stream, ec);
T result{};
if (doc.is_object() || doc.is_array()) {
Expand Down
Loading