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

Add resource container selector resolver #3718

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

mpkorstanje
Copy link
Contributor

Overview

Resolve resource container selectors

As a follow up for #3630 and #3705 this adds a
addResourceContainerSelectorResolver()
method to EngineDiscoveryRequestResolver.Builder analogous to
addClassContainerSelectorResolver().

Points of note:

  • As classpath resources can be selected from packages, the package
    filter should also be applied. To make this possible the base path of
    a resource is rewritten to a package name prior to being filtered.

  • The ClasspathResourceSelector now has a getClasspathResource
    method. This method will lazily try to load the resource if not was
    not already provided when discovering resources in a container.

  • selectClasspathResource(Resource) was added to short circuit the
    need to resolve resources twice. And to make it possible to use
    this method as part of the public API,
    ReflectionSupport.tryToLoadResource was also added.


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


Definition of Done

As a follow up for junit-team#3630 and junit-team#3705 this adds a
`addResourceContainerSelectorResolver()`
method to `EngineDiscoveryRequestResolver.Builder` analogous to
`addClassContainerSelectorResolver()`.

Points of note:

 * As classpath resources can be selected from packages, the package
   filter should also be applied. To make this possible the base path of
   a resource is rewritten to a package name prior to being filtered.

 * The `ClasspathResourceSelector` now has a `getClasspathResource`
   method. This method will lazily try to load the resource if not was
   not already provided when discovering resources in a container.

 * `selectClasspathResource(Resource)` was added to short circuit the
    need to resolve resources twice. And to make it possible to use
    this method as part of the public API,
    `ReflectionSupport.tryToLoadResource` was also added.
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.

None yet

1 participant