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

View File

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