fix(接口测试): postman 导入和har导入解析时不去重

--user=郭雨琦
--bug=1014714
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014715
This commit is contained in:
guoyuqi 2022-07-07 13:06:47 +08:00 committed by f2c-ci-robot[bot]
parent 6bfc7eb425
commit befa6abd2e
4 changed files with 16 additions and 24 deletions

View File

@ -88,6 +88,7 @@ public class HarParser extends HarAbstractParser {
url = url.split("\\?")[0]; url = url.split("\\?")[0];
} }
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e.getMessage(), e);
} }
//默认取路径的最后一块 //默认取路径的最后一块

View File

@ -73,7 +73,6 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser<ApiDefi
if (StringUtils.isNotBlank(modulePath)) { if (StringUtils.isNotBlank(modulePath)) {
request.setModulePath(modulePath); request.setModulePath(modulePath);
} }
if (request != null) {
results.add(request); results.add(request);
ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs(); ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs();
BeanUtils.copyBean(apiTestCase, request); BeanUtils.copyBean(apiTestCase, request);
@ -84,4 +83,3 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser<ApiDefi
} }
} }
} }
}

View File

@ -764,11 +764,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
if (apiDefinitionWithBLOBs != null) { if (apiDefinitionWithBLOBs != null) {
String modulePath = apiDefinitionWithBLOBs.getModulePath(); String modulePath = apiDefinitionWithBLOBs.getModulePath();
List<ApiDefinitionWithBLOBs> moduleDatas = moduleOptionData.get(modulePath); List<ApiDefinitionWithBLOBs> moduleDatas = moduleOptionData.get(modulePath);
if (moduleDatas != null) { if (moduleDatas != null && moduleDatas.size() <= 1) {
if (moduleDatas.size() <= 1) {
moduleMap.remove(modulePath); moduleMap.remove(modulePath);
removeModulePath(moduleMap, moduleOptionData, modulePath); removeModulePath(moduleMap, moduleOptionData, modulePath);
}
moduleDatas.remove(apiDefinitionWithBLOBs); moduleDatas.remove(apiDefinitionWithBLOBs);
} }
optionData.remove(apiDefinitionWithBLOBs); optionData.remove(apiDefinitionWithBLOBs);
@ -980,11 +978,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
if (apiDefinitionWithBLOBs != null) { if (apiDefinitionWithBLOBs != null) {
String modulePath = apiDefinitionWithBLOBs.getModulePath(); String modulePath = apiDefinitionWithBLOBs.getModulePath();
List<ApiDefinitionWithBLOBs> moduleDatas = moduleOptionData.get(modulePath); List<ApiDefinitionWithBLOBs> moduleDatas = moduleOptionData.get(modulePath);
if (moduleDatas != null) { if (moduleDatas != null && moduleDatas.size() <= 1) {
if (moduleDatas.size() <= 1) {
moduleMap.remove(modulePath); moduleMap.remove(modulePath);
removeModulePath(moduleMap, moduleOptionData, modulePath); removeModulePath(moduleMap, moduleOptionData, modulePath);
}
moduleDatas.remove(apiDefinitionWithBLOBs); moduleDatas.remove(apiDefinitionWithBLOBs);
} }

View File

@ -603,13 +603,10 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
if (apiScenarioWithBLOBs != null) { if (apiScenarioWithBLOBs != null) {
String modulePath = apiScenarioWithBLOBs.getModulePath(); String modulePath = apiScenarioWithBLOBs.getModulePath();
List<ApiScenarioWithBLOBs> moduleDatas = moduleOptionData.get(modulePath); List<ApiScenarioWithBLOBs> moduleDatas = moduleOptionData.get(modulePath);
if (moduleDatas != null) { if (moduleDatas != null && moduleDatas.size() <= 1) {
if (moduleDatas.size() <= 1) {
moduleMap.remove(modulePath); moduleMap.remove(modulePath);
removeModulePath(moduleMap, moduleOptionData, modulePath); removeModulePath(moduleMap, moduleOptionData, modulePath);
}
moduleDatas.remove(apiScenarioWithBLOBs); moduleDatas.remove(apiScenarioWithBLOBs);
} }
optionData.remove(apiScenarioWithBLOBs); optionData.remove(apiScenarioWithBLOBs);
} }