Skip to content

Commit

Permalink
[hibernate#1550] Disable tests causing ClassCastException for Db2
Browse files Browse the repository at this point in the history
This seems a bug in the D2 Vert.x Client
  • Loading branch information
DavideD committed Apr 4, 2023
1 parent 74aa816 commit 0dc0e65
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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." );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,31 @@
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;
import jakarta.persistence.Entity;
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",
* as defined by the JPA specification, along with limit parameters
*/
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" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@
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;
import jakarta.persistence.Entity;
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, ...",
Expand All @@ -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" );
Expand Down

0 comments on commit 0dc0e65

Please sign in to comment.