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

Merged
Merged
Changes from 2 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
02ef108
Support scanning for class path resources
mpkorstanje Jan 9, 2024
2f76493
Formatting
mpkorstanje Feb 25, 2024
277272a
Doc
mpkorstanje Feb 25, 2024
f683deb
Fix
mpkorstanje Feb 25, 2024
c457b58
Clean up todos
mpkorstanje Feb 29, 2024
c9b3b0e
Clean up todos
mpkorstanje Feb 29, 2024
e5a1751
Clean up
mpkorstanje Mar 7, 2024
2bab069
Extract common code in findClassesForPath and findResourcesForPath
mpkorstanje Mar 7, 2024
f34c4c9
Extract common file visitor code
mpkorstanje Mar 7, 2024
c84ad5e
Docs
mpkorstanje Mar 7, 2024
e43258e
Tests
mpkorstanje Mar 7, 2024
c374b93
Spotless
mpkorstanje Mar 7, 2024
440e0e7
Merge remote-tracking branch 'origin/main' into support-classpath-res…
mpkorstanje Mar 7, 2024
6cca62a
Update CHANGELOG
mpkorstanje Mar 7, 2024
704e584
Update CHANGELOG
mpkorstanje Mar 7, 2024
9cbc960
Resolve resource container selectors
mpkorstanje Mar 7, 2024
ee72ba6
Remove resource package filter predicate
mpkorstanje Jun 13, 2024
9f99477
Remove resource name filter predicate
mpkorstanje Jun 13, 2024
2df5201
Clean up to do.
mpkorstanje Jun 13, 2024
862cb3b
Merge remote-tracking branch 'origin/main' into support-classpath-res…
mpkorstanje Jun 13, 2024
16a6476
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 13, 2024
5a39b83
Fix typo
mpkorstanje Jun 14, 2024
f5d892b
Replace resource filter with predicate
mpkorstanje Jun 14, 2024
4e277fa
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 14, 2024
6e95eeb
Revert "Replace resource filter with predicate"
mpkorstanje Jun 14, 2024
e59cc59
Revert "Remove resource name filter predicate"
mpkorstanje Jun 14, 2024
767dcf4
Load canonical resources through classloader
mpkorstanje Jun 14, 2024
aa349d3
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 14, 2024
5348738
Touch up
mpkorstanje Jun 14, 2024
94215bc
Touch up
mpkorstanje Jun 14, 2024
fe491a1
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 14, 2024
794793a
Correctly resolve shadowed resources
mpkorstanje Jun 14, 2024
5a96e82
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 14, 2024
c0f1c3a
Fix formatting
mpkorstanje Jun 14, 2024
6676283
Remove spurious whitespace changes
mpkorstanje Jun 14, 2024
ac77e69
Fixup changelog
mpkorstanje Jun 14, 2024
e9ae1ca
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 14, 2024
16edf0d
Fix imports
mpkorstanje Jun 14, 2024
c18dfb9
Update changelog
mpkorstanje Jun 14, 2024
0b59daf
Touch up javadoc
mpkorstanje Jun 14, 2024
79f13bf
Fix up java doc
mpkorstanje Jun 14, 2024
20dad6c
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 14, 2024
46659cd
Fix formatting
mpkorstanje Jun 14, 2024
2355b7c
Fix check style
mpkorstanje Jun 14, 2024
cdeb3ea
Merge remote-tracking branch 'origin/main' into support-classpath-res…
mpkorstanje Jun 14, 2024
5e24284
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 14, 2024
d200e23
Fix typo
mpkorstanje Jun 14, 2024
966e21f
Fix tryToLoadResource
mpkorstanje Jun 15, 2024
930ba5b
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 15, 2024
358693f
Wrap class loader call in try
mpkorstanje Jun 15, 2024
cc5efbd
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 15, 2024
e1220bd
Simplify tryToLoadResource tests
mpkorstanje Jun 15, 2024
917f004
Add more tryToLoadResource tests
mpkorstanje Jun 15, 2024
9d610da
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 15, 2024
4ab3cf8
Touchups
mpkorstanje Jun 15, 2024
ca1f81b
Touchups
mpkorstanje Jun 15, 2024
851a35e
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 15, 2024
59705ba
Merge remote-tracking branch 'origin/main' into support-classpath-res…
mpkorstanje Jun 15, 2024
318d14c
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 15, 2024
7ffff49
Remove unnesesary try-catch
mpkorstanje Jun 15, 2024
8099873
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 15, 2024
2144abe
Add more reflection support tests
mpkorstanje Jun 15, 2024
016e28f
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 15, 2024
27c0750
Merge branch 'main' into support-classpath-resources-scanning
mpkorstanje Jun 17, 2024
efe76e7
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 17, 2024
52e5884
Merge remote-tracking branch 'origin/main' into support-classpath-res…
mpkorstanje Jun 26, 2024
c3e5a96
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jun 26, 2024
6cbebf0
Work in progress
mpkorstanje Jul 8, 2024
4802bb5
Work in progressg
mpkorstanje Jul 8, 2024
7df46a3
Find all available resources, including duplicates
mpkorstanje Jul 8, 2024
1a0d673
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jul 8, 2024
ee7b42a
Remove unused tryToLoadResource
mpkorstanje Jul 8, 2024
c0c9ee6
Suppress warnings
mpkorstanje Jul 8, 2024
8621935
Remove resourceNameFilter predicate from Javadoc
marcphilipp Jul 9, 2024
3a14696
Add test for finding duplicate resources
marcphilipp Jul 9, 2024
3f348b3
Merge branch 'main' into support-classpath-resources-scanning
marcphilipp Jul 9, 2024
12da7db
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jul 12, 2024
e8ef19a
Rename tryToLoadResource to tryToGetResource
mpkorstanje Jul 12, 2024
3ffeb59
Polish docs for tryToGetResource
mpkorstanje Jul 12, 2024
ba7cd1e
Rename ResourceFilter to ResourceUtils and add docs
mpkorstanje Jul 12, 2024
6817ec9
Docs and naming
mpkorstanje Jul 12, 2024
27c3671
Add note about resources on the module path
mpkorstanje Jul 12, 2024
c72537d
Log and ignore failures to get resource
mpkorstanje Jul 12, 2024
b826b32
Clean up unused import
mpkorstanje Jul 12, 2024
faaaab8
Merge branch 'support-classpath-resources-scanning' into add-resource…
mpkorstanje Jul 12, 2024
a84b5ae
Merge remote-tracking branch 'origin/main' into add-resource-containe…
mpkorstanje Aug 27, 2024
cb75366
Update since version numbers to 1.12
mpkorstanje Aug 27, 2024
9d9e1fb
Support multiple resources per selector
mpkorstanje Aug 27, 2024
9e536be
Fix pluralization
mpkorstanje Aug 27, 2024
d507767
Ensure resource selectors can be equaled
mpkorstanje Aug 27, 2024
753a891
Fix doc reference
mpkorstanje Aug 27, 2024
d5ec2c5
Fix doc reference
mpkorstanje Aug 27, 2024
85b368b
Fix compile
mpkorstanje Aug 27, 2024
9b32549
Fix coverage
mpkorstanje Aug 27, 2024
6762e06
Fix doc
mpkorstanje Aug 27, 2024
f4f7acf
Fix spotless
mpkorstanje Aug 27, 2024
527672a
Fix tests
mpkorstanje Aug 27, 2024
b65e680
Drop TODO
mpkorstanje Aug 27, 2024
f990a83
Update release notes
mpkorstanje Aug 27, 2024
9a5b68b
Polishing
mpkorstanje Sep 1, 2024
2fb76cb
Merge branch 'main' into add-resource-container-selector-resolver
mpkorstanje Sep 1, 2024
baf861c
Polishing
mpkorstanje Sep 1, 2024
f0f1100
Merge remote-tracking branch 'origin/main' into add-resource-containe…
mpkorstanje Sep 22, 2024
0627ca3
Merge branch 'main' into add-resource-container-selector-resolver
mpkorstanje Sep 26, 2024
8da0a4a
Merge remote-tracking branch 'origin/main' into add-resource-containe…
mpkorstanje Oct 10, 2024
05f1bf4
Merge remote-tracking branch 'origin/main' into add-resource-containe…
mpkorstanje Oct 17, 2024
2c49146
Pull up could not load resource(s) exception
mpkorstanje Oct 17, 2024
e9e1ade
Do not included cached values in hashcode and equals
mpkorstanje Oct 17, 2024
23871b4
Update junit-platform-engine/src/main/java/org/junit/platform/engine/…
mpkorstanje Oct 28, 2024
75506f1
Update documentation/src/docs/asciidoc/release-notes/release-notes-5.…
mpkorstanje Oct 28, 2024
1d13082
Merge resource predicates
mpkorstanje Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@ page in the Wiki.
actual type and value in addition to the required type.
* Updated `open-test-reporting` dependency to `0.1.0-M2`.


