Skip to content

Commit

Permalink
Add metadata for org.junit.jupiter:junit-jupiter:5.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro committed Mar 10, 2025
1 parent 0a58b92 commit ab3b026
Show file tree
Hide file tree
Showing 18 changed files with 239 additions and 26 deletions.
4 changes: 4 additions & 0 deletions metadata/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@
"allowed-packages" : [ "org.jooq" ],
"directory" : "org.jooq/jooq",
"module" : "org.jooq:jooq"
}, {
"allowed-packages" : [ "org.junit.jupiter" ],
"directory" : "org.junit.jupiter/junit-jupiter",
"module" : "org.junit.jupiter:junit-jupiter"
}, {
"allowed-packages" : [ "org.liquibase", "liquibase" ],
"directory" : "org.liquibase/liquibase-core",
Expand Down
7 changes: 7 additions & 0 deletions metadata/org.junit.jupiter/junit-jupiter/5.11.0/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
"jni-config.json",
"proxy-config.json",
"reflect-config.json",
"resource-config.json",
"serialization-config.json"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type":"agent-extracted",
"classes":[
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[
{
"condition":{"typeReachable":"org.junit.internal.builders.SuiteMethodBuilder"},
"name":"basic.BasicTest",
"methods":[{"name":"suite","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor"},
"name":"basic.BasicTest",
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"org.junit.jupiter.engine.descriptor.ExtensionUtils"},
"name":"basic.BasicTest",
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"org.junit.jupiter.engine.descriptor.LifecycleMethodUtils"},
"name":"basic.BasicTest",
"queryAllDeclaredMethods":true,
"queryAllPublicMethods":true
},
{
"condition":{"typeReachable":"org.junit.jupiter.engine.discovery.ClassSelectorResolver"},
"name":"basic.BasicTest",
"queryAllDeclaredMethods":true,
"queryAllPublicMethods":true
},
{
"condition":{"typeReachable":"org.junit.jupiter.engine.discovery.predicates.IsTestClassWithTests"},
"name":"basic.BasicTest",
"queryAllDeclaredMethods":true,
"queryAllPublicMethods":true
},
{
"condition":{"typeReachable":"org.junit.platform.commons.util.AnnotationUtils"},
"name":"basic.BasicTest"
},
{
"condition":{"typeReachable":"org.junit.platform.commons.util.ReflectionUtils"},
"name":"basic.BasicTest",
"allDeclaredFields":true,
"allDeclaredClasses":true,
"queryAllDeclaredMethods":true,
"queryAllPublicMethods":true,
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"resourceTest","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveJUnit4Builder"},
"name":"basic.BasicTest",
"queryAllDeclaredMethods":true,
"queryAllPublicMethods":true
},
{
"condition":{"typeReachable":"org.junit.platform.launcher.listeners.OutputDir"},
"name":"java.security.SecureRandomParameters"
},
{
"condition":{"typeReachable":"org.junit.platform.launcher.listeners.OutputDir"},
"name":"sun.security.provider.NativePRNG",
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"<init>","parameterTypes":["java.security.SecureRandomParameters"] }]
},
{
"condition":{"typeReachable":"org.junit.platform.launcher.listeners.OutputDir"},
"name":"sun.security.provider.SHA",
"methods":[{"name":"<init>","parameterTypes":[] }]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"resources":{
"includes":[{
"condition":{"typeReachable":"org.junit.platform.launcher.core.LauncherFactory"},
"pattern":"\\QMETA-INF/services/org.junit.platform.engine.TestEngine\\E"
}, {
"condition":{"typeReachable":"org.junit.platform.launcher.core.LauncherFactory"},
"pattern":"\\QMETA-INF/services/org.junit.platform.launcher.TestExecutionListener\\E"
}, {
"condition":{"typeReachable":"org.junit.platform.commons.util.ReflectionUtils"},
"pattern":"\\Qresource.txt\\E"
}]},
"bundles":[]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"types":[
],
"lambdaCapturingTypes":[
],
"proxies":[
]
}
10 changes: 10 additions & 0 deletions metadata/org.junit.jupiter/junit-jupiter/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"latest": true,
"metadata-version": "5.11.0",
"module": "org.junit.jupiter:junit-jupiter",
"tested-versions": [
"5.11.0"
]
}
]
40 changes: 23 additions & 17 deletions tests/src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,28 +179,28 @@
"versions" : [ "2.16.11" ]
} ]
}, {
"test-project-path" : "io.netty/netty-common/4.1.80.Final",
"test-project-path" : "io.netty/netty-common/4.1.115.Final",
"libraries" : [ {
"name" : "io.netty:netty-common",
"versions" : [ "4.1.80.Final" ]
"versions" : [ "4.1.115.Final" ]
} ]
}, {
"test-project-path" : "io.netty/netty-transport/4.1.80.Final",
"test-project-path" : "io.netty/netty-common/4.1.80.Final",
"libraries" : [ {
"name" : "io.netty:netty-transport",
"name" : "io.netty:netty-common",
"versions" : [ "4.1.80.Final" ]
} ]
}, {
"test-project-path" : "io.netty/netty-common/4.1.115.Final",
"test-project-path" : "io.netty/netty-transport/4.1.115.Final",
"libraries" : [ {
"name" : "io.netty:netty-common",
"name" : "io.netty:netty-transport",
"versions" : [ "4.1.115.Final" ]
} ]
}, {
"test-project-path" : "io.netty/netty-transport/4.1.115.Final",
"test-project-path" : "io.netty/netty-transport/4.1.80.Final",
"libraries" : [ {
"name" : "io.netty:netty-transport",
"versions" : [ "4.1.115.Final" ]
"versions" : [ "4.1.80.Final" ]
} ]
}, {
"test-project-path" : "io.opentelemetry/opentelemetry-exporter-jaeger/1.19.0",
Expand Down Expand Up @@ -437,16 +437,16 @@
"versions" : [ "10.15.0" ]
} ]
}, {
"test-project-path": "org.flywaydb/flyway-core/10.20.0",
"libraries": [ {
"name": "org.flywaydb:flyway-core",
"versions": [ "10.20.0" ]
"test-project-path" : "org.flywaydb/flyway-core/10.20.0",
"libraries" : [ {
"name" : "org.flywaydb:flyway-core",
"versions" : [ "10.20.0" ]
} ]
}, {
"test-project-path": "org.flywaydb/flyway-core/10.20.1",
"libraries": [ {
"name": "org.flywaydb:flyway-core",
"versions": [ "10.20.1" ]
"test-project-path" : "org.flywaydb/flyway-core/10.20.1",
"libraries" : [ {
"name" : "org.flywaydb:flyway-core",
"versions" : [ "10.20.1" ]
} ]
}, {
"test-project-path" : "org.flywaydb/flyway-core/9.0.1",
Expand Down Expand Up @@ -586,6 +586,12 @@
"name" : "org.jooq:jooq",
"versions" : [ "3.18.2" ]
} ]
}, {
"test-project-path" : "org.junit.jupiter/junit-jupiter/5.11.0",
"libraries" : [ {
"name" : "org.junit.jupiter:junit-jupiter",
"versions" : [ "5.11.0" ]
} ]
}, {
"test-project-path" : "org.liquibase/liquibase-core/4.17.0",
"libraries" : [ {
Expand Down Expand Up @@ -682,4 +688,4 @@
"name" : "samples:docker",
"versions" : [ "image-pull" ]
} ]
} ]
} ]
4 changes: 4 additions & 0 deletions tests/src/org.junit.jupiter/junit-jupiter/5.11.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gradlew.bat
gradlew
gradle/
build/
34 changes: 34 additions & 0 deletions tests/src/org.junit.jupiter/junit-jupiter/5.11.0/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright and related rights waived via CC0
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/

