diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseScheduleService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseScheduleService.java index d4bb3f2b79..897c4cae53 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseScheduleService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseScheduleService.java @@ -48,6 +48,7 @@ public class BaseScheduleService { private final String API_SCENARIO_JOB = "io.metersphere.sechedule.ApiScenarioTestJob"; private final String API_SWAGGER_IMPORT_JOB = "io.metersphere.sechedule.SwaggerUrlImportJob"; + private final String TEST_PLAN_JOB = "io.metersphere.plan.job.TestPlanTestJob"; public void addSchedule(Schedule schedule) { schedule.setId(UUID.randomUUID().toString()); @@ -143,6 +144,7 @@ public class BaseScheduleService { switch (group) { case API_SCENARIO_TEST -> schedule.setJob(API_SCENARIO_JOB); case SWAGGER_IMPORT -> schedule.setJob(API_SWAGGER_IMPORT_JOB); + case TEST_PLAN_TEST -> schedule.setJob(TEST_PLAN_JOB); } } diff --git a/performance-test/backend/src/main/java/io/metersphere/job/sechedule/MsScheduleJob.java b/performance-test/backend/src/main/java/io/metersphere/job/sechedule/MsScheduleJob.java deleted file mode 100644 index 94cd1ffc22..0000000000 --- a/performance-test/backend/src/main/java/io/metersphere/job/sechedule/MsScheduleJob.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.metersphere.job.sechedule; - -import io.metersphere.commons.utils.LogUtil; -import org.quartz.*; - -public abstract class MsScheduleJob implements Job { - - protected String resourceId; - - protected String userId; - - protected String expression; - - @Override - public void execute(JobExecutionContext context) throws JobExecutionException { - - JobKey jobKey = context.getTrigger().getJobKey(); - JobDataMap jobDataMap = context.getJobDetail().getJobDataMap(); - this.resourceId = jobDataMap.getString("resourceId"); - this.userId = jobDataMap.getString("userId"); - this.expression = jobDataMap.getString("expression"); - - LogUtil.info(jobKey.getGroup() + " Running: " + resourceId); - LogUtil.info("CronExpression: " + expression); - businessExecute(context); - } - - abstract void businessExecute(JobExecutionContext context); -} diff --git a/performance-test/backend/src/main/java/io/metersphere/job/sechedule/PerformanceTestJob.java b/performance-test/backend/src/main/java/io/metersphere/job/sechedule/PerformanceTestJob.java index a97322e721..8a58e95442 100644 --- a/performance-test/backend/src/main/java/io/metersphere/job/sechedule/PerformanceTestJob.java +++ b/performance-test/backend/src/main/java/io/metersphere/job/sechedule/PerformanceTestJob.java @@ -4,6 +4,7 @@ import io.metersphere.commons.constants.ReportTriggerMode; import io.metersphere.commons.constants.ScheduleGroup; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.request.RunTestPlanRequest; +import io.metersphere.sechedule.MsScheduleJob; import io.metersphere.service.PerformanceTestService; import org.quartz.JobExecutionContext; import org.quartz.JobKey; @@ -18,7 +19,7 @@ public class PerformanceTestJob extends MsScheduleJob { } @Override - void businessExecute(JobExecutionContext context) { + protected void businessExecute(JobExecutionContext context) { RunTestPlanRequest request = new RunTestPlanRequest(); request.setId(resourceId); request.setUserId(userId);