Skip to content

Commit

Permalink
Add embulk-core:0.11.5, create a PluginClassLoaderFactory instance, a…
Browse files Browse the repository at this point in the history
…nd move the package of test classes
  • Loading branch information
dmikurube committed Sep 17, 2024
1 parent 2986930 commit 70083d7
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 61 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
embulkTestImplementation project(":embulk-junit5-api")

embulkTestRuntimeOnly project(":embulk-junit5-engine")
embulkTestRuntimeOnly "org.embulk:embulk-core:0.11.5"
}

test {
Expand Down
2 changes: 2 additions & 0 deletions embulk-junit5-engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ java {
}

dependencies {
compileOnly "org.embulk:embulk-core:0.11.5"

api project(":embulk-junit5-api")

api platform("org.junit:junit-bom:5.11.0")
Expand Down
1 change: 1 addition & 0 deletions embulk-junit5-engine/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
org.apiguardian:apiguardian-api:1.1.2=compileClasspath
org.embulk:embulk-core:0.11.5=compileClasspath
org.junit.jupiter:junit-jupiter-api:5.11.0=compileClasspath,runtimeClasspath
org.junit.platform:junit-platform-commons:1.11.0=compileClasspath,runtimeClasspath
org.junit.platform:junit-platform-engine:1.11.0=compileClasspath,runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import java.lang.reflect.Method;
import java.util.Optional;
import org.embulk.junit5.api.EmbulkPluginTest;
import org.embulk.plugin.PluginClassLoader;
import org.embulk.plugin.PluginClassLoaderFactory;
import org.embulk.plugin.PluginClassLoaderFactoryImpl;
import org.junit.platform.commons.logging.Logger;
import org.junit.platform.commons.logging.LoggerFactory;
import org.junit.platform.engine.EngineDiscoveryRequest;
Expand All @@ -40,6 +43,8 @@ public EmbulkPluginTestEngine() {
this.klassLoader = klass.getClassLoader();
logger.info(() -> "Initializing EmbulkPluginTestEngine@" + Integer.toHexString(this.hashCode()));
logger.info(() -> "EmbulkPluginTestEngine's ClassLoader: " + this.klassLoader.toString());
this.pluginClassLoaderFactory = PluginClassLoaderFactoryImpl.of();
// this.pluginClassLoader = this.pluginClassLoaderFactory.create(, this.klassLoader);
}

/**
Expand Down Expand Up @@ -82,7 +87,7 @@ public TestDescriptor discover(final EngineDiscoveryRequest discoveryRequest, fi

// final Class<?> testClass = classSelector.getJavaClass(); // Not to get the Java class directly!
final String testClassName = classSelector.getClassName();
final Class<?> testClass = findOrLoadClassFrom(this.klassLoader, testClassName);;
final Class<?> testClass = findOrLoadClassFrom(this.klassLoader, testClassName);

final TestDescriptor classDescriptor =
new ClassTestDescriptor(uniqueId.append("class", testClass.getName()), testClass);
Expand Down Expand Up @@ -144,7 +149,7 @@ private static Class<?> findOrLoadClassFrom(final ClassLoader klassLoader, final

logger.info(() -> "<" + name + "> has not been loaded in [" + klassLoader + "].");
try {
return Class.forName(name); // <= TODO: Load it under PluginClassLoader !
return klassLoader.loadClass(name);
} catch (final ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
Expand All @@ -153,4 +158,8 @@ private static Class<?> findOrLoadClassFrom(final ClassLoader klassLoader, final
private static final Logger logger = LoggerFactory.getLogger(EmbulkPluginTestEngine.class);

private final ClassLoader klassLoader;

private final PluginClassLoaderFactory pluginClassLoaderFactory;

// private final PluginClassLoader pluginClassLoader;
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.embulk.junit5.example;
package org.embulk.input.junit5example;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.embulk.junit5.example;
package org.embulk.input.junit5example;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.embulk.junit5.example;
package org.embulk.input.junit5example;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand Down

0 comments on commit 70083d7

Please sign in to comment.