Skip to content

Commit

Permalink
[quarkusio#15839] Test Hibernate Reactive fetch with getReference
Browse files Browse the repository at this point in the history
It has been fixed by one of the latest Hibernate Reactive upgrades.
Probably by hibernate/hibernate-reactive#975
  • Loading branch information
DavideD committed Jul 12, 2022
1 parent e428579 commit 3ee180a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public Uni<Collection<Book>> findBooksWithMutiny(@PathParam("authorId") Integer
.chain(author -> Mutiny.fetch(author.getBooks()));
}

@GET
@Path("/getReferenceBooksWithMutiny/{authorId}")
public Uni<Collection<Book>> getReferenceBooksWithMutiny(@PathParam("authorId") Integer authorId) {
return mutinySession
.fetch(mutinySession.getReference(Author.class, authorId))
.chain(author -> Mutiny.fetch(author.getBooks()));
}

@POST
@Path("/prepareDb")
public Uni<String> prepareDb() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@
@TestHTTPEndpoint(HibernateReactiveTestEndpointFetchLazy.class)
public class HibernateReactiveFetchLazyTest {

@Test
public void fetchAfterGetReferenceWithMutiny() {
RestAssured.when()
.post("/prepareDb")
.then()
.body(is("Neal Stephenson"));

Response response = RestAssured.when()
.get("/getReferenceBooksWithMutiny/567")
.then()
.extract().response();
assertTitles(response, "Cryptonomicon", "Snow Crash");
}

@Test
public void fetchAfterFindWithMutiny() {
RestAssured.when()
Expand Down

0 comments on commit 3ee180a

Please sign in to comment.