From 0f0af3ba278712d86e2eaabd2196801f9d7635eb Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 14 Feb 2022 10:57:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0jmx=E4=B8=AD=E5=B7=B2?= =?UTF-8?q?=E6=9C=89=20backend=20listener=20=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=8E=BB=E9=87=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1010227 --user=刘瑞斌 【性能测试】github#10429,性能测试报告日志详情中的summary的值比请求统计中的samples的total值小一半 https://www.tapd.cn/55049933/s/1103469 Closes #10429 --- .../parse/xml/reader/JmeterDocumentParser.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/JmeterDocumentParser.java b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/JmeterDocumentParser.java index 27c0502310..8ef0c6f2e2 100644 --- a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/JmeterDocumentParser.java +++ b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/JmeterDocumentParser.java @@ -73,8 +73,7 @@ public class JmeterDocumentParser implements EngineSourceParser { if (hashTree.elements().size() > 0) { final List childNodes = hashTree.elements(); - for (int i = 0; i < childNodes.size(); i++) { - Element ele = childNodes.get(i); + for (Element ele : childNodes) { if (nodeNameEquals(ele, HASH_TREE_ELEMENT)) { parseHashTree(ele); } else if (nodeNameEquals(ele, TEST_PLAN)) { @@ -611,6 +610,15 @@ public class JmeterDocumentParser implements EngineSourceParser { Element listenerParent = getNextSibling(element); + List childNodes = listenerParent.elements(); + for (Element item : childNodes) { + if (nodeNameEquals(item, BACKEND_LISTENER)) { + // 如果已经存在,不再添加 + removeChildren(item); + return; + } + } + // add class name Element backendListener = listenerParent.addElement(BACKEND_LISTENER); backendListener.addAttribute("guiclass", "BackendListenerGui");