This is an automated email from the ASF dual-hosted git repository. zghao pushed a commit to branch HBASE-14850 in repository https://gitbox.apache.org/repos/asf/hbase.git
commit 31fda1bf4bacf9ba99b789c775b87cbec3894f49 Author: Xiaobing Zhou <[email protected]> AuthorDate: Fri Aug 11 15:02:58 2017 -0700 HBASE-18576. [C++] Add ping for RPC test Signed-off-by: Enis Soztutar <[email protected]> --- hbase-native-client/connection/rpc-test-server.cc | 3 +++ hbase-native-client/connection/rpc-test.cc | 30 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/hbase-native-client/connection/rpc-test-server.cc b/hbase-native-client/connection/rpc-test-server.cc index f350d6a..6132fbb 100644 --- a/hbase-native-client/connection/rpc-test-server.cc +++ b/hbase-native-client/connection/rpc-test-server.cc @@ -68,6 +68,9 @@ Future<std::unique_ptr<Response>> RpcTestService::operator()(std::unique_ptr<Req if (method_name == "ping") { auto pb_resp_msg = std::make_shared<EmptyResponseProto>(); response->set_resp_msg(pb_resp_msg); + VLOG(1) << "RPC server:" + << " ping called."; + } else if (method_name == "echo") { auto pb_resp_msg = std::make_shared<EchoResponseProto>(); /* get msg from client */ diff --git a/hbase-native-client/connection/rpc-test.cc b/hbase-native-client/connection/rpc-test.cc index e7f678d..4688950 100644 --- a/hbase-native-client/connection/rpc-test.cc +++ b/hbase-native-client/connection/rpc-test.cc @@ -88,6 +88,36 @@ std::shared_ptr<RpcClient> CreateRpcClient(std::shared_ptr<Configuration> conf, } /** +* test ping +*/ +TEST_F(RpcTest, Ping) { + auto conf = CreateConf(); + auto server = CreateRpcServer(); + auto server_addr = GetRpcServerAddress(server); + auto client = CreateRpcClient(conf); + + auto method = "ping"; + auto request = std::make_unique<Request>(std::make_shared<EmptyRequestProto>(), + std::make_shared<EmptyResponseProto>(), method); + + /* sending out request */ + client + ->AsyncCall(server_addr->getAddressStr(), server_addr->getPort(), std::move(request), + hbase::security::User::defaultUser()) + .then([&](std::unique_ptr<Response> response) { + auto pb_resp = std::static_pointer_cast<EmptyResponseProto>(response->resp_msg()); + EXPECT_TRUE(pb_resp != nullptr); + VLOG(1) << folly::sformat(FLAGS_result_format, method, ""); + }) + .onError([&](const folly::exception_wrapper& ew) { + FAIL() << folly::sformat(FLAGS_fail_format, method); + }); + + server->stop(); + server->join(); +} + +/** * test echo */ TEST_F(RpcTest, Echo) {
