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

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

View File

@ -161,10 +161,7 @@ public class ApiDefinitionService {
@Lazy
@Resource
private ProjectService projectService;
@Resource
private ApiDefinitionSyncService apiDefinitionSyncService;
@Resource
private ApiCaseBatchSyncService apiCaseSyncService;
@Lazy
@Resource
private ApiAutomationService apiAutomationService;
@ -411,6 +408,7 @@ public class ApiDefinitionService {
}
// 设置是否需要进入待更新列表
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
if (apiDefinitionSyncService != null) {
apiDefinitionSyncService.syncApi(request);
}
@ -426,6 +424,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);
}
@ -1276,6 +1275,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.setCaseUpdateValue(test);
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,11 +1305,14 @@ public class ApiTestCaseService {
if (request.isNoSearchStatus()) {
request.setStatusList(new ArrayList<>());
} else {
List<String> syncRuleCaseStatus = apiTestCaseSyncService.getSyncRuleCaseStatus(request.getProjectId());
if (CollectionUtils.isEmpty(syncRuleCaseStatus)) {
syncRuleCaseStatus = new ArrayList<>();
ApiTestCaseSyncService apiTestCaseSyncService = CommonBeanFactory.getBean(ApiTestCaseSyncService.class);
if (apiTestCaseSyncService !=null) {
List<String> syncRuleCaseStatus = apiTestCaseSyncService.getSyncRuleCaseStatus(request.getProjectId());
if (CollectionUtils.isEmpty(syncRuleCaseStatus)) {
syncRuleCaseStatus = new ArrayList<>();
}
request.setStatusList(syncRuleCaseStatus);
}
request.setStatusList(syncRuleCaseStatus);
}
}