mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -24,7 +24,7 @@
|
||||
#include "MockETLService.h"
|
||||
#include "MockLoadBalancer.h"
|
||||
#include "MockSubscriptionManager.h"
|
||||
#include <log/Logger.h>
|
||||
#include <util/log/Logger.h>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <thread>
|
||||
|
||||
/**
|
||||
* @brief Fixture with LogService support.
|
||||
* @brief Fixture with util::Logger support.
|
||||
*/
|
||||
class LoggerFixture : virtual public ::testing::Test
|
||||
{
|
||||
@@ -58,14 +58,14 @@ class LoggerFixture : virtual public ::testing::Test
|
||||
std::ostream stream_ = std::ostream{&buffer_};
|
||||
|
||||
protected:
|
||||
// Simulates the `LogService::init(config)` call
|
||||
// Simulates the `util::Logger::init(config)` call
|
||||
void
|
||||
SetUp() override
|
||||
{
|
||||
static std::once_flag once_;
|
||||
std::call_once(once_, [] {
|
||||
boost::log::add_common_attributes();
|
||||
boost::log::register_simple_formatter_factory<clio::Severity, char>("Severity");
|
||||
boost::log::register_simple_formatter_factory<util::Severity, char>("Severity");
|
||||
});
|
||||
|
||||
namespace src = boost::log::sources;
|
||||
@@ -76,9 +76,9 @@ protected:
|
||||
|
||||
core->remove_all_sinks();
|
||||
boost::log::add_console_log(stream_, keywords::format = "%Channel%:%Severity% %Message%");
|
||||
auto min_severity = expr::channel_severity_filter(clio::log_channel, clio::log_severity);
|
||||
min_severity["General"] = clio::Severity::DBG;
|
||||
min_severity["Trace"] = clio::Severity::TRC;
|
||||
auto min_severity = expr::channel_severity_filter(util::log_channel, util::log_severity);
|
||||
min_severity["General"] = util::Severity::DBG;
|
||||
min_severity["Trace"] = util::Severity::TRC;
|
||||
core->set_filter(min_severity);
|
||||
core->set_logging_enabled(true);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Fixture with LogService support but completely disabled logging.
|
||||
* @brief Fixture with util::Logger support but completely disabled logging.
|
||||
*
|
||||
* This is meant to be used as a base for other fixtures.
|
||||
*/
|
||||
@@ -194,7 +194,7 @@ struct MockBackendTest : virtual public NoLoggerFixture
|
||||
SetUp() override
|
||||
{
|
||||
NoLoggerFixture::SetUp();
|
||||
clio::Config cfg;
|
||||
util::Config cfg;
|
||||
mockBackendPtr = std::make_shared<MockBackend>(cfg);
|
||||
}
|
||||
void
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <backend/BackendInterface.h>
|
||||
#include <data/BackendInterface.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
using namespace Backend;
|
||||
using namespace data;
|
||||
|
||||
struct MockBackend : public BackendInterface
|
||||
{
|
||||
MockBackend(clio::Config)
|
||||
MockBackend(util::Config)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,19 +19,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <backend/Types.h>
|
||||
#include <data/Types.h>
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
struct MockCache
|
||||
{
|
||||
MOCK_METHOD(void, update, (std::vector<Backend::LedgerObject> const& a, uint32_t b, bool c), ());
|
||||
MOCK_METHOD(void, update, (std::vector<data::LedgerObject> const& a, uint32_t b, bool c), ());
|
||||
|
||||
MOCK_METHOD(std::optional<Backend::Blob>, get, (ripple::uint256 const& a, uint32_t b), (const));
|
||||
MOCK_METHOD(std::optional<data::Blob>, get, (ripple::uint256 const& a, uint32_t b), (const));
|
||||
|
||||
MOCK_METHOD(std::optional<Backend::LedgerObject>, getSuccessor, (ripple::uint256 const& a, uint32_t b), (const));
|
||||
MOCK_METHOD(std::optional<data::LedgerObject>, getSuccessor, (ripple::uint256 const& a, uint32_t b), (const));
|
||||
|
||||
MOCK_METHOD(std::optional<Backend::LedgerObject>, getPredecessor, (ripple::uint256 const& a, uint32_t b), (const));
|
||||
MOCK_METHOD(std::optional<data::LedgerObject>, getPredecessor, (ripple::uint256 const& a, uint32_t b), (const));
|
||||
|
||||
MOCK_METHOD(void, setDisabled, (), ());
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ struct MockAsyncRPCEngine
|
||||
MOCK_METHOD(void, notifyTooBusy, (), ());
|
||||
MOCK_METHOD(void, notifyUnknownCommand, (), ());
|
||||
MOCK_METHOD(void, notifyInternalError, (), ());
|
||||
MOCK_METHOD(RPC::Result, buildResponse, (Web::Context const&), ());
|
||||
MOCK_METHOD(RPC::Result, buildResponse, (web::Context const&), ());
|
||||
};
|
||||
|
||||
struct MockRPCEngine
|
||||
@@ -69,5 +69,5 @@ struct MockRPCEngine
|
||||
MOCK_METHOD(void, notifyTooBusy, (), ());
|
||||
MOCK_METHOD(void, notifyUnknownCommand, (), ());
|
||||
MOCK_METHOD(void, notifyInternalError, (), ());
|
||||
MOCK_METHOD(RPC::Result, buildResponse, (Web::Context const&), ());
|
||||
MOCK_METHOD(RPC::Result, buildResponse, (web::Context const&), ());
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
struct MockSubscriptionManager
|
||||
{
|
||||
public:
|
||||
using session_ptr = std::shared_ptr<Server::ConnectionBase>;
|
||||
using session_ptr = std::shared_ptr<web::ConnectionBase>;
|
||||
MockSubscriptionManager()
|
||||
{
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
MOCK_METHOD(
|
||||
void,
|
||||
pubBookChanges,
|
||||
(ripple::LedgerInfo const&, std::vector<Backend::TransactionAndMetadata> const&),
|
||||
(ripple::LedgerInfo const&, std::vector<data::TransactionAndMetadata> const&),
|
||||
());
|
||||
|
||||
MOCK_METHOD(void, unsubLedger, (session_ptr), ());
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
MOCK_METHOD(void, unsubTransactions, (session_ptr), ());
|
||||
|
||||
MOCK_METHOD(void, pubTransaction, (Backend::TransactionAndMetadata const&, ripple::LedgerInfo const&), ());
|
||||
MOCK_METHOD(void, pubTransaction, (data::TransactionAndMetadata const&, ripple::LedgerInfo const&), ());
|
||||
|
||||
MOCK_METHOD(void, subAccount, (ripple::AccountID const&, session_ptr&), ());
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <webserver/interface/ConnectionBase.h>
|
||||
|
||||
struct MockSession : public Server::ConnectionBase
|
||||
struct MockSession : public web::ConnectionBase
|
||||
{
|
||||
std::string message;
|
||||
void
|
||||
@@ -36,12 +36,12 @@ struct MockSession : public Server::ConnectionBase
|
||||
message += msg;
|
||||
}
|
||||
|
||||
MockSession(util::TagDecoratorFactory const& factory) : Server::ConnectionBase(factory, "")
|
||||
MockSession(util::TagDecoratorFactory const& factory) : web::ConnectionBase(factory, "")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct MockDeadSession : public Server::ConnectionBase
|
||||
struct MockDeadSession : public web::ConnectionBase
|
||||
{
|
||||
void
|
||||
send(std::shared_ptr<std::string> _) override
|
||||
@@ -55,7 +55,7 @@ struct MockDeadSession : public Server::ConnectionBase
|
||||
{
|
||||
}
|
||||
|
||||
MockDeadSession(util::TagDecoratorFactory const& factory) : Server::ConnectionBase(factory, "")
|
||||
MockDeadSession(util::TagDecoratorFactory const& factory) : web::ConnectionBase(factory, "")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//==============================================================================
|
||||
|
||||
#include "TestObject.h"
|
||||
#include <backend/DBHelpers.h>
|
||||
#include <data/DBHelpers.h>
|
||||
#include <rpc/RPCHelpers.h>
|
||||
|
||||
#include <ripple/protocol/STArray.h>
|
||||
@@ -446,10 +446,10 @@ CreateDepositPreauthLedgerObject(std::string_view account, std::string_view auth
|
||||
return depositPreauth;
|
||||
}
|
||||
|
||||
Backend::NFT
|
||||
data::NFT
|
||||
CreateNFT(std::string_view tokenID, std::string_view account, ripple::LedgerIndex seq, ripple::Blob uri, bool isBurned)
|
||||
{
|
||||
return Backend::NFT{ripple::uint256(tokenID), seq, GetAccountIDWithString(account), uri, isBurned};
|
||||
return data::NFT{ripple::uint256(tokenID), seq, GetAccountIDWithString(account), uri, isBurned};
|
||||
}
|
||||
|
||||
ripple::STObject
|
||||
@@ -533,7 +533,7 @@ CreateNFTTokenPage(
|
||||
return tokenPage;
|
||||
}
|
||||
|
||||
Backend::TransactionAndMetadata
|
||||
data::TransactionAndMetadata
|
||||
CreateMintNFTTxWithMetadata(
|
||||
std::string_view accountId,
|
||||
uint32_t seq,
|
||||
@@ -589,13 +589,13 @@ CreateMintNFTTxWithMetadata(
|
||||
metaObj.setFieldU8(ripple::sfTransactionResult, ripple::tesSUCCESS);
|
||||
metaObj.setFieldU32(ripple::sfTransactionIndex, 0);
|
||||
|
||||
Backend::TransactionAndMetadata ret;
|
||||
data::TransactionAndMetadata ret;
|
||||
ret.transaction = tx.getSerializer().peekData();
|
||||
ret.metadata = metaObj.getSerializer().peekData();
|
||||
return ret;
|
||||
}
|
||||
|
||||
Backend::TransactionAndMetadata
|
||||
data::TransactionAndMetadata
|
||||
CreateAcceptNFTOfferTxWithMetadata(std::string_view accountId, uint32_t seq, uint32_t fee, std::string_view nftId)
|
||||
{
|
||||
// tx
|
||||
@@ -627,14 +627,14 @@ CreateAcceptNFTOfferTxWithMetadata(std::string_view accountId, uint32_t seq, uin
|
||||
metaObj.setFieldU8(ripple::sfTransactionResult, ripple::tesSUCCESS);
|
||||
metaObj.setFieldU32(ripple::sfTransactionIndex, 0);
|
||||
|
||||
Backend::TransactionAndMetadata ret;
|
||||
data::TransactionAndMetadata ret;
|
||||
ret.transaction = tx.getSerializer().peekData();
|
||||
ret.metadata = metaObj.getSerializer().peekData();
|
||||
return ret;
|
||||
}
|
||||
|
||||
// NFTokenCancelOffer can be used to cancel multiple offers
|
||||
Backend::TransactionAndMetadata
|
||||
data::TransactionAndMetadata
|
||||
CreateCancelNFTOffersTxWithMetadata(
|
||||
std::string_view accountId,
|
||||
uint32_t seq,
|
||||
@@ -680,13 +680,13 @@ CreateCancelNFTOffersTxWithMetadata(
|
||||
metaObj.setFieldU8(ripple::sfTransactionResult, ripple::tesSUCCESS);
|
||||
metaObj.setFieldU32(ripple::sfTransactionIndex, 0);
|
||||
|
||||
Backend::TransactionAndMetadata ret;
|
||||
data::TransactionAndMetadata ret;
|
||||
ret.transaction = tx.getSerializer().peekData();
|
||||
ret.metadata = metaObj.getSerializer().peekData();
|
||||
return ret;
|
||||
}
|
||||
|
||||
Backend::TransactionAndMetadata
|
||||
data::TransactionAndMetadata
|
||||
CreateCreateNFTOfferTxWithMetadata(
|
||||
std::string_view accountId,
|
||||
uint32_t seq,
|
||||
@@ -724,7 +724,7 @@ CreateCreateNFTOfferTxWithMetadata(
|
||||
metaObj.setFieldU8(ripple::sfTransactionResult, ripple::tesSUCCESS);
|
||||
metaObj.setFieldU32(ripple::sfTransactionIndex, 0);
|
||||
|
||||
Backend::TransactionAndMetadata ret;
|
||||
data::TransactionAndMetadata ret;
|
||||
ret.transaction = tx.getSerializer().peekData();
|
||||
ret.metadata = metaObj.getSerializer().peekData();
|
||||
return ret;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <backend/Types.h>
|
||||
#include <data/Types.h>
|
||||
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/Protocol.h>
|
||||
@@ -207,7 +207,7 @@ CreateCheckLedgerObject(std::string_view account, std::string_view dest);
|
||||
[[nodiscard]] ripple::STObject
|
||||
CreateDepositPreauthLedgerObject(std::string_view account, std::string_view auth);
|
||||
|
||||
[[nodiscard]] Backend::NFT
|
||||
[[nodiscard]] data::NFT
|
||||
CreateNFT(
|
||||
std::string_view tokenID,
|
||||
std::string_view account,
|
||||
@@ -229,7 +229,7 @@ CreateNFTTokenPage(
|
||||
std::vector<std::pair<std::string, std::string>> const& tokens,
|
||||
std::optional<ripple::uint256> previousPage);
|
||||
|
||||
[[nodiscard]] Backend::TransactionAndMetadata
|
||||
[[nodiscard]] data::TransactionAndMetadata
|
||||
CreateMintNFTTxWithMetadata(
|
||||
std::string_view accountId,
|
||||
uint32_t seq,
|
||||
@@ -237,20 +237,20 @@ CreateMintNFTTxWithMetadata(
|
||||
uint32_t nfTokenTaxon,
|
||||
std::string_view nftID);
|
||||
|
||||
[[nodiscard]] Backend::TransactionAndMetadata
|
||||
[[nodiscard]] data::TransactionAndMetadata
|
||||
CreateAcceptNFTOfferTxWithMetadata(std::string_view accountId, uint32_t seq, uint32_t fee, std::string_view offerId);
|
||||
|
||||
[[nodiscard]] Backend::TransactionAndMetadata
|
||||
[[nodiscard]] data::TransactionAndMetadata
|
||||
CreateCancelNFTOffersTxWithMetadata(
|
||||
std::string_view accountId,
|
||||
uint32_t seq,
|
||||
uint32_t fee,
|
||||
std::vector<std::string> const& nftIds);
|
||||
|
||||
[[nodiscard]] Backend::TransactionAndMetadata
|
||||
[[nodiscard]] data::TransactionAndMetadata
|
||||
CreateCreateNFTOfferTxWithMetadata(std::string_view accountId, uint32_t seq, uint32_t fee, std::string_view offerId);
|
||||
|
||||
[[nodiscard]] Backend::TransactionAndMetadata
|
||||
[[nodiscard]] data::TransactionAndMetadata
|
||||
CreateCreateNFTOfferTxWithMetadata(
|
||||
std::string_view accountId,
|
||||
uint32_t seq,
|
||||
|
||||
Reference in New Issue
Block a user