fix(性能测试): 修复自动停止生成jmx失败的问题

This commit is contained in:
CaptainB 2022-02-01 20:22:13 +08:00 committed by 刘瑞斌
parent 27cd812e23
commit aeae6c320f
1 changed files with 3 additions and 4 deletions

View File

@ -140,7 +140,6 @@ public class JmeterDocumentParser implements EngineSourceParser {
Object o = ((List<?>) autoStopDelays).get(0); Object o = ((List<?>) autoStopDelays).get(0);
autoStopDelay = o.toString(); autoStopDelay = o.toString();
} }
Document document = autoStopListener.getDocument();
// 清空child // 清空child
removeChildren(autoStopListener); removeChildren(autoStopListener);
// 添加子元素 // 添加子元素
@ -157,14 +156,14 @@ public class JmeterDocumentParser implements EngineSourceParser {
if (!BooleanUtils.toBoolean(autoStop)) { if (!BooleanUtils.toBoolean(autoStop)) {
return; return;
} }
Element hashTree = getNextSibling(element);
// add class name // add class name
Element autoStopListener = element.addElement(THREAD_GROUP_AUTO_STOP); Element autoStopListener = hashTree.addElement(THREAD_GROUP_AUTO_STOP);
autoStopListener.addAttribute("guiclass", "io.metersphere.jmeter.reporters.ThreadGroupAutoStopGui"); autoStopListener.addAttribute("guiclass", "io.metersphere.jmeter.reporters.ThreadGroupAutoStopGui");
autoStopListener.addAttribute("testclass", "io.metersphere.jmeter.reporters.ThreadGroupAutoStop"); autoStopListener.addAttribute("testclass", "io.metersphere.jmeter.reporters.ThreadGroupAutoStop");
autoStopListener.addAttribute("testname", "MeterSphere - AutoStop Listener"); autoStopListener.addAttribute("testname", "MeterSphere - AutoStop Listener");
autoStopListener.addAttribute("enabled", "true"); autoStopListener.addAttribute("enabled", "true");
element.addElement(HASH_TREE_ELEMENT); hashTree.addElement(HASH_TREE_ELEMENT);
} }
private void processCheckoutSerializeThreadgroups(Element element) { private void processCheckoutSerializeThreadgroups(Element element) {