Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider @SpringIntegrationTest #3679

Closed
garyrussell opened this issue Nov 16, 2021 · 0 comments · Fixed by #3792
Closed

Reconsider @SpringIntegrationTest #3679

garyrussell opened this issue Nov 16, 2021 · 0 comments · Fixed by #3792

Comments

@garyrussell
Copy link
Contributor

Perhaps create a JUnit5 condition to stop/start the specified endpoints instead of adding an IntegrationEndpointsInitializer to the context.

The current mechanism defeats the test context caching mechanism because each test class with @SpringIntegrationTest gets a different context customizer.

See #3674 (reply in thread) for more information.

@garyrussell garyrussell added this to the 6.0.x milestone Nov 16, 2021
artembilan added a commit to artembilan/spring-integration that referenced this issue May 5, 2022
Fixes spring-projects#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`
@artembilan artembilan modified the milestones: 6.0.x, 6.0 M3 May 5, 2022
artembilan added a commit to artembilan/spring-integration that referenced this issue May 6, 2022
Fixes spring-projects#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`
garyrussell pushed a commit that referenced this issue May 9, 2022
* GH-3679: Better caching for SpringIntegrationTest

Fixes #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 #3787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants