Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
5924f92b
Z
zendata
项目概览
易企天创
/
zendata
9 个月 前同步成功
通知
17
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5924f92b
编写于
8月 06, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add service test scripts
上级
84a29ac3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
132 addition
and
0 deletion
+132
-0
demo/output/test2.sql
demo/output/test2.sql
+11
-0
test/ztf/log.txt
test/ztf/log.txt
+7
-0
test/ztf/script/lib/zd.php
test/ztf/script/lib/zd.php
+43
-0
test/ztf/script/service/svc_default_config.exp
test/ztf/script/service/svc_default_config.exp
+2
-0
test/ztf/script/service/svc_default_config.php
test/ztf/script/service/svc_default_config.php
+33
-0
test/ztf/script/service/svc_root.exp
test/ztf/script/service/svc_root.exp
+2
-0
test/ztf/script/service/svc_root.php
test/ztf/script/service/svc_root.php
+34
-0
未找到文件。
demo/output/test2.sql
0 → 100755
浏览文件 @
5924f92b
INSERT
INTO
tlb_table
(
`test0`
)
VALUES
(
'1|1'
),
(
'1|2|2'
),
(
'2|3'
),
(
'3|3|1'
),
(
'1|1'
),
(
'1|2|2'
),
(
'2|3'
),
(
'3|3|1'
),
(
'1|1'
),
(
'1|2|2'
);
test/ztf/log.txt
0 → 100644
浏览文件 @
5924f92b
Success yo start zendata http service, press CTRL+C to exist.
You may use http://10.8.0.134:8848 to retrieve the data,for example:
curl http://10.8.0.134:8848/?config=demo/default.yaml&F=field_common&lines=10.
Got GET request /?d=../../demo/default.yaml&c=../../demo/test.yaml&lines=10.
Create 10 records in 0 sec.
test/ztf/script/lib/zd.php
浏览文件 @
5924f92b
...
@@ -90,6 +90,49 @@ class zendata
...
@@ -90,6 +90,49 @@ class zendata
exec
(
$cmdStr
,
$output
);
exec
(
$cmdStr
,
$output
);
}
}
public
function
startService
(
$port
,
$root
)
{
$this
->
stopService
(
$port
);
$cmdStr
=
sprintf
(
"nohup %s -p %d >log.txt 2>&1 &"
,
$this
->
cmdPath
,
$port
);
if
(
$root
)
{
$cmdStr
=
str_replace
(
" -p "
,
" -R "
.
$root
.
" -p "
,
$cmdStr
);
}
print
(
"
$cmdStr
\n
"
);
pclose
(
popen
(
$cmdStr
,
'r'
));
exec
(
$cmdStr
,
$output
);
exec
(
"lsof -i :8848"
,
$output
);
$str
=
join
(
$output
,
"
\n
"
);
print
(
"
$str
\n
"
);
}
public
function
stopService
(
$port
)
{
$cmdStr
=
sprintf
(
"kill -9 `lsof -i :%d -t`"
,
$port
);
print
(
"
$cmdStr
\n
"
);
exec
(
$cmdStr
,
$output
);
}
public
function
httpGet
(
$port
,
$default
,
$conf
,
$lines
,
$options
=
array
())
{
$url
=
sprintf
(
"http://127.0.0.1:%d/?d=%s/%s&c=%s/%s&lines=%d"
,
$port
,
$this
->
workDir
,
$default
,
$this
->
workDir
,
$conf
,
$lines
);
if
(
array_key_exists
(
"root"
,
$options
))
{
$url
.
=
"&root="
.
$options
[
"root"
];
}
print
(
"
$url
\n
"
);
$resp
=
file_get_contents
(
$url
);
print
(
"
$resp
\n
"
);
return
$resp
;
}
public
function
cmd
(
$params
)
public
function
cmd
(
$params
)
{
{
$cmdStr
=
sprintf
(
"%s %s"
,
$this
->
cmdPath
,
$params
);
$cmdStr
=
sprintf
(
"%s %s"
,
$this
->
cmdPath
,
$params
);
...
...
test/ztf/script/service/svc_default_config.exp
0 → 100644
浏览文件 @
5924f92b
>> 10
>> int_3
\ No newline at end of file
test/ztf/script/service/svc_default_config.php
0 → 100755
浏览文件 @
5924f92b
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$port
=
8848
;
$zd
->
startService
(
$port
);
$resp
=
$zd
->
httpGet
(
$port
,
"default.yaml"
,
"test.yaml"
,
10
);
$jsonArr
=
json_decode
(
$resp
,
TRUE
);
$count
=
sprintf
(
"%d"
,
count
(
$jsonArr
));
print
(
">>
$count
\n
"
);
$field
=
$jsonArr
[
2
][
"field_common"
];
print
(
">>
$field
\n
"
);
$zd
->
stopService
(
8848
);
\ No newline at end of file
test/ztf/script/service/svc_root.exp
0 → 100644
浏览文件 @
5924f92b
>> 10
>> int_3
\ No newline at end of file
test/ztf/script/service/svc_root.php
0 → 100755
浏览文件 @
5924f92b
#!/usr/bin/env php
<?php
/**
[case]
title=
cid=0
pid=0
[group]
>>
>>
[esac]
*/
include_once
__DIR__
.
DIRECTORY_SEPARATOR
.
'../lib/zd.php'
;
$zd
=
new
zendata
();
$port
=
8848
;
$root
=
dirname
(
dirname
(
dirname
(
__FILE__
)));
$zd
->
startService
(
$port
,
$root
);
$resp
=
$zd
->
httpGet
(
$port
,
"default.yaml"
,
"test.yaml"
,
10
);
$jsonArr
=
json_decode
(
$resp
,
TRUE
);
$count
=
sprintf
(
"%d"
,
count
(
$jsonArr
));
print
(
">>
$count
\n
"
);
$field
=
$jsonArr
[
2
][
"field_common"
];
print
(
">>
$field
\n
"
);
$zd
->
stopService
(
8848
);
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录