fix(接口测试): 修复重复导入选择模块产生重复接口问题

--bug=1021143--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001021143
This commit is contained in:
guoyuqi 2022-12-22 11:54:16 +08:00 committed by xiaomeinvG
parent e28b8edeff
commit 1083dd32f5
1 changed files with 3 additions and 9 deletions

View File

@ -24,7 +24,6 @@ import io.metersphere.service.BaseProjectApplicationService;
import io.metersphere.service.MockConfigService;
import io.metersphere.service.ServiceUtils;
import io.metersphere.service.ext.ExtApiScheduleService;
import io.metersphere.xpack.api.service.ApiDefinitionSyncService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -322,16 +321,11 @@ public class ApiDefinitionImportUtilService {
if (fullCoverage) {
removeHttpChooseModuleRepeat(optionData, chooseModulePath);
// optionData = singleOptionData;
optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(chooseModulePath), api -> api));
} else {
getChooseModuleUrlRepeatOptionMap(optionData, optionMap, chooseModulePath);
// optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(chooseModulePath), api -> api));
}
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().filter(t -> t.getModuleId().equals(chooseModule.getId())).collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath())));
} else {
//否则在整个系统中过滤
getUrlRepeatOptionMap(optionData, optionMap);
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath())));
}
getUrlRepeatOptionMap(optionData, optionMap);
repeatDataMap = repeatApiDefinitionWithBLOBs.stream().collect(Collectors.groupingBy(t -> t.getName().concat(t.getMethod()).concat(t.getPath()).concat(t.getModulePath())));
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseMap = new HashMap<>();
//重复接口的case
if (CollectionUtils.isNotEmpty(repeatApiDefinitionWithBLOBs)) {