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];
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
}
//默认取路径的最后一块

View File

@ -73,14 +73,12 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser<ApiDefi
if (StringUtils.isNotBlank(modulePath)) {
request.setModulePath(modulePath);
}
if (request != null) {
results.add(request);
ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs();
BeanUtils.copyBean(apiTestCase, request);
apiTestCase.setApiDefinitionId(request.getId());
apiTestCase.setPriority("P0");
cases.add(apiTestCase);
}
results.add(request);
ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs();
BeanUtils.copyBean(apiTestCase, request);
apiTestCase.setApiDefinitionId(request.getId());
apiTestCase.setPriority("P0");
cases.add(apiTestCase);
}
}
}

View File

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

View File

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