From 1383ca4d5a271e6167b4fb4044b3e50d3a16a56a Mon Sep 17 00:00:00 2001 From: "song.tianyang" Date: Sat, 20 Feb 2021 18:08:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=94=9F=E6=88=90jmx?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=87=BD=E6=95=B0=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E8=BD=AC=E5=8C=96Dubbl=E6=A0=87=E7=AD=BE=E7=9A=84?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改生成jmx文件函数的逻辑,转化Dubbl标签的参数 --- .../api/service/APITestService.java | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/APITestService.java b/backend/src/main/java/io/metersphere/api/service/APITestService.java index 10cf3ab666..f610ca0cb0 100644 --- a/backend/src/main/java/io/metersphere/api/service/APITestService.java +++ b/backend/src/main/java/io/metersphere/api/service/APITestService.java @@ -473,12 +473,37 @@ public class APITestService { List thirdHashTreeElementList = innerHashTreeElement.elements("hashTree"); for (Element element : thirdHashTreeElementList) { - if(updateHTTPSamplerProxyName){ - List sampleProxyElementList = element.elements("HTTPSamplerProxy"); - for (Element itemElement : sampleProxyElementList) { + List sampleProxyElementList = element.elements("HTTPSamplerProxy"); + for (Element itemElement : sampleProxyElementList) { + if(updateHTTPSamplerProxyName){ itemElement.attribute("testname").setText(testName); } } + List tcpSamplerList = element.elements("TCPSampler"); + for (Element itemElement : tcpSamplerList) { + if(updateHTTPSamplerProxyName){ + itemElement.attribute("testname").setText(testName); + } + } + List jdbcSamplerList = element.elements("JDBCSampler"); + for (Element itemElement : jdbcSamplerList) { + if(updateHTTPSamplerProxyName){ + itemElement.attribute("testname").setText(testName); + } + } + List dubboSampleList = element.elements("DubboSample"); + for (Element itemElement : dubboSampleList) { + if(updateHTTPSamplerProxyName){ + itemElement.attribute("testname").setText(testName); + } + + //dubbo节点要更新 标签、guiClass 和 testClass + itemElement.setName("io.github.ningyu.jmeter.plugin.dubbo.sample.DubboSample"); + itemElement.attribute("testclass").setText("io.github.ningyu.jmeter.plugin.dubbo.sample.DubboSample"); + itemElement.attribute("guiclass").setText("io.github.ningyu.jmeter.plugin.dubbo.gui.DubboSampleGui"); + + } + //检查有没有自定义参数 List scriptHashTreeElementList = element.elements("hashTree"); for (Element scriptHashTreeElement : scriptHashTreeElementList) {