fix(接口测试): 解决其他协议在没有任何接口时导入会报错问题

This commit is contained in:
guoyuqi 2022-10-13 10:37:49 +08:00 committed by xiaomeinvG
parent 079b569742
commit 660df9a548
1 changed files with 28 additions and 26 deletions

View File

@ -1013,11 +1013,15 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
Map<String, ApiDefinitionWithBLOBs> repeatDataMap, Map<String, ApiModule> moduleMap,
String versionId,
List<ApiTestCaseWithBLOBs> optionDataCases) {
if (nameModuleMap != null) {
if (MapUtils.isEmpty(nameModuleMap) || MapUtils.isEmpty(repeatDataMap)) {
return;
}
Map<String, List<ApiDefinitionWithBLOBs>> moduleOptionData = optionDatas.stream().collect(Collectors.groupingBy(ApiDefinition::getModulePath));
repeatDataMap.forEach((k, v) -> {
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = nameModuleMap.get(k);
if (apiDefinitionWithBLOBs != null) {
if (apiDefinitionWithBLOBs == null){
return;
}
Map<String, List<ApiTestCaseWithBLOBs>> definitionIdCaseMAp = optionDataCases.stream().collect(Collectors.groupingBy(ApiTestCase::getApiDefinitionId));
List<ApiTestCaseWithBLOBs> distinctNameCases = definitionIdCaseMAp.get(apiDefinitionWithBLOBs.getId());
String modulePath = apiDefinitionWithBLOBs.getModulePath();
@ -1037,10 +1041,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
//这里是为了标识当前数据是需要创建版本的不是全新增的数据
addNewVersionApi(apiDefinitionWithBLOBs, v, "new");
}
}
});
}
}
private void addNewVersionApi(ApiDefinitionWithBLOBs apiDefinitionWithBLOBs, ApiDefinitionWithBLOBs v, String version) {
apiDefinitionWithBLOBs.setVersionId(version);