From 8d69345b2a5ece9e0c6c416196f3731a3eaf872b Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Sat, 22 Jan 2022 12:09:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95)=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E5=8C=85=E5=90=ABcvs?= =?UTF-8?q?=E7=9A=84JMX=E6=A0=BC=E5=BC=8F=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/unknown/MsJmeterElement.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java index b375f4947f..5259a88796 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java @@ -1,6 +1,7 @@ package io.metersphere.api.dto.definition.request.unknown; import com.alibaba.fastjson.annotation.JSONType; +import io.metersphere.api.dto.definition.request.ElementUtil; import io.metersphere.api.dto.definition.request.ParameterConfig; import io.metersphere.api.dto.definition.request.variable.ScenarioVariable; import io.metersphere.api.dto.scenario.request.BodyFile; @@ -23,6 +24,7 @@ import org.apache.jorphan.collections.HashTree; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; +import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; @@ -77,9 +79,20 @@ public class MsJmeterElement extends MsTestElement { config.getCsvFilePaths().add(csvPath); } } + if (scriptWrapper instanceof TestPlan && tree.size() > 0) { + for (Object obj : tree.keySet()) { + if (obj instanceof CSVDataSet) { + tree.remove(obj); + } + } + } if (config.isOperating()) { elementTree = tree.add(scriptWrapper); + if ((scriptWrapper instanceof ThreadGroup)) { + ElementUtil.addCsvDataSet(elementTree, config.getVariables(), config, "shareMode.thread"); + } + } else if (!(scriptWrapper instanceof TestPlan) && !(scriptWrapper instanceof ThreadGroup)) { elementTree = tree.add(scriptWrapper); } @@ -94,7 +107,6 @@ public class MsJmeterElement extends MsTestElement { } } } - } } catch (Exception ex) { ex.printStackTrace();