See gh-44148

Signed-off-by: Johnny Lim <izeye@naver.com>
This commit is contained in:
Johnny Lim 2025-02-07 00:15:25 +09:00 committed by Moritz Halbritter
parent 1e73a7cf8b
commit c335f772d0
11 changed files with 28 additions and 17 deletions

View File

@ -176,7 +176,7 @@ include::partial$rest/actuator/quartz/trigger-job/http-response.adoc[]
=== Request Structure === Request Structure
The request specifies a desired `state` associated with a particular job. The request specifies a desired `state` associated with a particular job.
Sending an HTTP Request with a `"state": "running"` body indicates that the job should be run now. Sending an HTTP request with a `"state": "running"` body indicates that the job should be run now.
The following table describes the structure of the request: The following table describes the structure of the request:
[cols="2,1,3"] [cols="2,1,3"]

View File

@ -64,7 +64,7 @@
}, },
{ {
"name": "management.endpoints.access.max-permitted", "name": "management.endpoints.access.max-permitted",
"description": "The maximum level of endpoint access that is permitted. Caps an endpoint's individual access level (management.endpoint.<id>.access) and the default access (management.endpoints.access.default).'", "description": "Maximum level of endpoint access that is permitted. Caps an endpoint's individual access level (management.endpoint.<id>.access) and the default access (management.endpoints.access.default).'",
"defaultValue": "unrestricted" "defaultValue": "unrestricted"
}, },
{ {
@ -2107,7 +2107,7 @@
}, },
{ {
"name": "management.server.ssl.bundle", "name": "management.server.ssl.bundle",
"description": "The name of a configured SSL bundle." "description": "Name of a configured SSL bundle."
}, },
{ {
"name": "management.server.ssl.certificate", "name": "management.server.ssl.certificate",

View File

@ -409,7 +409,9 @@ public class QuartzEndpoint {
} }
/** /**
* Description of a triggered on demand {@link Job Quartz Job}. * Description of a triggered on-demand {@link Job Quartz Job}.
*
* @since 3.5.0
*/ */
public static final class QuartzJobTriggerDescriptor { public static final class QuartzJobTriggerDescriptor {

View File

@ -80,6 +80,16 @@ public class QuartzEndpointWebExtension {
() -> this.delegate.quartzTrigger(group, name, showUnsanitized)); () -> this.delegate.quartzTrigger(group, name, showUnsanitized));
} }
/**
* Trigger a Quartz job.
* @param jobs path segment "jobs"
* @param group job's group
* @param name job name
* @param state desired state
* @return web endpoint response
* @throws SchedulerException if there is an error triggering the job
* @since 3.5.0
*/
@WriteOperation @WriteOperation
public WebEndpointResponse<Object> triggerQuartzJob(@Selector String jobs, @Selector String group, public WebEndpointResponse<Object> triggerQuartzJob(@Selector String jobs, @Selector String group,
@Selector String name, String state) throws SchedulerException { @Selector String name, String state) throws SchedulerException {

View File

@ -778,7 +778,7 @@ class QuartzEndpointTests {
} }
@Test @Test
void quartzJobShouldNotBeTriggeredJobDoesNotExist() throws SchedulerException { void quartzJobShouldNotBeTriggeredWhenJobDoesNotExist() throws SchedulerException {
QuartzJobTriggerDescriptor quartzJobTriggerDescriptor = this.endpoint.triggerQuartzJob("samples", "hello"); QuartzJobTriggerDescriptor quartzJobTriggerDescriptor = this.endpoint.triggerQuartzJob("samples", "hello");
assertThat(quartzJobTriggerDescriptor).isNull(); assertThat(quartzJobTriggerDescriptor).isNull();
then(this.scheduler).should(never()).triggerJob(any()); then(this.scheduler).should(never()).triggerJob(any());

View File

@ -26,7 +26,7 @@ import org.springframework.context.annotation.Conditional;
/** /**
* Container annotation that aggregates several * Container annotation that aggregates several
* {@link ConditionalOnProperty @ConditionalOnProperty} annotations. * {@link ConditionalOnBooleanProperty @ConditionalOnBooleanProperty} annotations.
* *
* @author Phillip Webb * @author Phillip Webb
* @since 3.5.0 * @since 3.5.0

View File

@ -89,8 +89,8 @@ class OnPropertyCondition extends SpringBootCondition {
} }
private Stream<MergedAnnotation<Annotation>> stream(MergedAnnotations annotations, private Stream<MergedAnnotation<Annotation>> stream(MergedAnnotations annotations,
Class<? extends Annotation> containerType) { Class<? extends Annotation> type) {
return annotations.stream(containerType.getName()) return annotations.stream(type.getName())
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes)); .filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes));
} }

View File

@ -269,7 +269,7 @@
}, },
{ {
"name": "server.ssl.bundle", "name": "server.ssl.bundle",
"description": "The name of a configured SSL bundle." "description": "Name of a configured SSL bundle."
}, },
{ {
"name": "server.ssl.certificate", "name": "server.ssl.certificate",
@ -2606,7 +2606,7 @@
}, },
{ {
"name": "spring.rsocket.server.ssl.bundle", "name": "spring.rsocket.server.ssl.bundle",
"description": "The name of a configured SSL bundle." "description": "Name of a configured SSL bundle."
}, },
{ {
"name": "spring.rsocket.server.ssl.certificate", "name": "spring.rsocket.server.ssl.certificate",

View File

@ -35,7 +35,6 @@ import org.assertj.core.api.InstanceOfAssertFactories;
import org.assertj.core.api.InstanceOfAssertFactory; import org.assertj.core.api.InstanceOfAssertFactory;
import org.assertj.core.api.ObjectAssert; import org.assertj.core.api.ObjectAssert;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCreationException;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
@ -48,7 +47,6 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.r2dbc.core.DatabaseClient; import org.springframework.r2dbc.core.DatabaseClient;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -98,9 +96,10 @@ class R2dbcAutoConfigurationTests {
assertThat(poolMetrics.getMaxAllocatedSize()).isEqualTo(15); assertThat(poolMetrics.getMaxAllocatedSize()).isEqualTo(15);
assertThat(connectionPool).hasFieldOrPropertyWithValue("maxAcquireTime", Duration.ofMinutes(3)); assertThat(connectionPool).hasFieldOrPropertyWithValue("maxAcquireTime", Duration.ofMinutes(3));
assertThat(connectionPool).hasFieldOrPropertyWithValue("maxValidationTime", Duration.ofSeconds(1)); assertThat(connectionPool).hasFieldOrPropertyWithValue("maxValidationTime", Duration.ofSeconds(1));
Mono<?> create = (Mono<?>) ReflectionTestUtils.getField(connectionPool, "create"); assertThat(connectionPool).extracting("create").satisfies((mono) -> {
assertThat(create.getClass().getName()).endsWith("MonoRetry"); assertThat(mono.getClass().getName()).endsWith("MonoRetry");
assertThat(create).hasFieldOrPropertyWithValue("times", 5L); assertThat(mono).hasFieldOrPropertyWithValue("times", 5L);
});
} }
finally { finally {
connectionPool.close().block(); connectionPool.close().block();

View File

@ -642,7 +642,7 @@ logging:
---- ----
TIP: For more advanced customizations, you can use the javadoc:org.springframework.boot.logging.structured.StructuredLoggingJsonMembersCustomizer[] interface. TIP: For more advanced customizations, you can use the javadoc:org.springframework.boot.logging.structured.StructuredLoggingJsonMembersCustomizer[] interface.
You can reference a one or more implementations using the configprop:logging.structured.json.customizer[] property. You can reference one or more implementations using the configprop:logging.structured.json.customizer[] property.
You can also declare implementations by listing them in a `META-INF/spring.factories` file. You can also declare implementations by listing them in a `META-INF/spring.factories` file.

View File

@ -34,7 +34,7 @@ import static org.mockito.Mockito.mock;
class FixedTrustManagerFactoryTests { class FixedTrustManagerFactoryTests {
@Test @Test
void shouldReturnTrustmanagers() throws Exception { void shouldReturnTrustManagers() throws Exception {
TrustManager trustManager1 = mock(TrustManager.class); TrustManager trustManager1 = mock(TrustManager.class);
TrustManager trustManager2 = mock(TrustManager.class); TrustManager trustManager2 = mock(TrustManager.class);
FixedTrustManagerFactory factory = FixedTrustManagerFactory.of(getDefaultTrustManagerFactory(), trustManager1, FixedTrustManagerFactory factory = FixedTrustManagerFactory.of(getDefaultTrustManagerFactory(), trustManager1,