Skip to content

Commit

Permalink
Generate conf.jar from the build and move persistence.xml to eclipsel…
Browse files Browse the repository at this point in the history
…ink project
  • Loading branch information
aihuaxu committed Aug 8, 2024
1 parent 46dd56f commit 9993a85
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion extension/persistence/eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

sourceSets { test { resources { srcDir("src/test/data") } } }
tasks.register<Jar>("archiveConf") {
archiveFileName = "conf.jar"
destinationDirectory = layout.buildDirectory.dir("conf")

from("src/test/resources/META-INF/") { include("persistence.xml") }
}

tasks.named("test") { dependsOn("archiveConf") }
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

<persistence-unit name="polaris-dev" transaction-type="RESOURCE_LOCAL">
<persistence-unit name="polaris" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>io.polaris.core.persistence.models.ModelEntity</class>
<class>io.polaris.core.persistence.models.ModelEntityActive</class>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static class CreateStoreSessionArgs implements ArgumentsProvider {
public Stream<? extends Arguments> provideArguments(ExtensionContext extensionContext) {
return Stream.of(
Arguments.of("META-INF/persistence.xml", true),
Arguments.of("eclipselink_conf.jar!/persistence.xml", true),
Arguments.of("./build/conf/conf.jar!/persistence.xml", true),
Arguments.of("/dummy_path/conf.jar!/persistence.xml", false));
}
}
Expand Down

0 comments on commit 9993a85

Please sign in to comment.