mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -211,7 +211,7 @@ createObject()
|
||||
.dataRaw = hexStringToBinaryString(kOBJ_BLOB),
|
||||
.successor = hexStringToBinaryString(kOBJ_SUCC),
|
||||
.predecessor = hexStringToBinaryString(kOBJ_PRED),
|
||||
.type = {},
|
||||
.type = etlng::model::Object::ModType::Created,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "etlng/AmendmentBlockHandlerInterface.hpp"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
struct MockAmendmentBlockHandler {
|
||||
MOCK_METHOD(void, onAmendmentBlock, (), ());
|
||||
struct MockAmendmentBlockHandler : etlng::AmendmentBlockHandlerInterface {
|
||||
MOCK_METHOD(void, notifyAmendmentBlocked, (), (override));
|
||||
};
|
||||
|
||||
@@ -20,11 +20,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/LoggerFixtures.hpp"
|
||||
#include "util/MockAmendmentBlockHandler.hpp"
|
||||
#include "util/MockETLService.hpp"
|
||||
#include "util/MockLedgerFetcher.hpp"
|
||||
#include "util/MockLoadBalancer.hpp"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
/**
|
||||
* @brief Fixture with a mock etl service
|
||||
*/
|
||||
@@ -63,3 +67,28 @@ struct MockLoadBalancerTest : virtual public NoLoggerFixture {
|
||||
protected:
|
||||
std::shared_ptr<MockLoadBalancer> mockLoadBalancerPtr_ = std::make_shared<MockLoadBalancer>();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Fixture with a mock NG etl balancer
|
||||
*/
|
||||
struct MockNgLoadBalancerTest : virtual public NoLoggerFixture {
|
||||
protected:
|
||||
std::shared_ptr<MockNgLoadBalancer> mockLoadBalancerPtr_ = std::make_shared<MockNgLoadBalancer>();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Fixture with a mock ledger fetcher
|
||||
*/
|
||||
struct MockLedgerFetcherTest : virtual public NoLoggerFixture {
|
||||
protected:
|
||||
std::shared_ptr<MockNgLedgerFetcher> mockLedgerFetcherPtr_ = std::make_shared<MockNgLedgerFetcher>();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Fixture with a mock ledger fetcher
|
||||
*/
|
||||
struct MockAmendmentBlockHandlerTest : virtual public NoLoggerFixture {
|
||||
protected:
|
||||
std::shared_ptr<MockAmendmentBlockHandler> mockAmendmentBlockHandlerPtr_ =
|
||||
std::make_shared<MockAmendmentBlockHandler>();
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "etl/LedgerFetcherInterface.hpp"
|
||||
#include "util/FakeFetchResponse.hpp"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
@@ -30,3 +31,8 @@ struct MockLedgerFetcher {
|
||||
MOCK_METHOD(std::optional<FakeFetchResponse>, fetchData, (uint32_t), ());
|
||||
MOCK_METHOD(std::optional<FakeFetchResponse>, fetchDataAndDiff, (uint32_t), ());
|
||||
};
|
||||
|
||||
struct MockNgLedgerFetcher : etl::LedgerFetcherInterface {
|
||||
MOCK_METHOD(OptionalGetLedgerResponseType, fetchData, (uint32_t), (override));
|
||||
MOCK_METHOD(OptionalGetLedgerResponseType, fetchDataAndDiff, (uint32_t), (override));
|
||||
};
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "etl/ETLState.hpp"
|
||||
#include "etlng/InitialLoadObserverInterface.hpp"
|
||||
#include "etlng/LoadBalancerInterface.hpp"
|
||||
#include "rpc/Errors.hpp"
|
||||
#include "util/FakeFetchResponse.hpp"
|
||||
|
||||
@@ -28,10 +31,12 @@
|
||||
#include <boost/json/value.hpp>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct MockLoadBalancer {
|
||||
using RawLedgerObjectType = FakeLedgerObject;
|
||||
@@ -48,3 +53,36 @@ struct MockLoadBalancer {
|
||||
(const)
|
||||
);
|
||||
};
|
||||
|
||||
struct MockNgLoadBalancer : etlng::LoadBalancerInterface {
|
||||
using RawLedgerObjectType = FakeLedgerObject;
|
||||
|
||||
MOCK_METHOD(
|
||||
std::vector<std::string>,
|
||||
loadInitialLedger,
|
||||
(uint32_t, etlng::InitialLoadObserverInterface&, std::chrono::steady_clock::duration),
|
||||
(override)
|
||||
);
|
||||
MOCK_METHOD(
|
||||
std::vector<std::string>,
|
||||
loadInitialLedger,
|
||||
(uint32_t, std::chrono::steady_clock::duration),
|
||||
(override)
|
||||
);
|
||||
MOCK_METHOD(
|
||||
OptionalGetLedgerResponseType,
|
||||
fetchLedger,
|
||||
(uint32_t, bool, bool, std::chrono::steady_clock::duration),
|
||||
(override)
|
||||
);
|
||||
MOCK_METHOD(boost::json::value, toJson, (), (const, override));
|
||||
MOCK_METHOD(std::optional<etl::ETLState>, getETLState, (), (noexcept, override));
|
||||
|
||||
using ForwardToRippledReturnType = std::expected<boost::json::object, rpc::ClioError>;
|
||||
MOCK_METHOD(
|
||||
ForwardToRippledReturnType,
|
||||
forwardToRippled,
|
||||
(boost::json::object const&, std::optional<std::string> const&, bool, boost::asio::yield_context),
|
||||
(override)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user