19 #include <gmock/gmock.h> 20 #include <gtest/gtest.h> 29 template <
typename T,
typename R>
58 return mockEncode(data).move();
70 return failConnect_ ? folly::makeFuture<DefaultPipeline*>(std::exception())
77 std::shared_ptr<folly::SocketAddress>
addr_;
78 bool failConnect_{
false};
96 return mockGetHandler(routingData).move();
111 return mockWrite(ctx, data).move();
115 return mockClose(ctx).move();
129 std::shared_ptr<folly::AsyncTransportWrapper>
socket)
override {
134 pipeline->finalize();
153 broadcastPipelineFactory)
157 std::shared_ptr<folly::AsyncTransportWrapper>,
160 std::shared_ptr<TransportInfo>)
override {
162 pipeline->addBack(std::make_shared<wangle::BytesToBytesHandler>());
164 auto handler = std::make_shared<ObservingHandler<int, std::string>>(
167 pipeline->finalize();
#define MOCK_METHOD4_T(m,...)
virtual void onError(folly::exception_wrapper ex)=0
MockObservingPipelineFactory(std::shared_ptr< ServerPool< std::string >> serverPool, std::shared_ptr< BroadcastPipelineFactory< int, std::string >> broadcastPipelineFactory)
ObservingPipeline< int >::Ptr newPipeline(std::shared_ptr< folly::AsyncTransportWrapper >, const std::string &routingData, RoutingDataHandler< std::string > *, std::shared_ptr< TransportInfo >) override
MOCK_METHOD0(onCompleted, void())
folly::Future< BroadcastHandler< int, std::string > * > getHandler()
DefaultPipeline::Ptr newPipeline(std::shared_ptr< folly::AsyncTransportWrapper > socket) override
void subscribe(uint32_t iters, int N)
folly::Future< folly::Unit > write(Context *ctx, int data) override
TokenBindingMessage decode(folly::io::Cursor &cursor)
MOCK_METHOD1_T(onNext, void(const T &))
MOCK_METHOD1(onError, void(const folly::exception_wrapper ex))
requires E e noexcept(noexcept(s.error(std::move(e))))
MessageToByteEncoder< T >::Context Context
virtual void onNext(const T &)=0
folly::Future< BroadcastHandler< int, std::string > * > getHandler(const std::string &routingData) override
std::shared_ptr< folly::SocketAddress > addr_
MOCK_METHOD0_T(routingData, R &())
void handler(int, siginfo_t *, void *)
MockObservingHandler(BroadcastPool< int, std::string > *broadcastPool)
virtual folly::Future< P * > connect(const folly::SocketAddress &address, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))=0
ByteToMessageDecoder< T >::Context Context
NetworkSocket socket(int af, int type, int protocol)
virtual void onCompleted()=0
virtual R & routingData()=0
std::unique_ptr< folly::IOBuf > encode(T &data) override
MockServerPool(std::shared_ptr< folly::SocketAddress > addr)
BroadcastHandler< int, std::string > * getBroadcastHandler(DefaultPipeline *pipeline) noexceptoverride
std::shared_ptr< Pipeline > Ptr
folly::Future< folly::Unit > close(Context *ctx) override
folly::Future< DefaultPipeline * > connect(BaseClientBootstrap< DefaultPipeline > *client, const std::string &) noexceptoverride
#define MOCK_METHOD2(m,...)
static constexpr uint64_t data[1]
ThreadPoolListHook * addr