fix(性能测试): 修复上传jmx中已有 backend listener 的时候没有去重的问题

--bug=1010227 --user=刘瑞斌 【性能测试】github#10429,性能测试报告日志详情中的summary的值比请求统计中的samples的total值小一半 https://www.tapd.cn/55049933/s/1103469

Closes #10429
This commit is contained in:
CaptainB 2022-02-14 10:57:18 +08:00 committed by 刘瑞斌
parent 6f37cdc06b
commit 46b1d3fc25
1 changed files with 10 additions and 2 deletions

View File

@ -73,8 +73,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
if (hashTree.elements().size() > 0) { if (hashTree.elements().size() > 0) {
final List<Element> childNodes = hashTree.elements(); final List<Element> childNodes = hashTree.elements();
for (int i = 0; i < childNodes.size(); i++) { for (Element ele : childNodes) {
Element ele = childNodes.get(i);
if (nodeNameEquals(ele, HASH_TREE_ELEMENT)) { if (nodeNameEquals(ele, HASH_TREE_ELEMENT)) {
parseHashTree(ele); parseHashTree(ele);
} else if (nodeNameEquals(ele, TEST_PLAN)) { } else if (nodeNameEquals(ele, TEST_PLAN)) {
@ -611,6 +610,15 @@ public class JmeterDocumentParser implements EngineSourceParser {
Element listenerParent = getNextSibling(element); Element listenerParent = getNextSibling(element);
List<Element> childNodes = listenerParent.elements();
for (Element item : childNodes) {
if (nodeNameEquals(item, BACKEND_LISTENER)) {
// 如果已经存在不再添加
removeChildren(item);
return;
}
}
// add class name // add class name
Element backendListener = listenerParent.addElement(BACKEND_LISTENER); Element backendListener = listenerParent.addElement(BACKEND_LISTENER);
backendListener.addAttribute("guiclass", "BackendListenerGui"); backendListener.addAttribute("guiclass", "BackendListenerGui");