Skip to content

Commit

Permalink
Fix metadata tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lazar-mitrovic committed Jun 29, 2022
1 parent 41f81e5 commit cd1d951
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ void testExtract(@TempDir Path tempDir) throws IOException {
assertEquals("[]", String.join("\n", Files.readAllLines(tempDir.resolve("index.json"))));

assertTrue(Files.isDirectory(tempDir.resolve("org")));
assertTrue(Files.isDirectory(tempDir.resolve("org/graalvm")));
assertTrue(Files.isDirectory(tempDir.resolve("org/graalvm/internal")));
assertTrue(Files.isDirectory(tempDir.resolve("org/graalvm/internal/library-with-reflection")));
assertTrue(Files.exists(tempDir.resolve("org/graalvm/internal/library-with-reflection/index.json")));
assertTrue(Files.isDirectory(tempDir.resolve("org/graalvm/internal/library-with-reflection/1")));

assertTrue(Files.exists(tempDir.resolve("org/graalvm/internal/library-with-reflection/1/reflect-config.json")));
assertEquals("[ { \"name\": \"org.graalvm.internal.reflect.Message\", \"allDeclaredFields\": true, \"allDeclaredMethods\": true }]", String.join("", Files.readAllLines(tempDir.resolve("org/graalvm/internal/library-with-reflection/1/reflect-config.json"))));
assertTrue(Files.isDirectory(tempDir.resolve("org.graalvm")));
assertTrue(Files.isDirectory(tempDir.resolve("org.graalvm.internal")));
assertTrue(Files.isDirectory(tempDir.resolve("org.graalvm.internal/library-with-reflection")));
assertTrue(Files.exists(tempDir.resolve("org.graalvm.internal/library-with-reflection/index.json")));
assertTrue(Files.isDirectory(tempDir.resolve("org.graalvm.internal/library-with-reflection/1")));

assertTrue(Files.exists(tempDir.resolve("org.graalvm.internal/library-with-reflection/1/reflect-config.json")));
assertEquals("[ { \"name\": \"org.graalvm.internal.reflect.Message\", \"allDeclaredFields\": true, \"allDeclaredMethods\": true }]", String.join("", Files.readAllLines(tempDir.resolve("org.graalvm.internal/library-with-reflection/1/reflect-config.json"))));
}
@Test
@DisplayName("It is protected against ZIP slip attacks")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class NativeConfigRepoFunctionalTest extends AbstractFunctionalTest {
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org/graalvm/internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"

where:
format | label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTes
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but it finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org/graalvm/internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"
}

void "if excludeConfig is set it is added to the command line invocation"() {
Expand Down Expand Up @@ -151,7 +151,7 @@ class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTes
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but it finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org/graalvm/internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"
}

void "it can download a remote repository"() {
Expand All @@ -171,7 +171,7 @@ class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTes
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but it finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org/graalvm/internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"
}

void "when pointing to a missing URL, reflection fails"() {
Expand Down

0 comments on commit cd1d951

Please sign in to comment.