Support programmatic registration of resource locks#3889
Merged
marcphilipp merged 30 commits intojunit-team:mainfrom Oct 7, 2024
vdmitrienko:#2677_add_exclusive_resource_programmatically
Merged
Support programmatic registration of resource locks#3889marcphilipp merged 30 commits intojunit-team:mainfrom vdmitrienko:#2677_add_exclusive_resource_programmatically
marcphilipp merged 30 commits intojunit-team:mainfrom
vdmitrienko:#2677_add_exclusive_resource_programmatically
Conversation
marcphilipp
requested changes
Aug 9, 2024
Member
marcphilipp
left a comment
There was a problem hiding this comment.
Looks very promising! Sorry for the late request to change the API.
Contributor
Author
|
Hi @marcphilipp |
marcphilipp
requested changes
Sep 18, 2024
Issue: #2677
Contributor
Author
Thank you! |
6 tasks
This was referenced Feb 24, 2025
This was referenced Mar 17, 2025
This was referenced Apr 14, 2025
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
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.
Solves: #2677
Overview
Introduce adding
shared resourcesprogrammatically via@ResourceLock(providers = ...)attributewhich accepts an array of one or more classes implementing
ResourceLocksProviderinterface.It allows to add resources in runtime (immediately before starting execution on the engine level).
Resources can be distributed based on any test class / nested test class / test method attributes (e.g. package name, class / method name etc.) or any other user logic.
This approach serves as a more flexible and less verbose alternative for cases in which:
@ResourceLock(value, mode)annotations manually may be inconvenient;I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@APIannotations