diff --git a/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSession.java b/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSession.java index 30e3ca71f..e41342437 100644 --- a/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSession.java +++ b/client/src/test/java/com/vesoft/nebula/client/graph/net/TestSession.java @@ -11,6 +11,7 @@ import com.vesoft.nebula.client.graph.data.HostAddress; import com.vesoft.nebula.client.graph.data.ResultSet; import com.vesoft.nebula.client.graph.exception.IOErrorException; +import com.vesoft.nebula.client.util.ProcessUtil; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; @@ -24,21 +25,6 @@ import org.junit.Test; public class TestSession { - private static void printProcessStatus(String cmd, Process p) { - try { - BufferedReader reader = new BufferedReader( - new InputStreamReader(p.getInputStream())); - - String line; - System.out.print(cmd + " output: "); - while ((line = reader.readLine()) != null) { - System.out.print(line); - } - System.out.print("\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } @Test public void testMultiThreadUseTheSameSession() { @@ -121,7 +107,7 @@ public void testReconnectWithMultiServices() { String cmd = "docker restart nebula-docker-compose_graphd2_1"; Process p = runtime.exec(cmd); p.waitFor(10, TimeUnit.SECONDS); - printProcessStatus(cmd, p); + ProcessUtil.printProcessStatus(cmd, p); NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig(); nebulaPoolConfig.setMaxConnSize(6); @@ -145,11 +131,11 @@ public void testReconnectWithMultiServices() { cmd = "docker stop nebula-docker-compose_graphd0_1"; p = runtime.exec(cmd); p.waitFor(5, TimeUnit.SECONDS); - printProcessStatus(cmd, p); + ProcessUtil.printProcessStatus(cmd, p); cmd = "docker stop nebula-docker-compose_graphd1_1"; p = runtime.exec(cmd); p.waitFor(5, TimeUnit.SECONDS); - printProcessStatus(cmd, p); + ProcessUtil.printProcessStatus(cmd, p); } try { // the session update later diff --git a/client/src/test/java/com/vesoft/nebula/client/util/ProcessUtil.java b/client/src/test/java/com/vesoft/nebula/client/util/ProcessUtil.java index 009f57a01..691079d06 100644 --- a/client/src/test/java/com/vesoft/nebula/client/util/ProcessUtil.java +++ b/client/src/test/java/com/vesoft/nebula/client/util/ProcessUtil.java @@ -3,6 +3,26 @@ * This source code is licensed under Apache 2.0 License, * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ - -package com.vesoft.nebula.client.util;public class ProcessUtil { + +package com.vesoft.nebula.client.util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +public class ProcessUtil { + public static void printProcessStatus(String cmd, Process p) { + try { + BufferedReader reader = new BufferedReader( + new InputStreamReader(p.getInputStream())); + + String line; + System.out.print(cmd + " output: "); + while ((line = reader.readLine()) != null) { + System.out.print(line); + } + System.out.print("\n"); + } catch (Exception e) { + e.printStackTrace(); + } + } }