fix(接口测试) 修复导出包含cvs的JMX格式错误问题

This commit is contained in:
fit2-zhao 2022-01-22 12:09:08 +08:00 committed by song-tianyang
parent bf6da85535
commit c37b676707
1 changed files with 13 additions and 1 deletions

View File

@ -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();