GH-8901: Add MockIntContext.substituteTriggerFor
Fixes: #8901 Provide a convenient API `MockIntegrationContext.substituteTriggerFor(String pollingAdapterId, Trigger trigger)` to mitigate the time span which might be provided in the original configuration * Add `MockIntegrationContext.substituteTriggerFor(String pollingAdapterId, Trigger trigger)` * Refactor `MockIntegrationContext` for Java 17 code style * Change `MockIntegrationContext.beans` to `MultiValueMap` since we may replace several properties of the same endpoint * Modify `MockMessageSourceTests.testMockMessageSource()` to use new `substituteTriggerFor()`, too * Add Javadoc for the `OnlyOnceTrigger` * Document the new feature and mention it with correlation to `OnlyOnceTrigger`
This commit is contained in:
@@ -235,6 +235,12 @@ public void tearDown() {
|
||||
}
|
||||
----
|
||||
|
||||
Starting with version 6.3, the `MockIntegrationContext.substituteTriggerFor()` API has been introduced.
|
||||
This can be used to replace the real `Trigger` in the `AbstractPollingEndpoint`.
|
||||
For example the production configuration may rely on daily (or even weekly) cron schedule.
|
||||
Any custom `Trigger` can be injected into the target endpoint to mitigate the time span.
|
||||
For example, the mentioned above <<using-onlyoncetrigger, `OnlyOnceTrigger`>> suggests a behavior to schedule polling task immediately and do that only once.
|
||||
|
||||
See the https://docs.spring.io/spring-integration/api/org/springframework/integration/test/context/MockIntegrationContext.html[Javadoc] for more information.
|
||||
|
||||
[[testing-mocks]]
|
||||
|
||||
@@ -29,4 +29,10 @@ See xref:security.adoc[Security in Spring Integration] for more information.
|
||||
=== MQTT Support Changes
|
||||
|
||||
The fine-grained configuration based on `MqttSubscription` API is exposed on the `Mqttv5PahoMessageDrivenChannelAdapter`.
|
||||
See xref:mqtt.adoc[MQTT Support] for more information.
|
||||
See xref:mqtt.adoc[MQTT Support] for more information.
|
||||
|
||||
[[x6.3-testing]]
|
||||
=== Testing Support Changes
|
||||
|
||||
The `MockIntegrationContext.substituteTriggerFor()` API has been introduced.
|
||||
See xref:testing.adoc[Testing Support] for more information.
|
||||
Reference in New Issue
Block a user