Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
1ad6aefc
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1ad6aefc
编写于
11月 30, 2020
作者:
F
fit2-zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(性能测试): 还原误修改类
上级
9a6f2518
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
48 addition
and
50 deletion
+48
-50
backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java
...erformance/parse/xml/reader/jmx/JmeterDocumentParser.java
+48
-50
未找到文件。
backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java
浏览文件 @
1ad6aefc
...
...
@@ -491,9 +491,9 @@ public class JmeterDocumentParser implements DocumentParser {
setupElement
.
setAttribute
(
"testclass"
,
"SetupThreadGroup"
);
setupElement
.
setAttribute
(
"testname"
,
"setUp Thread Group"
);
setupElement
.
setAttribute
(
"enabled"
,
"true"
);
setupElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.on_sample_error"
,
"stoptestnow"
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.on_sample_error"
,
"stoptestnow"
));
Element
elementProp
=
document
.
createElement
(
"elementProp"
);
elementProp
.
setAttribute
(
"name"
,
"
Ms
ThreadGroup.main_controller"
);
elementProp
.
setAttribute
(
"name"
,
"ThreadGroup.main_controller"
);
elementProp
.
setAttribute
(
"elementType"
,
"LoopController"
);
elementProp
.
setAttribute
(
"guiclass"
,
"LoopControlPanel"
);
elementProp
.
setAttribute
(
"testclass"
,
"LoopController"
);
...
...
@@ -502,12 +502,12 @@ public class JmeterDocumentParser implements DocumentParser {
elementProp
.
appendChild
(
createBoolProp
(
document
,
"LoopController.continue_forever"
,
false
));
elementProp
.
appendChild
(
createIntProp
(
document
,
"LoopController.loops"
,
1
));
setupElement
.
appendChild
(
elementProp
);
setupElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.num_threads"
,
"1"
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.ramp_time"
,
"1"
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.duration"
,
""
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.delay"
,
""
));
setupElement
.
appendChild
(
createBoolProp
(
document
,
"
Ms
ThreadGroup.scheduler"
,
false
));
setupElement
.
appendChild
(
createBoolProp
(
document
,
"
Ms
ThreadGroup.same_user_on_next_iteration"
,
true
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.num_threads"
,
"1"
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.ramp_time"
,
"1"
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.duration"
,
""
));
setupElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.delay"
,
""
));
setupElement
.
appendChild
(
createBoolProp
(
document
,
"ThreadGroup.scheduler"
,
false
));
setupElement
.
appendChild
(
createBoolProp
(
document
,
"ThreadGroup.same_user_on_next_iteration"
,
true
));
hashTree
.
appendChild
(
setupElement
);
Element
setupHashTree
=
document
.
createElement
(
HASH_TREE_ELEMENT
);
...
...
@@ -568,17 +568,17 @@ public class JmeterDocumentParser implements DocumentParser {
}
/*
<PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group" enabled="true">
<stringProp name="
Ms
ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="
Ms
ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="
Ms
ThreadGroup.num_threads">1</stringProp>
<stringProp name="
Ms
ThreadGroup.ramp_time">1</stringProp>
<boolProp name="
Ms
ThreadGroup.scheduler">false</boolProp>
<stringProp name="
Ms
ThreadGroup.duration"></stringProp>
<stringProp name="
Ms
ThreadGroup.delay"></stringProp>
<boolProp name="
Ms
ThreadGroup.same_user_on_next_iteration">true</boolProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</PostThreadGroup>
*/
Element
tearDownElement
=
document
.
createElement
(
"PostThreadGroup"
);
...
...
@@ -586,15 +586,15 @@ public class JmeterDocumentParser implements DocumentParser {
tearDownElement
.
setAttribute
(
"testclass"
,
"PostThreadGroup"
);
tearDownElement
.
setAttribute
(
"testname"
,
"tearDown Thread Group"
);
tearDownElement
.
setAttribute
(
"enabled"
,
"true"
);
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.on_sample_error"
,
"continue"
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.num_threads"
,
"1"
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.ramp_time"
,
"1"
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.duration"
,
""
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.delay"
,
""
));
tearDownElement
.
appendChild
(
createBoolProp
(
document
,
"
Ms
ThreadGroup.scheduler"
,
false
));
tearDownElement
.
appendChild
(
createBoolProp
(
document
,
"
Ms
ThreadGroup.same_user_on_next_iteration"
,
true
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.on_sample_error"
,
"continue"
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.num_threads"
,
"1"
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.ramp_time"
,
"1"
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.duration"
,
""
));
tearDownElement
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.delay"
,
""
));
tearDownElement
.
appendChild
(
createBoolProp
(
document
,
"ThreadGroup.scheduler"
,
false
));
tearDownElement
.
appendChild
(
createBoolProp
(
document
,
"ThreadGroup.same_user_on_next_iteration"
,
true
));
Element
elementProp
=
document
.
createElement
(
"elementProp"
);
elementProp
.
setAttribute
(
"name"
,
"
Ms
ThreadGroup.main_controller"
);
elementProp
.
setAttribute
(
"name"
,
"ThreadGroup.main_controller"
);
elementProp
.
setAttribute
(
"elementType"
,
"LoopController"
);
elementProp
.
setAttribute
(
"guiclass"
,
"LoopControlPanel"
);
elementProp
.
setAttribute
(
"testclass"
,
"LoopController"
);
...
...
@@ -760,8 +760,8 @@ public class JmeterDocumentParser implements DocumentParser {
threadGroup
.
setAttribute
(
"guiclass"
,
CONCURRENCY_THREAD_GROUP
+
"Gui"
);
threadGroup
.
setAttribute
(
"testclass"
,
CONCURRENCY_THREAD_GROUP
);
/*
<elementProp name="
Ms
ThreadGroup.main_controller" elementType="com.blazemeter.jmeter.control.VirtualUserController"/>
<stringProp name="
Ms
ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="com.blazemeter.jmeter.control.VirtualUserController"/>
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<stringProp name="TargetLevel">2</stringProp>
<stringProp name="RampUp">12</stringProp>
<stringProp name="Steps">2</stringProp>
...
...
@@ -773,11 +773,11 @@ public class JmeterDocumentParser implements DocumentParser {
removeChildren
(
threadGroup
);
// elementProp
Element
elementProp
=
document
.
createElement
(
"elementProp"
);
elementProp
.
setAttribute
(
"name"
,
"
Ms
ThreadGroup.main_controller"
);
elementProp
.
setAttribute
(
"name"
,
"ThreadGroup.main_controller"
);
elementProp
.
setAttribute
(
"elementType"
,
"com.blazemeter.jmeter.control.VirtualUserController"
);
threadGroup
.
appendChild
(
elementProp
);
threadGroup
.
appendChild
(
createStringProp
(
document
,
"
Ms
ThreadGroup.on_sample_error"
,
"continue"
));
threadGroup
.
appendChild
(
createStringProp
(
document
,
"ThreadGroup.on_sample_error"
,
"continue"
));
threadGroup
.
appendChild
(
createStringProp
(
document
,
"TargetLevel"
,
"2"
));
threadGroup
.
appendChild
(
createStringProp
(
document
,
"RampUp"
,
"12"
));
threadGroup
.
appendChild
(
createStringProp
(
document
,
"Steps"
,
"2"
));
...
...
@@ -785,9 +785,7 @@ public class JmeterDocumentParser implements DocumentParser {
threadGroup
.
appendChild
(
createStringProp
(
document
,
"LogFilename"
,
""
));
// bzm - Concurrency Thread Group "Thread Iterations Limit:" 设置为空
// threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
// threadGroup.appendChild(createStringProp(document, "Unit", "M"));
// 单位改成秒
threadGroup
.
appendChild
(
createStringProp
(
document
,
"Unit"
,
"S"
));
threadGroup
.
appendChild
(
createStringProp
(
document
,
"Unit"
,
"M"
));
}
private
void
processCheckoutTimer
(
Element
element
)
{
...
...
@@ -880,24 +878,6 @@ public class JmeterDocumentParser implements DocumentParser {
}
private
void
processVariableThroughputTimer
(
Element
variableThroughputTimer
)
{
Object
durations
=
context
.
getProperty
(
"duration"
);
Integer
duration
;
if
(
durations
instanceof
List
)
{
Object
o
=
((
List
<?>)
durations
).
get
(
0
);
duration
=
(
Integer
)
o
;
((
List
<?>)
durations
).
remove
(
0
);
}
else
{
duration
=
(
Integer
)
durations
;
}
Object
rpsLimits
=
context
.
getProperty
(
"rpsLimit"
);
String
rpsLimit
;
if
(
rpsLimits
instanceof
List
)
{
Object
o
=
((
List
<?>)
rpsLimits
).
get
(
0
);
((
List
<?>)
rpsLimits
).
remove
(
0
);
rpsLimit
=
o
.
toString
();
}
else
{
rpsLimit
=
rpsLimits
.
toString
();
}
if
(
variableThroughputTimer
.
getChildNodes
().
getLength
()
>
0
)
{
final
NodeList
childNodes
=
variableThroughputTimer
.
getChildNodes
();
for
(
int
i
=
0
;
i
<
childNodes
.
getLength
();
i
++)
{
...
...
@@ -923,9 +903,27 @@ public class JmeterDocumentParser implements DocumentParser {
stringPropCount
++;
}
else
{
stringPropCount
=
0
;
prop
.
getFirstChild
().
setNodeValue
(
String
.
valueOf
(
duration
));
Object
durations
=
context
.
getProperty
(
"duration"
);
// 传入的是分钟数, 需要转化成秒数
Integer
duration
;
if
(
durations
instanceof
List
)
{
Object
o
=
((
List
<?>)
durations
).
get
(
0
);
duration
=
(
Integer
)
o
;
((
List
<?>)
durations
).
remove
(
0
);
}
else
{
duration
=
(
Integer
)
durations
;
}
prop
.
getFirstChild
().
setNodeValue
(
String
.
valueOf
(
duration
*
60
));
continue
;
}
Object
rpsLimits
=
context
.
getProperty
(
"rpsLimit"
);
String
rpsLimit
;
if
(
rpsLimits
instanceof
List
)
{
Object
o
=
((
List
<?>)
rpsLimits
).
get
(
0
);
((
List
<?>)
rpsLimits
).
remove
(
0
);
rpsLimit
=
o
.
toString
();
}
else
{
rpsLimit
=
rpsLimits
.
toString
();
}
prop
.
getFirstChild
().
setNodeValue
(
rpsLimit
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录