21 #include <glog/logging.h> 25 using namespace folly;
37 return this->data == other.
data;
40 return this->data < other.
data;
47 std::shared_ptr<AsyncTransportWrapper> )
override {
54 std::atomic<int> pipelines_{0};
60 std::shared_ptr<folly::IOBuf>, TestRoutingData> {
68 std::shared_ptr<folly::AsyncTransportWrapper>
socket,
71 std::shared_ptr<TransportInfo> )
override {
72 routingData_ = routingData;
81 std::shared_ptr<AsyncTransportWrapper> sock)
override {
84 <<
"this function is typically called from " 85 <<
"makePipeline that has been overridden in this " 86 <<
"test to call a different version of newPipeline.";
91 std::atomic<int> routingPipelines_{0};
98 const std::shared_ptr<CustomPipelineFactory>& factory)
99 : routingData_(routingData),
104 std::shared_ptr<folly::AsyncTransportWrapper>
socket)
override {
105 setPipeline(factory_->newPipeline(
106 socket, routingData_,
nullptr,
nullptr));
113 TEST(ObservingClientPipelineTest, CustomPipelineMaker) {
115 auto factory = std::make_shared<TestPipelineFactory>();
116 server.childPipeline(factory);
124 routingData.
data =
"Test";
125 auto clientPipelineFactory = std::make_shared<CustomPipelineFactory>();
127 std::make_unique<CustomPipelineMakerTestClient>(
128 routingData, clientPipelineFactory);
130 client->connect(address, std::chrono::milliseconds(0));
135 EXPECT_EQ(1, clientPipelineFactory->routingPipelines_);
136 EXPECT_EQ(routingData, clientPipelineFactory->routingData_);
137 EXPECT_EQ(0, clientPipelineFactory->pipelines_);
EventBase * getEventBase() const
TEST(Wangle, ClientServerTest)
#define EXPECT_EQ(val1, val2)
HandlerAdapter< folly::IOBufQueue &, std::unique_ptr< folly::IOBuf > > BytesToBytesHandler
—— Concurrent Priority Queue Implementation ——
CustomPipelineMakerTestClient(const TestRoutingData &routingData, const std::shared_ptr< CustomPipelineFactory > &factory)
bool operator==(const TestRoutingData &other) const
BytesPipeline::Ptr newPipeline(std::shared_ptr< AsyncTransportWrapper > sock) override
static EventBaseManager * get()
TestObsPipeline::Ptr newPipeline(std::shared_ptr< folly::AsyncTransportWrapper > socket, const TestRoutingData &routingData, RoutingDataHandler< TestRoutingData > *, std::shared_ptr< TransportInfo >) override
NetworkSocket socket(int af, int type, int protocol)
void makePipeline(std::shared_ptr< folly::AsyncTransportWrapper > socket) override
TestRoutingData routingData_
BytesPipeline::Ptr newPipeline(std::shared_ptr< AsyncTransportWrapper >) override
const folly::SocketAddress & getAddress() const
std::shared_ptr< Pipeline > Ptr
std::shared_ptr< CustomPipelineFactory > factory_
TestRoutingData routingData_
bool operator<(const TestRoutingData &other) const