guangxuCheng commented on a change in pull request #808: HBASE-20395 Displaying 
thrift server type on the thrift page
URL: https://github.com/apache/hbase/pull/808#discussion_r344454930
 
 

 ##########
 File path: 
hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java
 ##########
 @@ -871,4 +878,32 @@ private void closeScanner(
     handler.scannerGet(scannerId);
     handler.scannerClose(scannerId);
   }
+
+  @Test
+  public void testGetThriftServerType() throws Exception {
+    ThriftHBaseServiceHandler handler =
+        new ThriftHBaseServiceHandler(UTIL.getConfiguration(),
+            UserProvider.instantiate(UTIL.getConfiguration()));
+    assertEquals(TThriftServerType.ONE, handler.getThriftServerType());
+  }
+
+  @Test
+  public void testGetThriftServerOneType() throws Exception {
+    // start a thrift2 server
+    HBaseThrift2TestingUtility THRIFT2_TEST_UTIL =
+        new HBaseThrift2TestingUtility();
+
+    LOG.info("Starting HBase Thrift Server Two");
+    THRIFT2_TEST_UTIL.startThriftServer(UTIL.getConfiguration());
+    try (TTransport transport = new 
TSocket(InetAddress.getLocalHost().getHostName(),
+        THRIFT2_TEST_UTIL.getServerPort())){
+      TProtocol protocol = new TBinaryProtocol(transport);
+      // This is our thrift client.
+      Hbase.Client client = new Hbase.Client(protocol);
+      // open the transport
+      transport.open();
+      assertEquals(TThriftServerType.TWO.name(), 
client.getThriftServerType().name());
+    }
+    THRIFT2_TEST_UTIL.stopThriftServer();
 
 Review comment:
   make sense.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to