-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to configure HBM2DDL script generation via application.properties
Fixes #14771
- Loading branch information
1 parent
af74476
commit 7978400
Showing
4 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
integration-tests/hibernate-orm-panache/src/main/resources/ddlgeneration.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
quarkus.datasource.db-kind=h2 | ||
quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test | ||
quarkus.datasource.jdbc.max-size=8 | ||
|
||
quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect | ||
quarkus.hibernate-orm.database.generation=drop-and-create | ||
|
||
quarkus.hibernate-orm.scripts.generation=drop-and-create | ||
quarkus.hibernate-orm.scripts.generation.create-target=create.sql | ||
quarkus.hibernate-orm.scripts.generation.drop-target=drop.sql | ||
|
||
quarkus.hibernate-orm.statistics=true | ||
quarkus.hibernate-orm.metrics.enabled=true |
43 changes: 43 additions & 0 deletions
43
...ion-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/DDLGenerationPMT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.quarkus.it.panache; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.builder.Version; | ||
import io.quarkus.test.ProdBuildResults; | ||
import io.quarkus.test.ProdModeTestResults; | ||
import io.quarkus.test.QuarkusProdModeTest; | ||
import io.restassured.RestAssured; | ||
|
||
/** | ||
* Verifies that DDL scripts are generated when script generation is configured in application.properties. | ||
*/ | ||
public class DDLGenerationPMT { | ||
|
||
@RegisterExtension | ||
static final QuarkusProdModeTest config = new QuarkusProdModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(PageItem.class, TestResources.class, NoPagingTestEndpoint.class)) | ||
.setApplicationName("ddl-generation") | ||
.setApplicationVersion(Version.getVersion()) | ||
.setRun(true) | ||
.setLogFileName("ddl-generation-test.log") | ||
.withConfigurationResource("ddlgeneration.properties"); | ||
|
||
@ProdBuildResults | ||
private ProdModeTestResults prodModeTestResults; | ||
|
||
@Test | ||
public void test() { | ||
RestAssured.when().get("/no-paging-test").then().body(is("OK")); | ||
|
||
assertThat(prodModeTestResults.getBuildDir().resolve("quarkus-app/create.sql").toFile()).exists(); | ||
assertThat(prodModeTestResults.getBuildDir().resolve("quarkus-app/drop.sql").toFile()).exists(); | ||
} | ||
|
||
} |