Skip to content

Commit

Permalink
EclipseLink: create test jar on the fly (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
adutra authored Jan 6, 2025
1 parent 6bda078 commit 4747bbe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
10 changes: 10 additions & 0 deletions extension/persistence/eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ dependencies {
testImplementation(libs.mockito.core)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

tasks.register<Jar>("createTestConfJar") {
archiveFileName = "test-conf.jar"
destinationDirectory = layout.buildDirectory.dir("conf/eclipselink")
from("src/main/resources/META-INF/") { include("persistence.xml") }
}

sourceSets { test { resources.srcDir(layout.buildDirectory.dir("conf")) } }

tasks.named("processTestResources") { dependsOn("createTestConfJar") }
Original file line number Diff line number Diff line change
Expand Up @@ -215,24 +215,16 @@ public Stream<? extends Arguments> provideArguments(ExtensionContext extensionCo
Objects.requireNonNull(getClass().getResource("/META-INF/persistence.xml")).toURI());
Path confJar =
Paths.get(
Objects.requireNonNull(
getClass()
.getResource(
"/org/apache/polaris/extension/persistence/impl/eclipselink/test-conf.jar"))
.toURI());
Objects.requireNonNull(getClass().getResource("/eclipselink/test-conf.jar")).toURI());
return Stream.of(
// conf file not provided
Arguments.of(null, true),
// classpath resource
Arguments.of("META-INF/persistence.xml", true),
Arguments.of("META-INF/dummy.xml", false),
// classpath resource, embedded
Arguments.of(
"org/apache/polaris/extension/persistence/impl/eclipselink/test-conf.jar!/persistence.xml",
true),
Arguments.of(
"org/apache/polaris/extension/persistence/impl/eclipselink/test-conf.jar!/dummy.xml",
false),
Arguments.of("eclipselink/test-conf.jar!/persistence.xml", true),
Arguments.of("eclipselink/test-conf.jar!/dummy.xml", false),
Arguments.of("dummy/test-conf.jar!/persistence.xml", false),
// filesystem path
Arguments.of(persistenceXml.toString(), true),
Expand Down
Binary file not shown.

0 comments on commit 4747bbe

Please sign in to comment.