-
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
14 changed files
with
68 additions
and
78 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
13 changes: 8 additions & 5 deletions
13
...ts/quarkus/HibernateOrmCodestartTest.java → ...arts/quarkus/HibernateOrmCodestartIT.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,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.extension.RegisterExtension; | ||
|
||
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; | ||
import io.quarkus.maven.dependency.ArtifactKey; | ||
|
||
public class HibernateOrmCodestartTest { | ||
public class HibernateOrmCodestartIT { | ||
|
||
@RegisterExtension | ||
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder() | ||
.codestarts("hibernate-orm") | ||
.extension(ArtifactKey.ga("io.quarkus", "quarkus-jdbc-h2")) | ||
.languages(JAVA) | ||
.languages(JAVA, KOTLIN) | ||
.build(); | ||
|
||
@Test | ||
void testContent() throws Throwable { | ||
codestartTest.checkGeneratedSource("org.acme.MyEntity"); | ||
codestartTest.checkGeneratedSource(QuarkusCodestartCatalog.Language.KOTLIN, "org.acme.MyKotlinEntity"); | ||
codestartTest.checkGeneratedSource(JAVA, "org.acme.MyEntity"); | ||
codestartTest.checkGeneratedSource(KOTLIN, "org.acme.MyKotlinEntity"); | ||
codestartTest.assertThatGeneratedFileMatchSnapshot(JAVA, "src/main/resources/import.sql"); | ||
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
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
File renamed without changes.
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
...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'); |
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.