fix(接口测试): 修复接口导入覆盖问题
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001018819 --user=郭雨琦
This commit is contained in:
parent
890b82b1a3
commit
72a7b40584
|
@ -1174,6 +1174,7 @@ public class ApiDefinitionService {
|
||||||
} else if (apiTestImportRequest.getCoverModule() != null && apiTestImportRequest.getCoverModule()) {
|
} else if (apiTestImportRequest.getCoverModule() != null && apiTestImportRequest.getCoverModule()) {
|
||||||
apiDefinition.setUpdateTime(System.currentTimeMillis());
|
apiDefinition.setUpdateTime(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(caseList)) {
|
if (CollectionUtils.isEmpty(caseList)) {
|
||||||
apiDefinition.setToBeUpdated(false);
|
apiDefinition.setToBeUpdated(false);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1304,7 +1304,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||||
List<ApiTestCaseWithBLOBs> oldApiTestCases = oldCaseMap.get(definitionWithBLOBs.getId());
|
List<ApiTestCaseWithBLOBs> oldApiTestCases = oldCaseMap.get(definitionWithBLOBs.getId());
|
||||||
|
|
||||||
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseNameMap;
|
Map<String, List<ApiTestCaseWithBLOBs>> oldCaseNameMap;
|
||||||
//如果重复用例有多个,则覆盖最后的那个
|
//如果同名重复用例有多个,则覆盖最后的那个
|
||||||
if (CollectionUtils.isNotEmpty(oldApiTestCases)) {
|
if (CollectionUtils.isNotEmpty(oldApiTestCases)) {
|
||||||
oldCaseNameMap = oldApiTestCases.stream().collect(Collectors.groupingBy(ApiTestCase::getName));
|
oldCaseNameMap = oldApiTestCases.stream().collect(Collectors.groupingBy(ApiTestCase::getName));
|
||||||
caseNameMap.forEach((name, importCaseWithBLOBs) -> {
|
caseNameMap.forEach((name, importCaseWithBLOBs) -> {
|
||||||
|
@ -1332,17 +1332,15 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||||
}
|
}
|
||||||
oldCaseNameMap.remove(name);
|
oldCaseNameMap.remove(name);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
//不同名的旧数据处理
|
//不同名的旧数据处理
|
||||||
oldCaseNameMap.forEach((k, v) -> {
|
oldCaseNameMap.forEach((k, v) -> {
|
||||||
if (!StringUtils.equals(k, name)) {
|
|
||||||
if (CollectionUtils.isNotEmpty(v)) {
|
if (CollectionUtils.isNotEmpty(v)) {
|
||||||
for (ApiTestCaseWithBLOBs apiTestCaseWithBLOBs : v) {
|
for (ApiTestCaseWithBLOBs apiTestCaseWithBLOBs : v) {
|
||||||
apiTestCaseWithBLOBs.setVersionId("old_case");
|
apiTestCaseWithBLOBs.setVersionId("old_case");
|
||||||
optionDataCases.add(apiTestCaseWithBLOBs);
|
optionDataCases.add(apiTestCaseWithBLOBs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//否则直接给新增用例赋值新的接口ID
|
//否则直接给新增用例赋值新的接口ID
|
||||||
|
|
Loading…
Reference in New Issue