refactor (接口测试): 优化场景步骤初始化方法

This commit is contained in:
fit2-zhao 2022-03-14 14:13:04 +08:00 committed by fit2-zhao
parent 36a1bfe8b9
commit 64b6b6a9ca
2 changed files with 10 additions and 7 deletions

View File

@ -1809,13 +1809,14 @@ public class ApiDefinitionService {
public ApiDefinitionResult getById(String id) {
ApiDefinitionRequest request = new ApiDefinitionRequest();
request.setId(id);
List<ApiDefinitionResult> list = list(request);
List<ApiDefinitionResult> list = extApiDefinitionMapper.list(request);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0);
}
return null;
}
public long countEffectiveByProjectId(String projectId) {
if (StringUtils.isEmpty(projectId)) {
return 0;

View File

@ -201,6 +201,7 @@ public class MsHashTreeService {
this.setElement(element, apiTestCase.getNum(), enable, apiTestCase.getVersionName(), apiTestCase.getVersionEnable());
}
} else {
if (StringUtils.equalsIgnoreCase(element.getString(REFERENCED), "Copy")) {
ApiDefinitionResult definitionWithBLOBs = apiDefinitionService.getById(element.getString(ID));
if (definitionWithBLOBs != null) {
element.put(ID, definitionWithBLOBs.getId());
@ -208,6 +209,7 @@ public class MsHashTreeService {
isExist = true;
}
}
}
if (!isExist) {
if (StringUtils.equalsIgnoreCase(element.getString(REFERENCED), REF)) {
element.put(ENABLE, false);