fix(接口测试): 场景导入不是引用的处理

--user=郭雨琦
场景导入不是引用,如果是自定义,加引用环境
This commit is contained in:
guoyuqi 2022-03-24 15:13:56 +08:00 committed by shiziyuan9527
parent e2cc4b2b61
commit 5e8a556942

View File

@ -400,13 +400,12 @@ public class ApiAutomationService {
if (scenario == null || StringUtils.isEmpty(scenario.getScenarioDefinition())) {
return;
}
if (scenario.getScenarioDefinition().contains("\"referenced\":\"REF\"")) {
JSONObject element = JSON.parseObject(scenario.getScenarioDefinition());
JSONArray hashTree = element.getJSONArray("hashTree");
ApiScenarioImportUtil.formatHashTree(hashTree);
setReferenced(hashTree,scenario.getVersionId(),scenario.getProjectId(),apiTestCaseMapper,apiDefinitionMapper,true);
scenario.setScenarioDefinition(JSONObject.toJSONString(element));
}
JSONObject element = JSON.parseObject(scenario.getScenarioDefinition());
JSONArray hashTree = element.getJSONArray("hashTree");
ApiScenarioImportUtil.formatHashTree(hashTree);
setReferenced(hashTree,scenario.getVersionId(),scenario.getProjectId(),apiTestCaseMapper,apiDefinitionMapper,true);
scenario.setScenarioDefinition(JSONObject.toJSONString(element));
}
private void checkAndSetLatestVersion(String refId) {
@ -1989,6 +1988,9 @@ public class ApiAutomationService {
}
}else{
object.put("projectId", projectId);
if(StringUtils.isEmpty(object.getString("url"))){
object.put("isRefEnvironment",true);
}
}
JSONObject environmentMap = object.getJSONObject("environmentMap");
if (environmentMap != null) {