You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2017/08/11 23:42:17 UTC

hbase git commit: HBASE-18576. [C++] Add ping for RPC test

Repository: hbase
Updated Branches:
  refs/heads/HBASE-14850 e2a1cad3e -> aff0336ec


HBASE-18576. [C++] Add ping for RPC test

Signed-off-by: Enis Soztutar <en...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/aff0336e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/aff0336e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/aff0336e

Branch: refs/heads/HBASE-14850
Commit: aff0336ec339d6b8b61d6bfbdff4df68ed7668e9
Parents: e2a1cad
Author: Xiaobing Zhou <xz...@hortonworks.com>
Authored: Fri Aug 11 15:02:58 2017 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Fri Aug 11 16:38:26 2017 -0700

----------------------------------------------------------------------
 .../connection/rpc-test-server.cc               |  3 ++
 hbase-native-client/connection/rpc-test.cc      | 30 ++++++++++++++++++++
 2 files changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/aff0336e/hbase-native-client/connection/rpc-test-server.cc
----------------------------------------------------------------------
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 */

http://git-wip-us.apache.org/repos/asf/hbase/blob/aff0336e/hbase-native-client/connection/rpc-test.cc
----------------------------------------------------------------------
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) {