fix(接口测试): 解决其他协议在没有任何接口时导入会报错问题
This commit is contained in:
parent
079b569742
commit
660df9a548
|
@ -1013,11 +1013,15 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||||
Map<String, ApiDefinitionWithBLOBs> repeatDataMap, Map<String, ApiModule> moduleMap,
|
Map<String, ApiDefinitionWithBLOBs> repeatDataMap, Map<String, ApiModule> moduleMap,
|
||||||
String versionId,
|
String versionId,
|
||||||
List<ApiTestCaseWithBLOBs> optionDataCases) {
|
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));
|
Map<String, List<ApiDefinitionWithBLOBs>> moduleOptionData = optionDatas.stream().collect(Collectors.groupingBy(ApiDefinition::getModulePath));
|
||||||
repeatDataMap.forEach((k, v) -> {
|
repeatDataMap.forEach((k, v) -> {
|
||||||
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = nameModuleMap.get(k);
|
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = nameModuleMap.get(k);
|
||||||
if (apiDefinitionWithBLOBs != null) {
|
if (apiDefinitionWithBLOBs == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
Map<String, List<ApiTestCaseWithBLOBs>> definitionIdCaseMAp = optionDataCases.stream().collect(Collectors.groupingBy(ApiTestCase::getApiDefinitionId));
|
Map<String, List<ApiTestCaseWithBLOBs>> definitionIdCaseMAp = optionDataCases.stream().collect(Collectors.groupingBy(ApiTestCase::getApiDefinitionId));
|
||||||
List<ApiTestCaseWithBLOBs> distinctNameCases = definitionIdCaseMAp.get(apiDefinitionWithBLOBs.getId());
|
List<ApiTestCaseWithBLOBs> distinctNameCases = definitionIdCaseMAp.get(apiDefinitionWithBLOBs.getId());
|
||||||
String modulePath = apiDefinitionWithBLOBs.getModulePath();
|
String modulePath = apiDefinitionWithBLOBs.getModulePath();
|
||||||
|
@ -1037,10 +1041,8 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||||
//这里是为了标识当前数据是需要创建版本的,不是全新增的数据
|
//这里是为了标识当前数据是需要创建版本的,不是全新增的数据
|
||||||
addNewVersionApi(apiDefinitionWithBLOBs, v, "new");
|
addNewVersionApi(apiDefinitionWithBLOBs, v, "new");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void addNewVersionApi(ApiDefinitionWithBLOBs apiDefinitionWithBLOBs, ApiDefinitionWithBLOBs v, String version) {
|
private void addNewVersionApi(ApiDefinitionWithBLOBs apiDefinitionWithBLOBs, ApiDefinitionWithBLOBs v, String version) {
|
||||||
apiDefinitionWithBLOBs.setVersionId(version);
|
apiDefinitionWithBLOBs.setVersionId(version);
|
||||||
|
|
Loading…
Reference in New Issue