updated lys-catalog version
CI / build (push) Failing after 2m40s

This commit is contained in:
2024-12-31 17:28:55 +08:00
parent 4a22d2380e
commit b3dce6d691
8 changed files with 44 additions and 31 deletions
@@ -21,28 +21,29 @@ public class PathClassLoaderTest {
@Test
@SneakyThrows
void test() {
FileSystem fs = FileSystems.newFileSystem(testBundle, (ClassLoader) null);
List<Path> paths = StreamSupport.stream(fs.getRootDirectories().spliterator(), false).flatMap(new Function<Path, Stream<Path>>() {
@Override
@SneakyThrows
public Stream<Path> apply(Path path) {
return Files.list(path)
.filter(Files::isRegularFile)
.filter(p -> p.getFileName().toString().endsWith(".jar"));
}
}).flatMap(new Function<Path, Stream<Path>>() {
@Override
@SneakyThrows
public Stream<Path> apply(Path path) {
System.out.println(path.getFileName().toString());
return StreamSupport.stream(FileSystems.newFileSystem(path, (ClassLoader) null).getRootDirectories().spliterator(), false);
}
}).collect(Collectors.toUnmodifiableList());
PathClassLoader classLoader = new PathClassLoader(paths);
Class<?>[] cls = new Class[1];
Assertions.assertDoesNotThrow(() -> {
cls[0] = classLoader.loadClass("com.google.common.collect.ImmutableMap");
});
Assertions.assertNotNull(cls[0]);
try(FileSystem fs = FileSystems.newFileSystem(testBundle, (ClassLoader) null)) {
List<Path> paths = StreamSupport.stream(fs.getRootDirectories().spliterator(), false).flatMap(new Function<Path, Stream<Path>>() {
@Override
@SneakyThrows
public Stream<Path> apply(Path path) {
return Files.list(path)
.filter(Files::isRegularFile)
.filter(p -> p.getFileName().toString().endsWith(".jar"));
}
}).flatMap(new Function<Path, Stream<Path>>() {
@Override
@SneakyThrows
public Stream<Path> apply(Path path) {
System.out.println(path.getFileName().toString());
return StreamSupport.stream(FileSystems.newFileSystem(path, (ClassLoader) null).getRootDirectories().spliterator(), false);
}
}).collect(Collectors.toUnmodifiableList());
PathClassLoader classLoader = new PathClassLoader(paths);
Class<?>[] cls = new Class[1];
Assertions.assertDoesNotThrow(() -> {
cls[0] = classLoader.loadClass("com.google.common.collect.ImmutableMap");
});
Assertions.assertNotNull(cls[0]);
}
}
}