GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support programmatic registration of resource locks by vdmitrienko · Pull Request #3889 · junit-team/junit-framework

Conversation

@vdmitrienko

@vdmitrienko vdmitrienko commented Jul 16, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Solves: #2677

Overview

Introduce adding shared resources programmatically via @ResourceLock(providers = ...) attribute
which accepts an array of one or more classes implementing ResourceLocksProvider interface.

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:

  • adding lots of @ResourceLock(value, mode) annotations manually may be inconvenient;
  • shared resources are not known until runtime.

I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

  • There are no TODOs left in the code
  • Method preconditions are checked and documented in the method's Javadoc
  • Coding conventions (e.g. for logging) have been followed
  • Change is covered by automated tests including corner cases, errors, and exception handling
  • Public API has Javadoc and @API annotations
  • Change is documented in the User Guide
  • Change is documented in the Release Notes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vdmitrienko vdmitrienko mentioned this pull request Jul 16, 2024
Support programmatic registration of resource locks #2677
Closed
@vdmitrienko
vdmitrienko marked this pull request as draft July 17, 2024 06:39
@vdmitrienko vdmitrienko changed the title Draft: Implement adding ExclusiveResource programmatically. Implement adding ExclusiveResource programmatically. Jul 17, 2024
@vdmitrienko vdmitrienko changed the title Implement adding ExclusiveResource programmatically. Introduce adding 'shared resources' programmatically Aug 6, 2024
@vdmitrienko
vdmitrienko marked this pull request as ready for review August 8, 2024 06:52
vdmitrienko added 6 commits August 8, 2024 10:03
@vdmitrienko
Introduce adding 'resource locks' programmatically.
7fc2b96
Issue: #2677
@vdmitrienko
Add 'ResourceLocksProviderIntegrationTests'.
cde4bc8
Issue: #2677
@vdmitrienko
Add JavaDoc.
00788b6
Issue: #2677
@vdmitrienko
Add 'locks from provider' cases to 'NodeTreeWalkerIntegrationTests'.
ff3c786
Issue: #2677
@vdmitrienko
Add 'LockTests'.
1c6eef8
Issue: #2677
@vdmitrienko
Add user guide.
7d894c5
Issue: #2677
@marcphilipp marcphilipp linked an issue Aug 9, 2024 that may be closed by this pull request
Support programmatic registration of resource locks #2677
Closed
marcphilipp
marcphilipp requested changes Aug 9, 2024
View reviewed changes

@marcphilipp marcphilipp left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very promising! Sorry for the late request to change the API.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vdmitrienko reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksFrom.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/docs/asciidoc/user-guide/writing-tests.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

vdmitrienko added 5 commits August 12, 2024 22:42
@vdmitrienko
Revert "Add 'locks from provider' cases to 'NodeTreeWalkerIntegration…
1f8a6d0
…Tests'."

This reverts commit ff3c786.

Issue: #2677
@vdmitrienko
Move '@ResourceLocksFrom' functionality to '@ResourceLock'.
e1b5473
Issue: #2677
@vdmitrienko
Add tests for '@ResourceLock' and 'ResourceLocksProvider'.
4460685
Issue: #2677
@vdmitrienko
Merge branch 'main' of https://github.com/VladimirDmitrienko/junit5 i…
e14bfda
…nto #2677_add_exclusive_resource_programmatically
@vdmitrienko
Fix formatting.
ba476e5
Issue: #2677
@vdmitrienko
vdmitrienko requested a review from marcphilipp August 16, 2024 10:49
@vdmitrienko

vdmitrienko commented Sep 2, 2024

Copy link
Copy Markdown
Contributor Author

Hi @marcphilipp
Maybe you have any updates regarding this PR?

marcphilipp reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marcphilipp
Polish Javadoc
1d8488c
marcphilipp
marcphilipp requested changes Sep 18, 2024
View reviewed changes
Comment thread ...-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/docs/asciidoc/user-guide/writing-tests.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/docs/asciidoc/user-guide/writing-tests.adoc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...iter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

