Skip to content

Commit

Permalink
Tweak the classpath for embulkTest
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikurube committed Sep 17, 2024
1 parent 4a9580f commit 1fa7400
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
21 changes: 18 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ configurations {
compileClasspath.resolutionStrategy.activateDependencyLocking()
runtimeClasspath.resolutionStrategy.activateDependencyLocking()

embulkTestImplementation.extendsFrom testImplementation
embulkTestRuntime.extendsFrom testRuntime
// No need to declare "embulkTestImplementation" explicitly as the sourceSet "embulkTest" is declared below.
// No need to declare "embulkTestRuntime" explicitly as the sourceSet "embulkTest" is declared below.
}

sourceSets {
Expand Down Expand Up @@ -44,9 +44,12 @@ dependencies {

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.0"

embulkTestImplementation project(":embulk-junit5-api")
embulkTestImplementation project(":embulk-junit5-api") // TODO: embulk-junit5-api depends on junit-jupiter-api transitively?
embulkTestImplementation "org.junit.jupiter:junit-jupiter-api:5.11.0"

embulkTestRuntimeOnly project(":embulk-junit5-engine")

// embulk-core can be loaded in the top-level class loader.
embulkTestRuntimeOnly "org.embulk:embulk-core:0.11.5"
}

Expand All @@ -70,9 +73,21 @@ test {
}

task embulkTest(type: Test) {
doFirst {
println "^^^^^ Classpath information in embulkTest ^^^^^"
println sourceSets.embulkTest.runtimeClasspath
println sourceSets.embulkTest.runtimeClasspathConfigurationName
sourceSets.embulkTest.runtimeClasspath.each {
println it
}
println "^^^^^ Classpath information in embulkTest ^^^^^"
}

useJUnitPlatform()

classpath = sourceSets.embulkTest.runtimeClasspath

// Pick up "@EmbulkPluginTest" methods from the classes in "testClassesDirs"
testClassesDirs = sourceSets.embulkTest.output.classesDirs

testLogging {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@ public TestDescriptor discover(final EngineDiscoveryRequest discoveryRequest, fi

// final Class<?> testClass = classSelector.getJavaClass(); // Not to get the Java class directly!
final String testClassName = classSelector.getClassName();
try {
System.out.println(Class.forName("org.embulk.input.junit5example.ExampleInputPlugin"));
} catch (final Exception ex) {
ex.printStackTrace();
}
try {
System.out.println(Class.forName("org.embulk.input.junit5example.TestExample"));
} catch (final Exception ex) {
ex.printStackTrace();
}
try {
System.out.println(Class.forName("org.embulk.input.junit5example.TestExample1"));
} catch (final Exception ex) {
ex.printStackTrace();
}
try {
System.out.println(Class.forName("org.embulk.util.config.Config"));
} catch (final Exception ex) {
ex.printStackTrace();
}
final Class<?> testClass = findOrLoadClassFrom(this.klassLoader, testClassName);

final TestDescriptor classDescriptor =
Expand Down

0 comments on commit 1fa7400

Please sign in to comment.