提交 c6f6cd12 编写于 作者: Z zyyang

change

上级 97945d8c
...@@ -37,18 +37,6 @@ public class TSDBDriverTest { ...@@ -37,18 +37,6 @@ public class TSDBDriverTest {
islibLoaded = false; islibLoaded = false;
return; return;
} }
// String libPath = null;
// switch (osName) {
// case "linux":
// libPath = "/usr/lib/libtaos.so";
// break;
// case "windows":
// libPath = "C:\\TDengine\\driver\\taos.dll";
// break;
// default:
// }
// if (libPath == null)
// return;
try { try {
System.loadLibrary("taos"); System.loadLibrary("taos");
islibLoaded = true; islibLoaded = true;
...@@ -58,16 +46,21 @@ public class TSDBDriverTest { ...@@ -58,16 +46,21 @@ public class TSDBDriverTest {
} }
try { try {
Process exec = Runtime.getRuntime().exec("ps -ef | grep taosd | grep -v \"grep\""); if (osName.equals("linux")) {
BufferedReader reader = new BufferedReader(new InputStreamReader(exec.getInputStream())); String[] cmd = {"/bin/bash", "-c", "ps -ef | grep taosd | grep -v \"grep\""};
int lineCnt = 0; Process exec = Runtime.getRuntime().exec(cmd);
while (reader.readLine() != null) { BufferedReader reader = new BufferedReader(new InputStreamReader(exec.getInputStream()));
lineCnt++; int lineCnt = 0;
} while (reader.readLine() != null) {
if (lineCnt > 0) lineCnt++;
isTaosdActived = true; }
else if (lineCnt > 0)
isTaosdActived = true;
else
isTaosdActived = false;
} else {
isTaosdActived = false; isTaosdActived = false;
}
} catch (IOException e) { } catch (IOException e) {
isTaosdActived = false; isTaosdActived = false;
} }
...@@ -146,6 +139,7 @@ public class TSDBDriverTest { ...@@ -146,6 +139,7 @@ public class TSDBDriverTest {
assertEquals("failure - should throw SQLException", "TDengine Error: Unable to establish connection", e.getMessage()); assertEquals("failure - should throw SQLException", "TDengine Error: Unable to establish connection", e.getMessage());
else else
fail("failure - should not throw Exception"); fail("failure - should not throw Exception");
e.printStackTrace();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册