-
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.
Merge pull request #15340 from mkouba/issue-15334
Qute - fix handling of Panache entity getters for boolean properties
- Loading branch information
Showing
10 changed files
with
193 additions
and
29 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
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
16 changes: 16 additions & 0 deletions
16
integration-tests/qute/src/main/java/io/quarkus/it/qute/Beer.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,16 @@ | ||
package io.quarkus.it.qute; | ||
|
||
import javax.persistence.Entity; | ||
|
||
import io.quarkus.hibernate.orm.panache.PanacheEntity; | ||
|
||
@Entity | ||
public class Beer extends PanacheEntity { | ||
|
||
public String name; | ||
|
||
public Boolean completed; | ||
|
||
public boolean done; | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
integration-tests/qute/src/main/java/io/quarkus/it/qute/BeerResource.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,28 @@ | ||
package io.quarkus.it.qute; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import io.quarkus.qute.CheckedTemplate; | ||
import io.quarkus.qute.TemplateInstance; | ||
|
||
@Path("/beer") | ||
public class BeerResource { | ||
|
||
@CheckedTemplate | ||
static class Templates { | ||
|
||
static native TemplateInstance beer(Beer beer); | ||
|
||
} | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_HTML) | ||
public TemplateInstance get() { | ||
Beer beer = Beer.find("name", "Pilsner").firstResult(); | ||
return Templates.beer(beer); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
integration-tests/qute/src/main/java/io/quarkus/it/qute/Brewery.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,19 @@ | ||
package io.quarkus.it.qute; | ||
|
||
import javax.enterprise.event.Observes; | ||
import javax.transaction.Transactional; | ||
|
||
import io.quarkus.runtime.StartupEvent; | ||
|
||
public class Brewery { | ||
|
||
@Transactional | ||
void onStart(@Observes StartupEvent event) { | ||
Beer myBeer = new Beer(); | ||
myBeer.name = "Pilsner"; | ||
myBeer.completed = true; | ||
myBeer.done = true; | ||
myBeer.persist(); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
integration-tests/qute/src/main/resources/application.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,6 @@ | ||
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 |
10 changes: 10 additions & 0 deletions
10
integration-tests/qute/src/main/resources/templates/BeerResource/beer.html
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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Beer!</title> | ||
</head> | ||
<body> | ||
<p>Beer {beer.name}, completed: {beer.completed}, done: {beer.done}</p> | ||
</body> | ||
</html> |
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
8 changes: 8 additions & 0 deletions
8
integration-tests/qute/src/test/java/io/quarkus/it/qute/TestResources.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,8 @@ | ||
package io.quarkus.it.qute; | ||
|
||
import io.quarkus.test.common.QuarkusTestResource; | ||
import io.quarkus.test.h2.H2DatabaseTestResource; | ||
|
||
@QuarkusTestResource(H2DatabaseTestResource.class) | ||
public class TestResources { | ||
} |