[[release-notes-5.11.0-M1-junit-jupiter]]
=== JUnit Jupiter

Original file line number Diff line number Diff line change
@@ -191,6 +191,7 @@ public static List<Class<?>> findAllClassesInClasspathRoot(URI root, Predicate<C
* @param resourceNameFilter the resource name filter; never {@code null}
* @return an immutable list of all such resources found; never {@code null}
* but potentially empty
* @since 1.11
* @see #findAllResourcesInPackage(String, Predicate, Predicate)
* @see #findAllResourcesInModule(String, Predicate, Predicate)
*/
@@ -240,7 +241,7 @@ public static Stream<Class<?>> streamAllClassesInClasspathRoot(URI root, Predica
* @param resourceNameFilter the resources name filter; never {@code null}
* @return a stream of all such classes found; never {@code null}
* but potentially empty
* @since 1.10
* @since 1.11
* @see #streamAllResourcesInPackage(String, Predicate, Predicate)
* @see #streamAllResourcesInModule(String, Predicate, Predicate)
*/
@@ -290,6 +291,7 @@ public static List<Class<?>> findAllClassesInPackage(String basePackageName, Pre
* @param resourceNameFilter the resource name filter; never {@code null}
* @return an immutable list of all such classes found; never {@code null}
* but potentially empty
* @since 1.11
* @see #findAllResourcesInClasspathRoot(URI, Predicate, Predicate)
* @see #findAllResourcesInModule(String, Predicate, Predicate)
*/
@@ -341,7 +343,7 @@ public static Stream<Class<?>> streamAllClassesInPackage(String basePackageName,
* @param resourceNameFilter the resource name filter; never {@code null}
* @return a stream of all such resources found; never {@code null}
* but potentially empty
* @since 1.10
* @since 1.11
* @see #streamAllResourcesInClasspathRoot(URI, Predicate, Predicate)
* @see #streamAllResourcesInModule(String, Predicate, Predicate)
*/
@@ -390,7 +392,7 @@ public static List<Class<?>> findAllClassesInModule(String moduleName, Predicate
* @param resourceNameFilter the resource name filter; never {@code null}
* @return an immutable list of all such resources found; never {@code null}
* but potentially empty
* @since 1.1.1
* @since 1.11
* @see #findAllResourcesInClasspathRoot(URI, Predicate, Predicate)
* @see #findAllResourcesInPackage(String, Predicate, Predicate)
*/
@@ -440,7 +442,7 @@ public static Stream<Class<?>> streamAllClassesInModule(String moduleName, Predi
* @param resourceNameFilter the resource name filter; never {@code null}
* @return a stream of all such resources found; never {@code null}
* but potentially empty
* @since 1.10
* @since 1.11
* @see #streamAllResourcesInClasspathRoot(URI, Predicate, Predicate)
* @see #streamAllResourcesInPackage(String, Predicate, Predicate)
*/
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

/**
* Represents a resource on the classpath.
*
* @since 1.11
* @see ReflectionSupport#findAllResourcesInClasspathRoot(URI, Predicate, Predicate)
* @see ReflectionSupport#findAllResourcesInPackage(String, Predicate, Predicate)
* @see ReflectionSupport#findAllResourcesInModule(String, Predicate, Predicate)
Original file line number Diff line number Diff line change
@@ -106,6 +106,7 @@ public static List<Class<?>> findAllClassesInModule(String moduleName, ClassFilt
* @param filter the class filter to apply; never {@code null}
* @return an immutable list of all such resources found; never {@code null}
* but potentially empty
* @since 1.11
*/
@API(status = INTERNAL, since = "1.11")
public static List<Resource> findAllResourcesInModule(String moduleName, ResourceFilter filter) {
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ public static List<Class<?>> findAllClassesInModule(String moduleName, ClassFilt
* @param filter the class filter to apply; never {@code null}
* @return an immutable list of all such resources found; never {@code null}
* but potentially empty
* @since 1.11
*/
@API(status = INTERNAL, since = "1.11")
public static List<Resource> findAllResourcesInModule(String moduleName, ResourceFilter filter) {
Original file line number Diff line number Diff line change
@@ -241,9 +241,10 @@ void scanForResourcesInShadowedClassPathRoot() throws Exception {

var resources = classpathScanner.scanForResourcesInClasspathRoot(shadowedJarFile.toURI(), allResources);
assertThat(resources).extracting(Resource::getName).containsExactlyInAnyOrder(
"org/junit/platform/jartest/included/unique.resource",
"org/junit/platform/jartest/included/included.resource",
"org/junit/platform/jartest/included/recursive/recursively-included.resource", "META-INF/MANIFEST.MF");
"org/junit/platform/jartest/included/unique.resource", //
"org/junit/platform/jartest/included/included.resource", //
"org/junit/platform/jartest/included/recursive/recursively-included.resource", //
"META-INF/MANIFEST.MF");

assertThat(resources).extracting(Resource::getUri) //
.map(ClasspathScannerTests::jarFileAndEntry) //
@@ -342,14 +343,10 @@ void findAllClassesInPackageWithinJarFileConcurrently() throws Exception {
assertThrows(FileSystemNotFoundException.class, () -> FileSystems.getFileSystem(jarUri),
"FileSystem should be closed");

// @formatter:off
results.forEach(classes -> assertThat(classes)
.hasSize(2)
.extracting(Class::getSimpleName).containsExactlyInAnyOrder(
"Included",
"RecursivelyIncluded"
));
// @formatter:on
results.forEach(classes -> assertThat(classes) //
.hasSize(2) //
.extracting(Class::getSimpleName) //
.containsExactlyInAnyOrder("Included", "RecursivelyIncluded"));
}
}