You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ne...@apache.org on 2021/05/13 06:05:20 UTC

[iotdb] branch song_thrift_0.14.1 updated: fix the ClusterInfoServerTest

This is an automated email from the ASF dual-hosted git repository.

neuyilan pushed a commit to branch song_thrift_0.14.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/song_thrift_0.14.1 by this push:
     new 5055974  fix the ClusterInfoServerTest
5055974 is described below

commit 505597472da984fa4bce7b6440e22d8796b25032
Author: HouliangQi <ne...@163.com>
AuthorDate: Thu May 13 14:04:23 2021 +0800

    fix the ClusterInfoServerTest
---
 .../server/clusterinfo/ClusterInfoServerTest.java  | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/server/clusterinfo/ClusterInfoServerTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/server/clusterinfo/ClusterInfoServerTest.java
index aa58b26..0098976 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/server/clusterinfo/ClusterInfoServerTest.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/server/clusterinfo/ClusterInfoServerTest.java
@@ -34,6 +34,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class ClusterInfoServerTest {
+
   ClusterInfoServiceImplTest test;
   ClusterInfoServer service;
 
@@ -53,20 +54,19 @@ public class ClusterInfoServerTest {
 
   @Test
   public void testConnect() {
+    TTransport transport =
+        null;
     try {
-      TTransport transport =
-          RpcTransportFactory.INSTANCE.getTransport(
-              new TSocket(
-                  IoTDBDescriptor.getInstance().getConfig().getRpcAddress(),
-                  ClusterDescriptor.getInstance().getConfig().getClusterInfoRpcPort()));
-      transport.open();
+      transport = RpcTransportFactory.INSTANCE.getTransport(
+          new TSocket(
+              IoTDBDescriptor.getInstance().getConfig().getRpcAddress(),
+              ClusterDescriptor.getInstance().getConfig().getClusterInfoRpcPort()));
+    } catch (TTransportException e) {
+      Assert.fail(e.getMessage());
+    }
 
-      // connection success means OK.
-      ClusterInfoService.Client client =
-          new ClusterInfoService.Client(new TBinaryProtocol(transport));
-      Assert.assertNotNull(client);
-      // client's methods have been tested on ClusterInfoServiceImplTest
-      transport.close();
+    try {
+      transport.open();
     } catch (TTransportException e) {
       Assert.fail(e.getMessage());
     }
@@ -77,7 +77,7 @@ public class ClusterInfoServerTest {
     // client's methods have been tested on ClusterInfoServiceImplTest
     transport.close();
     try {
-      TTransport transport =
+      transport =
           RpcTransportFactory.INSTANCE.getTransport(
               new TSocket(
                   IoTDBDescriptor.getInstance().getConfig().getRpcAddress(),
@@ -85,7 +85,7 @@ public class ClusterInfoServerTest {
       transport.open();
 
       // connection success means OK.
-      ClusterInfoService.Client client =
+      client =
           new ClusterInfoService.Client(new TBinaryProtocol(transport));
       Assert.assertNotNull(client);
       // client's methods have been tested on ClusterInfoServiceImplTest