fix(接口测试): xpack代码引用方式

This commit is contained in:
guoyuqi 2022-08-25 16:22:09 +08:00 committed by xiaomeinvG
parent bf8b9fbec1
commit 816d26445b
2 changed files with 18 additions and 13 deletions

View File

@ -163,10 +163,7 @@ public class ApiDefinitionService {
@Lazy
@Resource
private ProjectService projectService;
@Resource
private ApiDefinitionSyncService apiDefinitionSyncService;
@Resource
private ApiCaseBatchSyncService apiCaseSyncService;
@Lazy
@Resource
private ApiAutomationService apiAutomationService;
@ -413,6 +410,7 @@ public class ApiDefinitionService {
}
// 设置是否需要进入待更新列表
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
if (apiDefinitionSyncService != null) {
apiDefinitionSyncService.syncApi(request);
}
@ -428,6 +426,7 @@ public class ApiDefinitionService {
getParamMap(paramMap, returnModel.getProjectId(), SessionUtils.getUserId(), returnModel.getId(), returnModel.getName(), returnModel.getCreateUser());
paramMap.put("userId", returnModel.getUserId());
// 发送通知
ApiCaseBatchSyncService apiCaseSyncService = CommonBeanFactory.getBean(ApiCaseBatchSyncService.class);
if (apiCaseSyncService != null) {
apiCaseSyncService.sendApiNotice(returnModel, paramMap);
}
@ -1278,6 +1277,7 @@ public class ApiDefinitionService {
}
ApiSyncCaseRequest apiSyncCaseRequest = new ApiSyncCaseRequest();
Boolean toUpdate = false;
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
if (apiDefinitionSyncService != null) {
toUpdate = apiDefinitionSyncService.getProjectApplications(existApi.getProjectId());
apiSyncCaseRequest = apiDefinitionSyncService.getApiSyncCaseRequest(existApi.getProjectId());

View File

@ -122,10 +122,6 @@ public class ApiTestCaseService {
@Resource
private FileAssociationService fileAssociationService;
@Resource
private ApiCaseBatchSyncService apiCaseSyncService;
@Resource
private ApiTestCaseSyncService apiTestCaseSyncService;
@Resource
private ApiScenarioReferenceIdMapper apiScenarioReferenceIdMapper;
@ -336,6 +332,7 @@ public class ApiTestCaseService {
FileUtils.createBodyFiles(request.getId(), bodyFiles);
}
// 发送通知
ApiCaseBatchSyncService apiCaseSyncService = CommonBeanFactory.getBean(ApiCaseBatchSyncService.class);
if (apiCaseSyncService != null) {
apiCaseSyncService.sendCaseNotice(test);
}
@ -462,7 +459,11 @@ public class ApiTestCaseService {
} else {
test.setTags(request.getTags());
}
ApiTestCaseSyncService apiTestCaseSyncService = CommonBeanFactory.getBean(ApiTestCaseSyncService.class);
if(apiTestCaseSyncService!=null){
apiTestCaseSyncService.setCaseUpdateValue(test);
}
apiTestCaseMapper.updateByPrimaryKeySelective(test);
saveFollows(test.getId(), request.getFollows());
}
@ -891,6 +892,7 @@ public class ApiTestCaseService {
String requestStr = JSON.toJSONString(req);
apiTestCase.setRequest(requestStr);
// sync case
ApiCaseBatchSyncService apiCaseSyncService = CommonBeanFactory.getBean(ApiCaseBatchSyncService.class);
if (apiCaseSyncService != null) {
apiCaseSyncService.oneClickSyncCase(apiUpdateRule, test, batchMapper, apiTestCase);
}
@ -1303,6 +1305,8 @@ public class ApiTestCaseService {
if (request.isNoSearchStatus()) {
request.setStatusList(new ArrayList<>());
} else {
ApiTestCaseSyncService apiTestCaseSyncService = CommonBeanFactory.getBean(ApiTestCaseSyncService.class);
if (apiTestCaseSyncService !=null) {
List<String> syncRuleCaseStatus = apiTestCaseSyncService.getSyncRuleCaseStatus(request.getProjectId());
if (CollectionUtils.isEmpty(syncRuleCaseStatus)) {
syncRuleCaseStatus = new ArrayList<>();
@ -1310,6 +1314,7 @@ public class ApiTestCaseService {
request.setStatusList(syncRuleCaseStatus);
}
}
}
public Integer getCitedScenarioCount(String testId) {
ApiScenarioReferenceIdExample apiScenarioReferenceIdExample = new ApiScenarioReferenceIdExample();