-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix HibernateOrm and panache codestarts
- Loading branch information
Showing
16 changed files
with
108 additions
and
81 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
31 changes: 0 additions & 31 deletions
31
...sion-codestarts/hibernate-orm-codestart/kotlin/src/main/kotlin/org/acme/MyKotlinEntity.kt
This file was deleted.
Oops, something went wrong.
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: 6 additions & 7 deletions
13
...bernateOrmPanacheKotlinCodestartTest.java → ...uarkus/HibernateOrmKotlinCodestartIT.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 |
---|---|---|
@@ -1,30 +1,29 @@ | ||
package io.quarkus.devtools.codestarts.quarkus; | ||
|
||
import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.KOTLIN; | ||
|
||
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; | ||
import io.quarkus.maven.ArtifactKey; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; | ||
import io.quarkus.maven.ArtifactKey; | ||
import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.KOTLIN; | ||
|
||
public class HibernateOrmPanacheKotlinCodestartTest { | ||
public class HibernateOrmKotlinCodestartIT { | ||
|
||
@RegisterExtension | ||
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder() | ||
.codestarts("hibernate-orm") | ||
.extension(new ArtifactKey("io.quarkus", "quarkus-jdbc-h2")) | ||
.extension(new ArtifactKey("io.quarkus", "quarkus-hibernate-orm-panache-kotlin")) | ||
.languages(KOTLIN) | ||
.build(); | ||
|
||
@Test | ||
void testContent() throws Throwable { | ||
codestartTest.checkGeneratedSource("org.acme.MyKotlinEntity"); | ||
codestartTest.assertThatGeneratedFileMatchSnapshot(KOTLIN, "src/main/resources/import.sql"); | ||
} | ||
|
||
@Test | ||
void buildAllProjectsForLocalUse() throws Throwable { | ||
void testBuild() throws Throwable { | ||
codestartTest.buildAllProjects(); | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...est/java/io/quarkus/devtools/codestarts/quarkus/HibernateOrmPanacheKotlinCodestartIT.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,33 @@ | ||
package io.quarkus.devtools.codestarts.quarkus; | ||
|
||
import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.JAVA; | ||
import static io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language.KOTLIN; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; | ||
import io.quarkus.maven.ArtifactKey; | ||
|
||
public class HibernateOrmPanacheKotlinCodestartIT { | ||
|
||
@RegisterExtension | ||
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder() | ||
.codestarts("hibernate-orm") | ||
.extension(new ArtifactKey("io.quarkus", "quarkus-jdbc-h2")) | ||
.extension(new ArtifactKey("io.quarkus", "quarkus-hibernate-orm-panache-kotlin")) | ||
.languages(KOTLIN) | ||
.build(); | ||
|
||
@Test | ||
void testContent() throws Throwable { | ||
codestartTest.checkGeneratedSource("org.acme.MyKotlinEntity"); | ||
codestartTest.assertThatGeneratedFileMatchSnapshot(KOTLIN, "src/main/resources/import.sql"); | ||
} | ||
|
||
@Test | ||
void testBuild() throws Throwable { | ||
codestartTest.buildAllProjects(); | ||
} | ||
} |
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...resources/__snapshots__/HibernateOrmCodestartIT/testContent/src_main_resources_import.sql
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,5 @@ | ||
-- This file allow to write SQL commands that will be emitted in test and dev. | ||
-- The commands are commented as their support depends of the database | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-1'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-2'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-3'); |
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
5 changes: 5 additions & 0 deletions
5
...ces/__snapshots__/HibernateOrmKotlinCodestartIT/testContent/src_main_resources_import.sql
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,5 @@ | ||
-- This file allow to write SQL commands that will be emitted in test and dev. | ||
-- The commands are commented as their support depends of the database | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-1'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-2'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-3'); |
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...es/__snapshots__/HibernateOrmPanacheCodestartIT/testContent/src_main_resources_import.sql
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,5 @@ | ||
-- This file allow to write SQL commands that will be emitted in test and dev. | ||
-- The commands are commented as their support depends of the database | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-1'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-2'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-3'); |
34 changes: 34 additions & 0 deletions
34
...eOrmPanacheKotlinCodestartIT/testContent/src_main_kotlin_ilove_quark_us_MyKotlinEntity.kt
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,34 @@ | ||
package ilove.quark.us | ||
|
||
import io.quarkus.hibernate.orm.panache.kotlin.PanacheEntity | ||
import io.quarkus.hibernate.orm.panache.kotlin.PanacheCompanion | ||
import javax.persistence.Entity | ||
|
||
/** | ||
* Example JPA entity defined as a Kotlin Panache Entity. | ||
* An ID field of Long type is provided, if you want to define your own ID field extends <code>PanacheEntityBase</code> instead. | ||
* | ||
* This uses the active record pattern, you can also use the repository pattern instead: | ||
* . | ||
* | ||
* Usage (more example on the documentation) | ||
* | ||
* {@code | ||
* | ||
* fun doSomething() { | ||
* val entity1 = MyKotlinEntity(); | ||
* entity1.field = "field-1" | ||
* entity1.persist() | ||
* | ||
* val entities:List<MyKotlinEntity> = MyKotlinEntity.listAll() | ||
* } | ||
* } | ||
*/ | ||
@Entity | ||
class MyKotlinEntity: PanacheEntity() { | ||
companion object: PanacheCompanion<MyKotlinEntity> { | ||
fun byName(name: String) = list("name", name) | ||
} | ||
|
||
lateinit var field: String | ||
} |
5 changes: 5 additions & 0 deletions
5
...napshots__/HibernateOrmPanacheKotlinCodestartIT/testContent/src_main_resources_import.sql
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,5 @@ | ||
-- This file allow to write SQL commands that will be emitted in test and dev. | ||
-- The commands are commented as their support depends of the database | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-1'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-2'); | ||
-- insert into myentity (id, field) values(nextval('hibernate_sequence'), 'field-3'); |
31 changes: 0 additions & 31 deletions
31
...rmPanacheKotlinCodestartTest/testContent/src_main_kotlin_ilove_quark_us_MyKotlinEntity.kt
This file was deleted.
Oops, something went wrong.