fix(接口测试): 修复其他协议导入覆盖重复导入问题

--bug=1026236 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001026236
This commit is contained in:
guoyuqi 2023-05-17 18:18:58 +08:00 committed by fit2-zhao
parent 65e3ca54eb
commit 3b5539ce2a
1 changed files with 5 additions and 9 deletions

View File

@ -229,7 +229,7 @@ public class ApiDefinitionImportUtilService {
} else {
repeatList = dealRepeat(apiImportParamDto);
}
optionData = apiImportParamDto.getOptionData();
Map<String, List<ApiTestCaseWithBLOBs>> apiIdCaseMap = optionDataCases.stream().collect(Collectors.groupingBy(ApiTestCase::getApiDefinitionId));
if (MapUtils.isNotEmpty(moduleMap)) {
@ -867,7 +867,6 @@ public class ApiDefinitionImportUtilService {
List<ApiTestCaseWithBLOBs> optionDataCases = apiImportParamDto.getOptionDataCases();
Map<String, ApiModule> moduleMap = apiImportParamDto.getModuleMap();
String chooseModuleId = request.getModuleId();
List<ApiDefinitionWithBLOBs> repeatApiDefinitionWithBLOBs = getApiDefinitionWithBLOBsList(request, optionData);
//如果系统内没有重复数据要把文件重复的数据改成接口的case
if (CollectionUtils.isEmpty(repeatApiDefinitionWithBLOBs)) {
@ -888,15 +887,12 @@ public class ApiDefinitionImportUtilService {
List<ApiDefinitionWithBLOBs> singleOptionData = new ArrayList<>();
removeOtherChooseModuleRepeat(optionData, singleOptionData, chooseModulePath);
optionData = singleOptionData;
optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName().concat(chooseModulePath), api -> api));
} else {
getNoHChooseModuleUrlRepeatOptionMap(optionData, optionMap, chooseModulePath);
}
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().filter(t -> t.getModuleId().equals(chooseModuleId)).collect(Collectors.groupingBy(t -> t.getName().concat(t.getModulePath())));
getNoHChooseModuleUrlRepeatOptionMap(optionData, optionMap, chooseModulePath);
} else {
buildOptionMap(optionData, optionMap);
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getModulePath())));
}
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getModulePath())));
Boolean fullCoverageApi = getFullCoverageApi(request);
String updateVersionId = getUpdateVersionId(request);
//处理数据
@ -932,10 +928,10 @@ public class ApiDefinitionImportUtilService {
if (optionData.isEmpty()) {
moduleMap = new HashMap<>();
}
apiImportParamDto.setOptionData(optionData);
//将原来的case和更改的case组合在一起为了同步的设置
List<String> caseIds = optionDataCases.stream().map(ApiTestCase::getId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
buildCases(optionDataCases, oldCaseMap, caseIds);
return repeatApiDefinitionWithBLOBs;
}
@ -961,7 +957,7 @@ public class ApiDefinitionImportUtilService {
if (optionDatum.getModulePath() == null) {
optionMap.put(optionDatum.getName().concat(chooseModulePath), optionDatum);
} else {
optionMap.put(optionDatum.getName().concat(chooseModulePath).concat(optionDatum.getModulePath()), optionDatum);
optionMap.put(optionDatum.getName().concat(optionDatum.getModulePath()), optionDatum);
}
}
}