-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Inject core services directly into Maven 4 Mojos; add opt-in real-session testing (#11055) #11103
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d154847 to
a4fd04c
Compare
…ession mojo testing Highlights - All services are injectable into mojos - Add InternalSession#getAllServices() to expose all DI service suppliers for the session (Map<Class<? extends Service>, Supplier<? extends Service>>) - Add Injector#bindSupplier(Class<T>, Supplier<T>) to bind a type directly to a Supplier - Adjust DI bootstrap/bindings (Injector/Binding/InjectorImpl, SisuDiBridgeModule) and touch minor call sites to respect the wiring - Mojos can be easily tested with a real session - @MojoTest(realSession=true) supported by MojoExtension; creates a real InternalSession via ApiRunner, otherwise uses SessionMock - New MojoRealSessionTest covers default/custom mock vs real-session paths Details - SessionScope alignment: when @typed is empty, include only the class’s direct interfaces (not super-interfaces) - Testing support: SecDispatcherProvider for encrypted password handling without Sonatype dispatcher; expanded MojoTest for evaluator coverage - IT: add apachegh-11055-di-service-injection verifying DI service injection end-to-end with pre-populated resources under its/core-it-suite; integrated into TestSuiteOrdering
f9a6f77 to
004cfd1
Compare
gnodet
added a commit
to gnodet/maven
that referenced
this pull request
Sep 17, 2025
…ession mojo testing (apache#11103) Highlights - All services are injectable into mojos - Add InternalSession#getAllServices() to expose all DI service suppliers for the session (Map<Class<? extends Service>, Supplier<? extends Service>>) - Add Injector#bindSupplier(Class<T>, Supplier<T>) to bind a type directly to a Supplier - Adjust DI bootstrap/bindings (Injector/Binding/InjectorImpl, SisuDiBridgeModule) and touch minor call sites to respect the wiring - Mojos can be easily tested with a real session - @MojoTest(realSession=true) supported by MojoExtension; creates a real InternalSession via ApiRunner, otherwise uses SessionMock - New MojoRealSessionTest covers default/custom mock vs real-session paths Details - SessionScope alignment: when @typed is empty, include only the class’s direct interfaces (not super-interfaces) - Testing support: SecDispatcherProvider for encrypted password handling without Sonatype dispatcher; expanded MojoTest for evaluator coverage - IT: add apachegh-11055-di-service-injection verifying DI service injection end-to-end with pre-populated resources under its/core-it-suite; integrated into TestSuiteOrdering (cherry picked from commit 6b7c9f2)
Contributor
Author
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
gnodet
added a commit
to gnodet/maven
that referenced
this pull request
Sep 18, 2025
…ession mojo testing (apache#11103) Highlights - All services are injectable into mojos - Add InternalSession#getAllServices() to expose all DI service suppliers for the session (Map<Class<? extends Service>, Supplier<? extends Service>>) - Add Injector#bindSupplier(Class<T>, Supplier<T>) to bind a type directly to a Supplier - Adjust DI bootstrap/bindings (Injector/Binding/InjectorImpl, SisuDiBridgeModule) and touch minor call sites to respect the wiring - Mojos can be easily tested with a real session - @MojoTest(realSession=true) supported by MojoExtension; creates a real InternalSession via ApiRunner, otherwise uses SessionMock - New MojoRealSessionTest covers default/custom mock vs real-session paths Details - SessionScope alignment: when @typed is empty, include only the class’s direct interfaces (not super-interfaces) - Testing support: SecDispatcherProvider for encrypted password handling without Sonatype dispatcher; expanded MojoTest for evaluator coverage - IT: add apachegh-11055-di-service-injection verifying DI service injection end-to-end with pre-populated resources under its/core-it-suite; integrated into TestSuiteOrdering (cherry picked from commit 6b7c9f2)
gnodet
added a commit
that referenced
this pull request
Sep 22, 2025
… mojo testing (#11103) (#11139) Highlights - All services are injectable into mojos - Add InternalSession#getAllServices() to expose all DI service suppliers for the session (Map<Class<? extends Service>, Supplier<? extends Service>>) - Add Injector#bindSupplier(Class<T>, Supplier<T>) to bind a type directly to a Supplier - Adjust DI bootstrap/bindings (Injector/Binding/InjectorImpl, SisuDiBridgeModule) and touch minor call sites to respect the wiring - Mojos can be easily tested with a real session - @MojoTest(realSession=true) supported by MojoExtension; creates a real InternalSession via ApiRunner, otherwise uses SessionMock - New MojoRealSessionTest covers default/custom mock vs real-session paths Details - SessionScope alignment: when @typed is empty, include only the class’s direct interfaces (not super-interfaces) - Testing support: SecDispatcherProvider for encrypted password handling without Sonatype dispatcher; expanded MojoTest for evaluator coverage - IT: add gh-11055-di-service-injection verifying DI service injection end-to-end with pre-populated resources under its/core-it-suite; integrated into TestSuiteOrdering (cherry picked from commit 6b7c9f2)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Why
What changed (highlights)
Key implementation details
Backward compatibility and risks
Tests
How to use (examples)
Notes for reviewers
Follow-ups