fix(接口测试): 修复多线程组JMX导入模块创建错误问题

--bug=1022727 --user=赵勇 【接口测试】导入多线程的jmx文件,自动生成的模块名称是null https://www.tapd.cn/55049933/s/1334194
This commit is contained in:
fit2-zhao 2023-02-13 10:52:30 +08:00 committed by fit2-zhao
parent 8f99f736c6
commit 08123f5cf6
2 changed files with 6 additions and 10 deletions

View File

@ -286,15 +286,9 @@ public class JmeterDefinitionParser extends ApiImportAbstractParser<ApiDefinitio
apiDefinition.setName(element.getName()); apiDefinition.setName(element.getName());
apiDefinition.setProjectId(this.projectId); apiDefinition.setProjectId(this.projectId);
apiDefinition.setRequest(JSON.toJSONString(element)); apiDefinition.setRequest(JSON.toJSONString(element));
/* if (this.apiModule != null) { if (StringUtils.isNotBlank(this.planName)) {
apiDefinition.setModuleId(this.apiModule.getId()); apiDefinition.setModulePath("/" + this.planName);
if (StringUtils.isNotBlank(this.selectModulePath)) { }
apiDefinition.setModulePath(this.selectModulePath + "/" + this.apiModule.getName());
} else {
apiDefinition.setModulePath("/" + this.apiModule.getName());
}
}*/
apiDefinition.setModulePath("/" + this.planName);
// todo 除HTTP协议外其它协议设置默认模块 // todo 除HTTP协议外其它协议设置默认模块
apiDefinition.setStatus("Prepare"); apiDefinition.setStatus("Prepare");
apiDefinition.setProtocol(protocol); apiDefinition.setProtocol(protocol);

View File

@ -146,7 +146,9 @@ public class JMeterParser extends ApiImportAbstractParser<ScenarioImport> {
scenarioWithBLOBs.setProjectId(request.getProjectId()); scenarioWithBLOBs.setProjectId(request.getProjectId());
if (msScenario != null && CollectionUtils.isNotEmpty(msScenario.getHashTree())) { if (msScenario != null && CollectionUtils.isNotEmpty(msScenario.getHashTree())) {
scenarioWithBLOBs.setStepTotal(msScenario.getHashTree().size()); scenarioWithBLOBs.setStepTotal(msScenario.getHashTree().size());
scenarioWithBLOBs.setModulePath("/" + msScenario.getName()); if (StringUtils.isNotBlank(msScenario.getName())) {
scenarioWithBLOBs.setModulePath("/" + msScenario.getName());
}
} }
scenarioWithBLOBs.setId(UUID.randomUUID().toString()); scenarioWithBLOBs.setId(UUID.randomUUID().toString());
scenarioWithBLOBs.setScenarioDefinition(JSON.toJSONString(msScenario)); scenarioWithBLOBs.setScenarioDefinition(JSON.toJSONString(msScenario));