From 017fb2f06d9bd0574e53feeaa02329fbe36761cd Mon Sep 17 00:00:00 2001 From: Davide D'Alto Date: Thu, 10 Nov 2022 15:39:24 +0000 Subject: [PATCH] [#29089] Test for Panache Reactive and ORM --- .../java/io/quarkus/it/panache/TestEndpoint.java | 12 ++++++++++++ .../io/quarkus/it/panache/reactive/TestEndpoint.java | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java index 2641e034de2b32..363fd589281d4e 100644 --- a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java +++ b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java @@ -1253,6 +1253,18 @@ public String testProjection() { long countDistinct = projectionDistinctQuery.count(); Assertions.assertEquals(1L, countDistinct); + // We are checking that not everything gets lowercased + PanacheQuery letterCaseQuery = Cat + // The spaces at the beginning are intentional + .find(" SELECT disTINct 'GARFIELD', 'JoN ArBuCkLe' from Cat c where name = :NamE group by name ", + Parameters.with("NamE", bubulle.name)) + .project(CatProjectionBean.class); + + CatProjectionBean catView = letterCaseQuery.firstResult(); + // Must keep the letter case + Assertions.assertEquals("GARFIELD", catView.getName()); + Assertions.assertEquals("JoN ArBuCkLe", catView.getOwnerName()); + Cat.deleteAll(); CatOwner.deleteAll(); diff --git a/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java b/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java index fb50b9a4287b41..7046f84404eb30 100644 --- a/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java +++ b/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java @@ -1675,6 +1675,16 @@ public Uni testProjection2() { Assertions.assertTrue( exception.getMessage().startsWith("Unable to perform a projection on a 'select new' query")); }) + .chain(() -> Cat + .find(" SELECT disTINct 'GARFIELD', 'JoN ArBuCkLe' from Cat c where name = :NamE group by name ", + Parameters.with("NamE", catName)) + .project(CatProjectionBean.class) + . firstResult()) + .invoke(catView -> { + // Must keep the letter case + Assertions.assertEquals("GARFIELD", catView.name); + Assertions.assertEquals("JoN ArBuCkLe", catView.ownerName); + }) .replaceWith("OK"); }