From 0dc0e65cee5bc77e5487d97eb8e83058a6ae774e Mon Sep 17 00:00:00 2001 From: Davide D'Alto Date: Tue, 4 Apr 2023 10:48:21 +0200 Subject: [PATCH] [#1550] Disable tests causing ClassCastException for Db2 This seems a bug in the D2 Vert.x Client --- .../hibernate/reactive/FilterWithPaginationTest.java | 8 ++++++++ .../reactive/HQLQueryParameterNamedLimitTest.java | 10 ++++++++++ .../HQLQueryParameterPositionalLimitTest.java | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FilterWithPaginationTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FilterWithPaginationTest.java index b0852a086e..355d3dca62 100644 --- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FilterWithPaginationTest.java +++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FilterWithPaginationTest.java @@ -20,20 +20,28 @@ import org.hibernate.annotations.ParamDef; import org.hibernate.reactive.mutiny.Mutiny; import org.hibernate.reactive.stage.Stage; +import org.hibernate.reactive.testing.DatabaseSelectionRule; import org.hibernate.type.descriptor.java.StringJavaType; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import io.smallrye.mutiny.Uni; import io.vertx.ext.unit.TestContext; import static org.assertj.core.api.Assertions.assertThat; +import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2; +import static org.hibernate.reactive.testing.DatabaseSelectionRule.skipTestsFor; /** * Test the combination of filters, max results and first result. */ public class FilterWithPaginationTest extends BaseReactiveTest { + // Db2: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long + @Rule + public final DatabaseSelectionRule skipDb2 = skipTestsFor( DB2 ); + FamousPerson margaret = new FamousPerson( 1L, "Margaret Howe Lovatt", Status.LIVING, "the woman who lived in a half-flooded home with a dolphin." ); FamousPerson nellie = new FamousPerson( 2L, "Nellie Bly", Status.DECEASED, "In 1888, she traveled around the world in 72 days." ); FamousPerson hedy = new FamousPerson( 3L, "Hedy Lamarr", Status.DECEASED, "Actress and co-inventor of an early version of frequency-hopping spread spectrum communication for torpedo guidance." ); diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterNamedLimitTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterNamedLimitTest.java index 89a6bce572..ab35c4053f 100644 --- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterNamedLimitTest.java +++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterNamedLimitTest.java @@ -9,7 +9,10 @@ import java.util.List; import java.util.Objects; +import org.hibernate.reactive.testing.DatabaseSelectionRule; + import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import io.vertx.ext.unit.TestContext; @@ -17,6 +20,9 @@ import jakarta.persistence.Id; import jakarta.persistence.Table; +import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.*; +import static org.hibernate.reactive.testing.DatabaseSelectionRule.skipTestsFor; + /** * Tests queries using named parameters like ":name", @@ -24,6 +30,10 @@ */ public class HQLQueryParameterNamedLimitTest extends BaseReactiveTest { + // Db2: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long + @Rule + public DatabaseSelectionRule skip = skipTestsFor( DB2 ); + Flour spelt = new Flour( 1, "Spelt", "An ancient grain, is a hexaploid species of wheat.", "Wheat flour" ); Flour rye = new Flour( 2, "Rye", "Used to bake the traditional sourdough breads of Germany.", "Wheat flour" ); Flour almond = new Flour( 3, "Almond", "made from ground almonds.", "Gluten free" ); diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterPositionalLimitTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterPositionalLimitTest.java index 95c417034a..ef884617e9 100644 --- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterPositionalLimitTest.java +++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/HQLQueryParameterPositionalLimitTest.java @@ -9,7 +9,10 @@ import java.util.List; import java.util.Objects; +import org.hibernate.reactive.testing.DatabaseSelectionRule; + import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import io.vertx.ext.unit.TestContext; @@ -17,6 +20,9 @@ import jakarta.persistence.Id; import jakarta.persistence.Table; +import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2; +import static org.hibernate.reactive.testing.DatabaseSelectionRule.skipTestsFor; + /** * Tests queries using positional parameters like "?1, ?2, ...", @@ -27,6 +33,11 @@ */ public class HQLQueryParameterPositionalLimitTest extends BaseReactiveTest { + // Db2: Parameter at position[0] with class = [java.lang.Integer] and value = [1] can not be coerced to the expected class = [java.lang.Double] for en + //coding. + @Rule + public DatabaseSelectionRule skip = skipTestsFor( DB2 ); + Flour spelt = new Flour( 1, "Spelt", "An ancient grain, is a hexaploid species of wheat.", "Wheat flour" ); Flour rye = new Flour( 2, "Rye", "Used to bake the traditional sourdough breads of Germany.", "Wheat flour" ); Flour almond = new Flour( 3, "Almond", "made from ground almonds.", "Gluten free" );