Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9f233e8c
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9f233e8c
编写于
7月 07, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
start taosd before jdbc tests
上级
e1502677
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
69 addition
and
44 deletion
+69
-44
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
...or/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
+45
-17
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNodes.java
...r/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNodes.java
+4
-3
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDSimClient.java
...bc/src/main/java/com/taosdata/jdbc/utils/TDSimClient.java
+13
-13
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BaseTest.java
...nector/jdbc/src/test/java/com/taosdata/jdbc/BaseTest.java
+7
-11
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
浏览文件 @
9f233e8c
package
com.taosdata.jdbc.utils
;
import
java.io.File
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
public
class
TDNode
{
...
...
@@ -36,24 +37,51 @@ public class TDNode {
this
.
testCluster
=
testCluster
;
}
public
void
start
()
{
String
selfPath
=
System
.
getProperty
(
"user.dir"
);
String
binPath
=
""
;
String
projDir
=
selfPath
+
"../../../"
;
File
dir
=
new
File
(
projDir
);
public
void
searchTaosd
(
File
dir
,
ArrayList
<
String
>
taosdPath
)
{
File
[]
fileList
=
dir
.
listFiles
();
if
(
fileList
==
null
||
fileList
.
length
==
0
)
{
System
.
out
.
println
(
"The project path doens't exist"
);
return
;
if
(
fileList
!=
null
&&
fileList
.
length
!=
0
)
{
for
(
File
file
:
fileList
)
{
if
(
file
.
isFile
())
{
if
(
file
.
getName
().
equals
(
"taosd"
))
{
taosdPath
.
add
(
file
.
getAbsolutePath
());
}
}
else
{
searchTaosd
(
file
,
taosdPath
);
}
}
}
return
;
}
for
(
File
file
:
fileList
)
{
if
(
file
.
getName
().
equals
(
"taosd"
)
&&
!
file
.
getAbsolutePath
().
contains
(
"packing"
))
{
binPath
=
file
.
getAbsolutePath
();
break
;
public
void
start
()
{
String
selfPath
=
System
.
getProperty
(
"user.dir"
);
String
binPath
=
""
;
String
projDir
=
selfPath
+
"../../../../"
;
try
{
ArrayList
<
String
>
taosdPath
=
new
ArrayList
<>();
File
dir
=
new
File
(
projDir
);
String
realProjDir
=
dir
.
getCanonicalPath
();
dir
=
new
File
(
realProjDir
);
System
.
out
.
println
(
"project Dir: "
+
projDir
);
searchTaosd
(
dir
,
taosdPath
);
if
(
taosdPath
.
size
()
==
0
)
{
System
.
out
.
println
(
"The project path doens't exist"
);
return
;
}
else
{
for
(
String
p
:
taosdPath
)
{
if
(!
p
.
contains
(
"packing"
))
{
binPath
=
p
;
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
binPath
.
equals
(
""
))
{
...
...
@@ -70,16 +98,16 @@ public class TDNode {
String
cmd
=
""
;
if
(
this
.
valgrind
==
0
)
{
cmd
=
"nohup "
+
binPath
+
" -c "
+
this
.
cfgDir
+
" > /dev/null 2>&1 & "
;
cmd
=
"nohup "
+
binPath
+
" > /dev/null 2>&1 & "
;
System
.
out
.
println
(
"start taosd cmd: "
+
cmd
);
}
else
{
String
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
;
cmd
=
"nohup "
+
valgrindCmdline
+
" "
+
binPath
+
" -c "
+
this
.
cfgDir
+
" 2>&1 & "
;
}
try
{
if
(
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
()
!=
0
)
{
return
;
}
Runtime
.
getRuntime
().
exec
(
cmd
);
TimeUnit
.
SECONDS
.
sleep
(
5
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNodes.java
浏览文件 @
9f233e8c
...
...
@@ -42,7 +42,7 @@ public class TDNodes {
binPath
=
file
.
getCanonicalPath
();
System
.
out
.
println
(
"binPath real path: "
+
binPath
);
if
(
path
.
isEmpty
())
{
if
(
!
path
.
isEmpty
())
{
file
=
new
File
(
path
+
"/../../"
);
path
=
file
.
getCanonicalPath
();
}
...
...
@@ -79,7 +79,7 @@ public class TDNodes {
TDSimClient
sim
=
new
TDSimClient
();
sim
.
setPath
(
path
);
System
.
out
.
println
(
"====== "
+
path
+
"====="
);
System
.
out
.
println
(
"======
path:
"
+
path
+
"====="
);
sim
.
setTestCluster
(
this
.
testCluster
);
if
(
this
.
simDeployed
==
false
)
{
sim
.
deploy
();
...
...
@@ -88,7 +88,8 @@ public class TDNodes {
check
(
index
);
tdNodes
.
get
(
index
-
1
).
setTestCluster
(
this
.
testCluster
);
tdNodes
.
get
(
index
-
1
).
setValgrind
(
valgrind
);
tdNodes
.
get
(
index
-
1
).
setValgrind
(
valgrind
);
tdNodes
.
get
(
index
-
1
).
setPath
(
System
.
getProperty
(
"user.dir"
));
tdNodes
.
get
(
index
-
1
).
deploy
();
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDSimClient.java
浏览文件 @
9f233e8c
package
com.taosdata.jdbc.utils
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
public
class
TDSimClient
{
...
...
@@ -25,16 +23,11 @@ public class TDSimClient {
public
void
setCfgConfig
(
String
option
,
String
value
)
{
String
cmd
=
"echo "
+
option
+
" "
+
value
+
" >> "
+
this
.
cfgPath
;
System
.
out
.
println
(
"set cfg cmd "
+
cmd
);
try
{
Process
ps
=
Runtime
.
getRuntime
().
exec
(
cmd
);
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
ps
.
getInputStream
()));
while
(
br
.
readLine
()
!=
null
)
{
System
.
out
.
println
(
br
.
readLine
());
}
ps
.
waitFor
();
Process
ps
=
Runtime
.
getRuntime
().
exec
(
cmd
);
System
.
out
.
println
(
"cfg command result: "
+
ps
.
waitFor
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -50,19 +43,26 @@ public class TDSimClient {
try
{
String
cmd
=
"rm -rf "
+
this
.
logDir
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
();
System
.
out
.
println
(
"cmd: = "
+
cmd
);
Process
ps
=
Runtime
.
getRuntime
().
exec
(
cmd
);
System
.
out
.
println
(
"return value "
+
ps
.
waitFor
());
System
.
out
.
println
(
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
cmd
=
"rm -rf "
+
this
.
cfgDir
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
();
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
cmd
=
"mkdir -p "
+
this
.
logDir
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
();
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
cmd
=
"mkdir -p "
+
this
.
cfgDir
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
(
);
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
()
);
cmd
=
"touch "
+
this
.
cfgPath
;
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
();
System
.
out
.
println
(
cmd
+
" result: "
+
Runtime
.
getRuntime
().
exec
(
cmd
).
waitFor
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/BaseTest.java
浏览文件 @
9f233e8c
...
...
@@ -6,6 +6,7 @@ import java.io.InputStreamReader;
import
com.taosdata.jdbc.utils.TDNodes
;
import
org.junit.AfterClass
;
import
org.junit.BeforeClass
;
public
class
BaseTest
{
...
...
@@ -17,17 +18,6 @@ public class BaseTest {
@BeforeClass
public
static
void
setupEnv
()
{
try
{
// String path = System.getProperty("user.dir");
// String bashPath = path + "/buildTDengine.sh";
// Process ps = Runtime.getRuntime().exec(bashPath);
// ps.waitFor();
// BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
// while(br.readLine() != null) {
// System.out.println(br.readLine());
// }
File
file
=
new
File
(
deployPath
+
"/../../../"
);
String
rootPath
=
file
.
getCanonicalPath
();
...
...
@@ -38,8 +28,14 @@ public class BaseTest {
tdNodes
.
deploy
(
1
);
tdNodes
.
start
(
1
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@AfterClass
public
static
void
clearUpEnv
()
{
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录