mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-27 23:25:53 +00:00
@@ -70,14 +70,14 @@ class HandlerFake
|
||||
public:
|
||||
using Input = TestInput;
|
||||
using Output = TestOutput;
|
||||
using Result = RPCng::HandlerReturnType<Output>;
|
||||
using Result = RPC::HandlerReturnType<Output>;
|
||||
|
||||
RPCng::RpcSpecConstRef
|
||||
RPC::RpcSpecConstRef
|
||||
spec() const
|
||||
{
|
||||
using namespace RPCng::validation;
|
||||
using namespace RPC::validation;
|
||||
|
||||
static const auto rpcSpec = RPCng::RpcSpec{
|
||||
static const auto rpcSpec = RPC::RpcSpec{
|
||||
{"hello", Required{}, Type<std::string>{}, EqualTo{"world"}},
|
||||
{"limit", Type<uint32_t>{}, Between<uint32_t>{0, 100}}, // optional field
|
||||
};
|
||||
@@ -98,14 +98,14 @@ class CoroutineHandlerFake
|
||||
public:
|
||||
using Input = TestInput;
|
||||
using Output = TestOutput;
|
||||
using Result = RPCng::HandlerReturnType<Output>;
|
||||
using Result = RPC::HandlerReturnType<Output>;
|
||||
|
||||
RPCng::RpcSpecConstRef
|
||||
RPC::RpcSpecConstRef
|
||||
spec() const
|
||||
{
|
||||
using namespace RPCng::validation;
|
||||
using namespace RPC::validation;
|
||||
|
||||
static const auto rpcSpec = RPCng::RpcSpec{
|
||||
static const auto rpcSpec = RPC::RpcSpec{
|
||||
{"hello", Required{}, Type<std::string>{}, EqualTo{"world"}},
|
||||
{"limit", Type<uint32_t>{}, Between<uint32_t>{0, 100}}, // optional field
|
||||
};
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
}
|
||||
|
||||
Result
|
||||
process(Input input, RPCng::Context const& ctx) const
|
||||
process(Input input, RPC::Context const& ctx) const
|
||||
{
|
||||
return Output{input.hello + '_' + std::to_string(input.limit.value_or(0))};
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class NoInputHandlerFake
|
||||
{
|
||||
public:
|
||||
using Output = TestOutput;
|
||||
using Result = RPCng::HandlerReturnType<Output>;
|
||||
using Result = RPC::HandlerReturnType<Output>;
|
||||
|
||||
Result
|
||||
process() const
|
||||
@@ -139,14 +139,14 @@ class FailingHandlerFake
|
||||
public:
|
||||
using Input = TestInput;
|
||||
using Output = TestOutput;
|
||||
using Result = RPCng::HandlerReturnType<Output>;
|
||||
using Result = RPC::HandlerReturnType<Output>;
|
||||
|
||||
RPCng::RpcSpecConstRef
|
||||
RPC::RpcSpecConstRef
|
||||
spec() const
|
||||
{
|
||||
using namespace RPCng::validation;
|
||||
using namespace RPC::validation;
|
||||
|
||||
static const auto rpcSpec = RPCng::RpcSpec{
|
||||
static const auto rpcSpec = RPC::RpcSpec{
|
||||
{"hello", Required{}, Type<std::string>{}, EqualTo{"world"}},
|
||||
{"limit", Type<uint32_t>{}, Between<uint32_t>{0u, 100u}}, // optional field
|
||||
};
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
process([[maybe_unused]] Input input) const
|
||||
{
|
||||
// always fail
|
||||
return RPCng::Error{RPC::Status{"Very custom error"}};
|
||||
return RPC::Error{RPC::Status{"Very custom error"}};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -189,16 +189,16 @@ struct HandlerMock
|
||||
{
|
||||
using Input = InOutFake;
|
||||
using Output = InOutFake;
|
||||
using Result = RPCng::HandlerReturnType<Output>;
|
||||
using Result = RPC::HandlerReturnType<Output>;
|
||||
|
||||
MOCK_METHOD(RPCng::RpcSpecConstRef, spec, (), (const));
|
||||
MOCK_METHOD(RPC::RpcSpecConstRef, spec, (), (const));
|
||||
MOCK_METHOD(Result, process, (Input), (const));
|
||||
};
|
||||
|
||||
struct HandlerWithoutInputMock
|
||||
{
|
||||
using Output = InOutFake;
|
||||
using Result = RPCng::HandlerReturnType<Output>;
|
||||
using Result = RPC::HandlerReturnType<Output>;
|
||||
|
||||
MOCK_METHOD(Result, process, (), (const));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user