lokinet/test/dht/mock_context.hpp

116 lines
4.2 KiB
C++
Raw Normal View History

2019-01-26 12:33:34 +00:00
#ifndef TEST_LLARP_DHT_MOCK_CONTEXT
#define TEST_LLARP_DHT_MOCK_CONTEXT
2019-01-22 23:50:26 +00:00
#include <dht/context.hpp>
#include <gmock/gmock.h>
namespace llarp
{
namespace test
{
struct MockContext final : public dht::AbstractContext
{
MOCK_CONST_METHOD1(StoreRC, void(const RouterContact));
2019-01-22 23:50:26 +00:00
MOCK_METHOD2(LookupRouter, bool(const RouterID&, RouterLookupHandler));
MOCK_METHOD5(LookupRouterRecursive,
void(const RouterID&, const dht::Key_t&, uint64_t,
const dht::Key_t&, RouterLookupHandler));
MOCK_METHOD6(LookupIntroSetRelayed,
2020-01-27 21:30:41 +00:00
void(const dht::Key_t&, const dht::Key_t&, uint64_t,
const dht::Key_t&, uint64_t,
2020-01-27 21:30:41 +00:00
service::EncryptedIntroSetLookupHandler));
2019-01-22 23:50:26 +00:00
MOCK_METHOD5(LookupIntroSetDirect,
2020-01-27 21:30:41 +00:00
void(const dht::Key_t&, const dht::Key_t&, uint64_t,
const dht::Key_t&,
service::EncryptedIntroSetLookupHandler));
2019-01-22 23:50:26 +00:00
MOCK_CONST_METHOD1(HasRouterLookup, bool(const RouterID& target));
MOCK_METHOD4(LookupRouterForPath,
void(const RouterID& target, uint64_t txid,
const PathID_t& path, const dht::Key_t& askpeer));
MOCK_METHOD5(LookupIntroSetForPath,
2020-01-27 21:30:41 +00:00
void(const dht::Key_t&, uint64_t, const PathID_t&,
const dht::Key_t&, uint64_t));
2019-01-22 23:50:26 +00:00
MOCK_METHOD3(DHTSendTo, void(const RouterID&, dht::IMessage*, bool));
MOCK_METHOD4(
HandleExploritoryRouterLookup,
bool(const dht::Key_t& requester, uint64_t txid,
const RouterID& target,
std::vector< std::unique_ptr< dht::IMessage > >& reply));
MOCK_METHOD5(
LookupRouterRelayed,
void(const dht::Key_t& requester, uint64_t txid,
const dht::Key_t& target, bool recursive,
std::vector< std::unique_ptr< dht::IMessage > >& replies));
MOCK_METHOD2(RelayRequestForPath,
bool(const PathID_t& localPath, const dht::IMessage& msg));
2019-03-27 12:36:27 +00:00
MOCK_CONST_METHOD2(GetRCFromNodeDB,
bool(const dht::Key_t& k, RouterContact& rc));
MOCK_METHOD5(PropagateIntroSetTo,
void(const dht::Key_t& source, uint64_t sourceTX,
2020-01-27 21:30:41 +00:00
const service::EncryptedIntroSet& introset,
const dht::Key_t& peer, uint64_t relayOrder));
MOCK_METHOD5(PropagateLocalIntroSet,
void(const PathID_t& source, uint64_t sourceTX,
const service::EncryptedIntroSet& introset,
const dht::Key_t& peer, uint64_t relayOrder));
MOCK_METHOD2(Init,
void(const dht::Key_t&, AbstractRouter*));
2020-01-27 21:30:41 +00:00
MOCK_CONST_METHOD1(GetIntroSetByLocation,
std::optional< llarp::service::EncryptedIntroSet >(
2020-01-27 21:30:41 +00:00
const llarp::dht::Key_t&));
MOCK_CONST_METHOD0(ExtractStatus, util::StatusObject());
2019-01-22 23:50:26 +00:00
MOCK_CONST_METHOD0(Now, llarp_time_t());
MOCK_METHOD1(ExploreNetworkVia, void(const dht::Key_t& peer));
2019-01-22 23:50:26 +00:00
MOCK_CONST_METHOD0(GetRouter, llarp::AbstractRouter*());
2019-01-22 23:50:26 +00:00
MOCK_CONST_METHOD0(OurKey, const dht::Key_t&());
MOCK_CONST_METHOD0(pendingIntrosetLookups,
const PendingIntrosetLookups&());
MOCK_METHOD0(pendingIntrosetLookups, PendingIntrosetLookups&());
MOCK_METHOD0(pendingRouterLookups, PendingRouterLookups&());
MOCK_CONST_METHOD0(pendingRouterLookups, const PendingRouterLookups&());
MOCK_METHOD0(pendingExploreLookups, PendingExploreLookups&());
MOCK_CONST_METHOD0(pendingExploreLookups, const PendingExploreLookups&());
MOCK_METHOD0(services, dht::Bucket< dht::ISNode >*());
MOCK_CONST_METHOD0(AllowTransit, const bool&());
MOCK_METHOD0(AllowTransit, bool&());
2019-01-22 23:50:26 +00:00
MOCK_CONST_METHOD0(Nodes, dht::Bucket< dht::RCNode >*());
MOCK_METHOD1(PutRCNodeAsync, void(const dht::RCNode& val));
MOCK_METHOD1(DelRCNodeAsync, void(const dht::Key_t& val));
2020-01-21 17:31:48 +00:00
MOCK_METHOD2(FloodRCLater, void(const dht::Key_t, const RouterContact));
2019-01-22 23:50:26 +00:00
};
} // namespace test
} // namespace llarp
#endif