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

Provide mechanism for managing resources across engines and executions #4252

Closed
wants to merge 57 commits into from

Conversation

YongGoose
Copy link
Contributor

Resolves #2816

Overview

  • Designing a class to manage context at the platform level
  • Adding a session-level store to LauncherSession
  • Adding a request-level store to Launcher
  • Exposing the request-level store in EngineDiscoveryRequest and TestPlan
  • Utilizing the request-level store in JupiterEngineExtensionContext

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


Definition of Done

@YongGoose YongGoose changed the title Feature/2816 Provide mechanism for managing resources across engines and executions Jan 19, 2025
sbrannen and others added 22 commits January 19, 2025 16:56
`Class.forName()` from `java.base/java.lang` has
already built-in support for type names matching:
- _Primitive arrays such as "[I", "[[[[D", etc._ and
- _Object arrays such as "[Ljava.lang.String;", etc._

This commit deletes the redundant implementation
from JUnit's internal `ReflectionUtils` helper.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added 2 commits January 23, 2025 12:14
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@@ -127,4 +129,5 @@ public interface Launcher {
@API(status = STABLE, since = "1.4")
void execute(TestPlan testPlan, TestExecutionListener... listeners);

NamespacedHierarchicalStore<Namespace> getStore(LauncherDiscoveryRequest launcherDiscoveryRequest);
Copy link
Member

Choose a reason for hiding this comment

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

What's the use case for this method? Test engines don't have access to the Launcher so we'll need to pass this store as part of LauncherDiscoveryRequest and ExecutionRequest, don't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I need to study a bit more.
I’ll make revisions and add comments by the end of the weekend!

renovate bot and others added 25 commits January 24, 2025 10:36
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…4266)

Prior to this commit, a `DisplayNameGenerator` could access the type of 
a `@Nested` test class  as well as the enclosing class in which a
`@Nested` test class is declared, but it could not access the concrete 
runtime type of the enclosing instance for a `@Nested` test class.

When a `DisplayNameGenerator` is used to build hierarchical display
names, this could lead to confusing results or even conflicting results 
depending on the structure of the test classes used, "conflicting" in
the sense that two nested test classes may have identical display names
that do not represent the runtime structure of the test classes.

Now, each `DisplayNameGenerator` receives the list of enclosing instance
types when computing the display name of a nested test class or test 
method.

Resolves junit-team#4130.

---------

Co-authored-by: Sam Brannen <[email protected]>
Make API consistent with `DisplayNameGenerator` prior to releasing it in
5.12.

Resolves junit-team#4163.

---------

Co-authored-by: Sam Brannen <[email protected]>
…team#4274)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…it-team#4279)

The `@TempDir` annotation on a constructor parameter is copied to the
generated `final` instance field. This caused it top be picked up by
`TempDirectory` for instance field injection which then failed because
the field was `final`. This change now checks if a test class is an
instance of a record type and skips instance field injection. Since
records cannot have any instance fields besides the ones generated from
their constructor, there's no need to inject values into any of them.
# Conflicts:
#	junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java
This reverts commit 4de6db8.
@YongGoose YongGoose closed this Jan 27, 2025
@YongGoose YongGoose deleted the feature/2816 branch January 27, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide mechanism for managing resources across engines and executions
4 participants