diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc index ebc9bcd357..3e19759338 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/quartz.adoc @@ -156,6 +156,7 @@ The following table describes the structure of the response: include::partial$rest/actuator/quartz/job-details/response-fields.adoc[] + [[quartz.trigger-job]] == Trigger Quartz Job On Demand @@ -170,6 +171,7 @@ The response will look similar to the following: include::partial$rest/actuator/quartz/trigger-job/http-response.adoc[] + [[quartz.trigger-job.request-structure]] === Request Structure @@ -190,6 +192,7 @@ The following table describes the structure of the response: include::partial$rest/actuator/quartz/trigger-job/response-fields.adoc[] + [[quartz.trigger]] == Retrieving Details of a Trigger diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java index be5cb27379..ea74c92e55 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/quartz/QuartzEndpoint.java @@ -223,7 +223,10 @@ public class QuartzEndpoint { * @since 3.5.0 */ public QuartzJobTriggerDescriptor triggerQuartzJob(String groupName, String jobName) throws SchedulerException { - JobKey jobKey = JobKey.jobKey(jobName, groupName); + return triggerQuartzJob(JobKey.jobKey(jobName, groupName)); + } + + private QuartzJobTriggerDescriptor triggerQuartzJob(JobKey jobKey) throws SchedulerException { JobDetail jobDetail = this.scheduler.getJobDetail(jobKey); if (jobDetail == null) { return null; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebIntegrationTests.java index 4a46fc0720..e206046ec5 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/quartz/QuartzEndpointWebIntegrationTests.java @@ -43,7 +43,6 @@ import org.quartz.TriggerBuilder; import org.quartz.TriggerKey; import org.quartz.impl.matchers.GroupMatcher; -import org.springframework.boot.actuate.endpoint.ApiVersion; import org.springframework.boot.actuate.endpoint.Show; import org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest; import org.springframework.context.annotation.Bean; @@ -65,10 +64,6 @@ import static org.mockito.Mockito.mock; */ class QuartzEndpointWebIntegrationTests { - private static final String V2_JSON = ApiVersion.V2.getProducedMimeType().toString(); - - private static final String V3_JSON = ApiVersion.V3.getProducedMimeType().toString(); - private static final JobDetail jobOne = JobBuilder.newJob(Job.class) .withIdentity("jobOne", "samples") .usingJobData(new JobDataMap(Collections.singletonMap("name", "test"))) @@ -261,49 +256,6 @@ class QuartzEndpointWebIntegrationTests { client.post() .uri("/actuator/quartz/jobs/samples/jobOne") .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON) - .bodyValue(Map.of("state", "running")) - .exchange() - .expectStatus() - .isOk() - .expectBody() - .jsonPath("group") - .isEqualTo("samples") - .jsonPath("name") - .isEqualTo("jobOne") - .jsonPath("className") - .isEqualTo("org.quartz.Job") - .jsonPath("triggerTime") - .isNotEmpty(); - } - - @WebEndpointTest - void quartzTriggerJobV2(WebTestClient client) { - client.post() - .uri("/actuator/quartz/jobs/samples/jobOne") - .contentType(MediaType.parseMediaType(V2_JSON)) - .accept(MediaType.APPLICATION_JSON) - .bodyValue(Map.of("state", "running")) - .exchange() - .expectStatus() - .isOk() - .expectBody() - .jsonPath("group") - .isEqualTo("samples") - .jsonPath("name") - .isEqualTo("jobOne") - .jsonPath("className") - .isEqualTo("org.quartz.Job") - .jsonPath("triggerTime") - .isNotEmpty(); - } - - @WebEndpointTest - void quartzTriggerJobV3(WebTestClient client) { - client.post() - .uri("/actuator/quartz/jobs/samples/jobOne") - .contentType(MediaType.parseMediaType(V3_JSON)) - .accept(MediaType.APPLICATION_JSON) .bodyValue(Map.of("state", "running")) .exchange() .expectStatus() @@ -334,8 +286,7 @@ class QuartzEndpointWebIntegrationTests { void quartzTriggerJobWithUnknownState(WebTestClient client) { client.post() .uri("/actuator/quartz/jobs/samples/jobOne") - .contentType(MediaType.parseMediaType(V3_JSON)) - .accept(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON) .bodyValue(Map.of("state", "unknown")) .exchange() .expectStatus()