fix: 测试计划定时任务关闭异常

解决测试计划定时任务关闭异常的问题
This commit is contained in:
song.tianyang 2021-01-27 12:48:55 +08:00
parent f9eae8c6dd
commit 5fe21e9a71
1 changed files with 9 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.job.sechedule.ApiScenarioTestJob; import io.metersphere.job.sechedule.ApiScenarioTestJob;
import io.metersphere.job.sechedule.TestPlanTestJob;
import io.metersphere.service.ScheduleService; import io.metersphere.service.ScheduleService;
import io.metersphere.track.dto.TestPlanDTO; import io.metersphere.track.dto.TestPlanDTO;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest; import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
@ -630,8 +631,14 @@ public class ApiAutomationService {
} }
private void addOrUpdateApiScenarioCronJob(Schedule request) { private void addOrUpdateApiScenarioCronJob(Schedule request) {
scheduleService.addOrUpdateCronJob( if(StringUtils.equals(request.getGroup(),ScheduleGroup.TEST_PLAN_TEST.name())){
request, ApiScenarioTestJob.getJobKey(request.getResourceId()), ApiScenarioTestJob.getTriggerKey(request.getResourceId()), ApiScenarioTestJob.class); scheduleService.addOrUpdateCronJob(
request, TestPlanTestJob.getJobKey(request.getResourceId()), TestPlanTestJob.getTriggerKey(request.getResourceId()), TestPlanTestJob.class);
}else{
scheduleService.addOrUpdateCronJob(
request, ApiScenarioTestJob.getJobKey(request.getResourceId()), ApiScenarioTestJob.getTriggerKey(request.getResourceId()), ApiScenarioTestJob.class);
}
} }
public JmxInfoDTO genPerformanceTestJmx(RunScenarioRequest request) throws Exception { public JmxInfoDTO genPerformanceTestJmx(RunScenarioRequest request) throws Exception {