vdmitrienko added 8 commits September 20, 2024 09:13
@vdmitrienko
Merge branch 'refs/heads/main' into #2677_add_exclusive_resource_prog…
3fddd55
…rammatically
@vdmitrienko
Merge branch 'refs/heads/main' into #2677_add_exclusive_resource_prog…
49f9a28
…rammatically
@vdmitrienko
Remove version from User Guide.
d56196d
Issue: #2677
@vdmitrienko
Revert formatting changes in User Guide.
c8d26ef
Issue: #2677
@vdmitrienko
Mention that ResourceLocksProvider must have a no-args constructor.
9383c39
Issue: #2677
@vdmitrienko
Avoid searching for the annotation twice.
249ab3e
Issue: #2677
@vdmitrienko
Polish DynamicSharedResourcesDemo.
67e7dc5
Issue: #2677
@vdmitrienko
Add Release Notes.
792b43a
Issue: #2677
marcphilipp added 4 commits October 7, 2024 10:23
@marcphilipp
Apply suggestions from code review
fed909b
@marcphilipp
Polish Javadoc
826fb0f
@marcphilipp
Remove unused imports
dc6b2a9
@marcphilipp
Polish code snippet
a728b5b
@vdmitrienko

vdmitrienko commented Oct 7, 2024

Copy link
Copy Markdown
Contributor Author

Thanks! I'll take it from here.

Thank you!
This was my first contribution, and it was very interesting and valuable experience.

marcphilipp reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marcphilipp marcphilipp changed the title Introduce adding 'shared resources' programmatically Allow determining exclusive resources programmatically Oct 7, 2024
@marcphilipp
marcphilipp merged commit 8e9094d into junit-team:main Oct 7, 2024
@vdmitrienko vdmitrienko mentioned this pull request Nov 23, 2024
Allow declaring exclusive resources for child nodes #4151
Merged
6 tasks done
@sbrannen sbrannen changed the title Allow determining exclusive resources programmatically Support programmatic registration of resource locks Jan 26, 2025
@sbrannen sbrannen added type: enhancement theme: extensions theme: concurrency component: Jupiter labels Jan 26, 2025
This was referenced Feb 24, 2025
Bump junit from 5.11.4 to 5.12.0 kousen/java_8_recipes#125
Closed
Bump junit from 5.11.4 to 5.12.0 kousen/IntroGroovy#128
Closed
Bump junit from 5.11.4 to 5.12.0 kousen/junit5_workshop#251
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/http-client-demo#43
Merged
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/functional_modern_java#31
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/java_upgrade#44
Merged
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.0 kousen/java_9_recipes#45
Closed
Bump junit from 5.11.4 to 5.12.0 kousen/java_groovy_kotlin#194
Merged
This was referenced Mar 17, 2025
Bump junit from 5.11.4 to 5.12.1 kousen/java_8_recipes#127
Closed
Bump junit from 5.11.4 to 5.12.1 kousen/IntroGroovy#130
Closed
Bump junit from 5.11.4 to 5.12.1 kousen/junit5_workshop#254
Merged
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.1 kousen/java_9_recipes#46
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.1 kousen/functional_modern_java#32
Closed
This was referenced Apr 14, 2025
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.2 kousen/java_9_recipes#47
Closed
Bump org.junit.jupiter:junit-jupiter from 5.11.4 to 5.12.2 kousen/functional_modern_java#33
Closed
Bump junit from 5.11.4 to 5.12.2 kousen/java_8_recipes#131
Closed
Bump junit from 5.11.4 to 5.12.2 kousen/IntroGroovy#132
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@marcphilipp marcphilipp marcphilipp approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

component: Jupiter theme: concurrency theme: extensions type: enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Support programmatic registration of resource locks

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vdmitrienko @marcphilipp @sbrannen
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.