plugins {
id "org.graalvm.internal.tck"
}

String libraryVersion = tck.testedLibraryVersion.get()

dependencies {
testImplementation "org.junit.vintage:junit-vintage-engine:5.11.0"
testImplementation "org.junit.jupiter:junit-jupiter:$libraryVersion"
testImplementation 'org.assertj:assertj-core:3.22.0'
}

graalvmNative {
agent {
defaultMode = "conditional"
modes {
conditional {
userCodeFilterPath = "user-code-filter.json"
}
}
metadataCopy {
mergeWithExisting = false
inputTaskNames.add("test")
outputDirectories.add("metadata/org.junit.jupiter/junit-jupiter/5.11.0")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
library.version = 5.11.0
metadata.dir = org.junit.jupiter/junit-jupiter/5.11.0/
13 changes: 13 additions & 0 deletions tests/src/org.junit.jupiter/junit-jupiter/5.11.0/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pluginManagement {
def tckPath = Objects.requireNonNullElse(
System.getenv("GVM_TCK_TCKDIR"),
"../../../../tck-build-logic"
)
includeBuild(tckPath)
}

plugins {
id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT"
}

rootProject.name = 'org.junit.jupiter.junit-jupiter_tests'
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package basic;

import org.junit.jupiter.api.Test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class BasicTest {

private static final String RESOURCE = "/resource.txt";

@Test
public void resourceTest() {
try(InputStream is = BasicTest.class.getResourceAsStream(RESOURCE)) {
assertNotNull(is);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);

assertTrue(br.readLine().equalsIgnoreCase("Hello from resource!"));
} catch (IOException e) {
throw new RuntimeException(e);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello from resource!
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": [
{"excludeClasses": "**"},
{"includeClasses": "org.junit.**"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ void run() throws IOException {
createPullRequest(pullRequestInfo);
}

// TODO ask user to check metadata. If everything is okay, ask user if the task should create a PR for him

InteractiveTaskUtils.printUserInfo("Contribution successfully completed! Thank you!");
}

private Coordinates getCoordinates() {
Expand Down Expand Up @@ -371,21 +370,17 @@ private void createPullRequest(Map<PullRequestInfo, Object> info) {
invokeCommand("git", List.of("commit", "-m", "Add metadata for " + coordinates), "Cannot commit changes", null);

InteractiveTaskUtils.printUserInfo("Pushing changes");
String output = invokeCommand("git push origin " + branch, "Cannot push to origin");

String pullRequestCreateLink = "https://github.com/oracle/graalvm-reachability-metadata/pull/new/" + branch;
if (!output.contains(pullRequestCreateLink)) {
throw new RuntimeException("Cannot find link for pull request creation");
}
invokeCommand("git push origin " + branch, "Cannot push to origin");

InteractiveTaskUtils.printUserInfo("Complete generating your pull request on GitHub: " + pullRequestCreateLink);
InteractiveTaskUtils.printUserInfo("Complete pull request creation on the above link!");
}

private void writeToFile(Path path, String content, StandardOpenOption writeOption) throws IOException {
Files.createDirectories(path.getParent());
Files.writeString(path, content, StandardCharsets.UTF_8, writeOption);
}

// TODO remove return value
private String invokeCommand(String command, String errorMessage) {
return invokeCommand(command, errorMessage, null);
}
Expand Down

0 comments on commit ab3b026

Please sign in to comment.