GH-3679: Better caching for SpringIntegrationTest (#3792)
* GH-3679: Better caching for SpringIntegrationTest Fixes https://github.com/spring-projects/spring-integration/issues/3679 The `@SpringIntegrationTest` makes a test cache key based on its attributes values when the same application context can be used in different test classes with different endpoints to have stopped originally. * Rework an `IntegrationEndpointsInitializer` to the `SpringIntegrationTestExecutionListener` which consult a `MockIntegrationContext` for endpoints to be started or not before the test execution and definitely stopped after the test execution to have a flexibility with the cached context * Improve a `MockIntegrationContext` to gather `AbstractEndpoint` beans and have them marked for stopping in the beginning of the application context. The `SpringIntegrationTestExecutionListener` takes care about startup in its `beforeTestClass()` * Verify different state for the `SpringIntegrationTest` with the `CachedSpringIntegrationTestAnnotationTests` * * Improve `SpringIntegrationTestExecutionListener` performance when no `@SpringIntegrationTest.noAutoStartup()` is configured * Fix `CachedSpringIntegrationTestAnnotationTests` check `isRunning()` for the endpoint under the testing instead of `isAutoStartup()` which is changed in one test class, but not other, and the order of their execution would matter * Migrate `MockMessageSourceTests` to JUnit 5 as a roadmap of the whole project * Fixes https://github.com/spring-projects/spring-integration/issues/3787
This commit is contained in:
@@ -196,7 +196,7 @@ First we configure our test class with a `@SpringIntegrationTest` annotation to
|
||||
====
|
||||
[source,java]
|
||||
----
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringJUnitConfig
|
||||
@SpringIntegrationTest(noAutoStartup = {"inboundChannelAdapter", "*Source*"})
|
||||
public class MyIntegrationTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user