forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
340c756
commit ebb66d1
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...ts/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/custompu/CustomPuEntity.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,10 @@ | ||
package io.quarkus.it.panache.custompu; | ||
|
||
import jakarta.persistence.Entity; | ||
|
||
import io.quarkus.hibernate.orm.panache.PanacheEntity; | ||
|
||
@Entity | ||
public class CustomPuEntity extends PanacheEntity { | ||
public String string; | ||
} |
33 changes: 33 additions & 0 deletions
33
...hibernate-orm-panache/src/main/java/io/quarkus/it/panache/resources/CustomPuResource.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.it.panache.resources; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.transaction.Transactional; | ||
import jakarta.ws.rs.PATCH; | ||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.PathParam; | ||
|
||
import io.quarkus.it.panache.custompu.CustomPuEntity; | ||
|
||
@Path("/custom-pu") | ||
public class CustomPuResource { | ||
|
||
@Transactional | ||
@POST | ||
@Path("/{string}") | ||
public CustomPuEntity create(@PathParam("string") String string) { | ||
CustomPuEntity entity = new CustomPuEntity(); | ||
entity.string = string; | ||
entity.persist(); | ||
return entity; | ||
} | ||
|
||
@Transactional | ||
@PATCH | ||
@Path("/{string}") | ||
public List<CustomPuEntity> updateAll(@PathParam("string") String string) { | ||
CustomPuEntity.update("set string = ?1 where 1 = 1", string); | ||
return CustomPuEntity.findAll().list(); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
...n-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/custompu/SmokeTest.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,18 @@ | ||
package io.quarkus.it.panache.custompu; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.restassured.RestAssured; | ||
|
||
@QuarkusTest | ||
class SmokeTest { | ||
|
||
@Test | ||
void testPanacheFunctionality() throws Exception { | ||
RestAssured.when().post("/custom-pu/someValue").then().body(containsString("someValue")); | ||
RestAssured.when().patch("/custom-pu/someUpdatedValue").then().body(containsString("someUpdatedValue")); | ||
} | ||
} |