diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomOneToOneStoredProcedureSqlTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomOneToOneStoredProcedureSqlTest.java
index 451c95fee..5293da9c0 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomOneToOneStoredProcedureSqlTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomOneToOneStoredProcedureSqlTest.java
@@ -5,37 +5,41 @@
*/
package org.hibernate.reactive;
-import io.vertx.junit5.Timeout;
-import io.vertx.junit5.VertxTestContext;
-import jakarta.persistence.*;
+import java.time.LocalDateTime;
+import java.util.Collection;
+import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLInsert;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.ReactiveAssertions;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-import java.time.LocalDateTime;
-import java.util.Collection;
-import java.util.List;
-import static java.util.concurrent.TimeUnit.*;
+import io.vertx.junit5.Timeout;
+import io.vertx.junit5.VertxTestContext;
+import jakarta.persistence.Basic;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+
+import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.*;
-import static org.hibernate.reactive.testing.DBSelectionExtension.*;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@EnabledFor(POSTGRESQL)
public class CustomOneToOneStoredProcedureSqlTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
private IndividualPerson individualPerson;
private DriverLicence driverLicence;
private static final String INITIAL_LICENCE_NO = "12545KLI12";
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomSqlTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomSqlTest.java
index bf6806253..f494588cc 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomSqlTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomSqlTest.java
@@ -12,10 +12,9 @@
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLInsert;
import org.hibernate.annotations.SQLUpdate;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -29,18 +28,15 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@EnabledFor(POSTGRESQL)
+@EnabledFor(COCKROACHDB)
public class CustomSqlTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL, COCKROACHDB );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Record.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomStoredProcedureSqlTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomStoredProcedureSqlTest.java
index 512b23dda..610819f5f 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomStoredProcedureSqlTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomStoredProcedureSqlTest.java
@@ -13,13 +13,12 @@
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLInsert;
import org.hibernate.annotations.SQLUpdate;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.ReactiveAssertions;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -33,18 +32,14 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@EnabledFor(POSTGRESQL)
public class CustomStoredProcedureSqlTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
-
private SimpleRecord theRecord;
private static final String INITIAL_TEXT = "blue suede shoes";
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/EmptyCompositeCollectionKeyTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/EmptyCompositeCollectionKeyTest.java
index fe5b007f6..c879235da 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/EmptyCompositeCollectionKeyTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/EmptyCompositeCollectionKeyTest.java
@@ -13,10 +13,9 @@
import org.hibernate.Hibernate;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -28,19 +27,15 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@Timeout(value = 10, timeUnit = MINUTES)
+@DisabledFor( value = DB2, reason = "IllegalStateException: Needed to have 6 in buffer but only had 0" )
public class EmptyCompositeCollectionKeyTest extends BaseReactiveTest {
- // Db2: Throws java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0. In JDBC we would normally block here but need to find a non-blocking solution
- @RegisterExtension
- public DBSelectionExtension dbSelection = skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Family.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FetchedAssociationTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FetchedAssociationTest.java
index 87e264ff5..579b6ba74 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FetchedAssociationTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FetchedAssociationTest.java
@@ -11,11 +11,10 @@
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.SqlStatementTracker;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -32,18 +31,14 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
/**
* Test that's not necessary to do a fetch when we want to add a new element to an association.
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@EnabledFor(value = POSTGRESQL, reason = "We use native queries, they might be different for other DBs")
public class FetchedAssociationTest extends BaseReactiveTest {
- @RegisterExtension // We use native queries, they might be different for other DBs
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
-
private SqlStatementTracker sqlTracker;
@Override
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 6ba86662d..310a33578 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
@@ -15,12 +15,11 @@
import org.hibernate.annotations.ParamDef;
import org.hibernate.reactive.mutiny.Mutiny;
import org.hibernate.reactive.stage.Stage;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.hibernate.type.descriptor.java.StringJavaType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.smallrye.mutiny.Uni;
import io.vertx.junit5.Timeout;
@@ -36,19 +35,14 @@
import static org.hibernate.query.Page.first;
import static org.hibernate.query.Page.page;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
/**
* Test the combination of filters, max results, first result, and {@link org.hibernate.query.Page}.
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "IllegalStateException: Needed to have 6 in buffer but only had 0")
public class FilterWithPaginationTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = 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/FormulaTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FormulaTest.java
index 202c322b5..64b5ca098 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FormulaTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/FormulaTest.java
@@ -10,11 +10,9 @@
import java.util.List;
import org.hibernate.annotations.Formula;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -25,16 +23,10 @@
import jakarta.persistence.Table;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
@Timeout(value = 10, timeUnit = MINUTES)
-
public class FormulaTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension dbSelection = DBSelectionExtension.skipTestsFor( MARIA, MYSQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Record.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyJoinedTableTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyJoinedTableTest.java
index ec4c20840..018936ad5 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyJoinedTableTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyJoinedTableTest.java
@@ -14,10 +14,9 @@
import org.hibernate.annotations.GenerationTime;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -32,10 +31,9 @@
import jakarta.persistence.TemporalType;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -44,13 +42,9 @@
* Test the @{@link Generated} annotation with {@link InheritanceType#JOINED}
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = {SQLSERVER, ORACLE, DB2}, reason = "test uses SQL queries")
public class GeneratedPropertyJoinedTableTest extends BaseReactiveTest {
- // It requires native queries, so it won't work for every db
- @RegisterExtension
- public DBSelectionExtension selectionRule = runOnlyFor( POSTGRESQL, COCKROACHDB, MYSQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( GeneratedWithIdentity.class, GeneratedRegular.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertySingleTableTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertySingleTableTest.java
index ee64c2aab..0b95dc579 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertySingleTableTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertySingleTableTest.java
@@ -14,10 +14,9 @@
import org.hibernate.annotations.GenerationTime;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -31,10 +30,9 @@
import jakarta.persistence.TemporalType;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -43,13 +41,9 @@
* Test the @{@link Generated} annotation
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = {SQLSERVER, ORACLE, DB2}, reason = "test uses SQL queries")
public class GeneratedPropertySingleTableTest extends BaseReactiveTest {
- // It requires native queries, so it won't work for every db
- @RegisterExtension
- public DBSelectionExtension selectionRule = runOnlyFor( POSTGRESQL, COCKROACHDB, MYSQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( GeneratedWithIdentity.class, GeneratedRegular.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyUnionSubclassesTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyUnionSubclassesTest.java
index fe9c6b455..b024372a8 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyUnionSubclassesTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyUnionSubclassesTest.java
@@ -14,10 +14,9 @@
import org.hibernate.annotations.GenerationTime;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -32,10 +31,9 @@
import jakarta.persistence.TemporalType;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -47,13 +45,9 @@
*
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = {SQLSERVER, ORACLE, DB2}, reason = "test uses SQL queries")
public class GeneratedPropertyUnionSubclassesTest extends BaseReactiveTest {
- // It requires native queries, so it won't work for every db
- @RegisterExtension
- public DBSelectionExtension selectionRule = runOnlyFor( POSTGRESQL, COCKROACHDB, MYSQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( GeneratedRegular.class );
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 7e4871ece..526681840 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,11 +9,10 @@
import java.util.List;
import java.util.Objects;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -24,7 +23,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
@@ -32,13 +30,9 @@
* as defined by the JPA specification, along with limit parameters
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0")
public class HQLQueryParameterNamedLimitTest extends BaseReactiveTest {
- // Db2:java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0.
- @RegisterExtension
- public DBSelectionExtension 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 af24ec69f..3a60a44c0 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,11 +9,10 @@
import java.util.List;
import java.util.Objects;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -24,7 +23,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
@@ -35,13 +33,8 @@
* that should be considered an internal implementation detail.
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
public class HQLQueryParameterPositionalLimitTest extends BaseReactiveTest {
- // Db2: java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0.
- @RegisterExtension
- public DBSelectionExtension 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" );
@@ -83,6 +76,7 @@ public void testFirstResultNoResults(VertxTestContext context) {
}
@Test
+ @DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public void testFirstResultSingleResult(VertxTestContext context) {
test( context, openSession()
.thenCompose( s -> s
@@ -96,6 +90,7 @@ public void testFirstResultSingleResult(VertxTestContext context) {
}
@Test
+ @DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public void testFirstResultMultipleResults(VertxTestContext context) {
test( context, openSession()
.thenCompose( s -> s
@@ -108,6 +103,7 @@ public void testFirstResultMultipleResults(VertxTestContext context) {
}
@Test
+ @DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public void testFirstResultMaxResultsSingleResult(VertxTestContext context) {
test( context, openSession()
.thenCompose( s -> s
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentifierGenerationTypeTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentifierGenerationTypeTest.java
index bcd0f9d0b..38d3904ff 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentifierGenerationTypeTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentifierGenerationTypeTest.java
@@ -10,10 +10,9 @@
import java.util.List;
import java.util.Objects;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -25,7 +24,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -36,14 +34,10 @@
* @see org.hibernate.reactive.id.impl.IdentifierGeneration
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0. " +
+ "See https://github.com/eclipse-vertx/vertx-sql-client/issues/899")
public class IdentifierGenerationTypeTest extends BaseReactiveTest {
- // Vertx DB2 client is throwing "java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0."
- // See https://github.com/eclipse-vertx/vertx-sql-client/issues/899
- @RegisterExtension
- public DBSelectionExtension skip = skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( LongEntity.class, IntegerEntity.class, ShortEntity.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeForCockroachDBTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeForCockroachDBTest.java
index 58321ba3e..c321d914f 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeForCockroachDBTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeForCockroachDBTest.java
@@ -10,10 +10,9 @@
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -27,7 +26,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -43,12 +41,9 @@
* @see IdentityGeneratorTypeTest
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@EnabledFor(COCKROACHDB)
public class IdentityGeneratorTypeForCockroachDBTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension runOnly = runOnlyFor( COCKROACHDB );
-
/**
* When {@link AvailableSettings#USE_GET_GENERATED_KEYS} is enabled, different
* queries will be used for each datastore to get the id
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeTest.java
index a48c9bc0d..a6dfe601a 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/IdentityGeneratorTypeTest.java
@@ -10,10 +10,9 @@
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -25,7 +24,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -37,12 +35,9 @@
*
* @see IdentityGeneratorTest
*/
+@DisabledFor(value = COCKROACHDB, reason = "ids cannot be cast to short or int (they are too big)")
public class IdentityGeneratorTypeTest extends BaseReactiveTest {
- // CockroachDB ids cannot be cast to short or int (they are too big)
- @RegisterExtension
- public DBSelectionExtension skip = skipTestsFor( COCKROACHDB );
-
@Override
protected Collection> annotatedEntities() {
return List.of( IntegerTypeEntity.class, LongTypeEntity.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InsertOrderingReferenceSeveralDifferentSubclassBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InsertOrderingReferenceSeveralDifferentSubclassBase.java
index 919ed4e69..10502332f 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InsertOrderingReferenceSeveralDifferentSubclassBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InsertOrderingReferenceSeveralDifferentSubclassBase.java
@@ -11,11 +11,10 @@
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.SqlStatementTracker;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -34,7 +33,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -44,11 +42,9 @@
* Verify that duplicate sql insert statements are collapsed to a single insert per entity and are ordered based on
* parent/child relationships`
*/
+@EnabledFor(POSTGRESQL)
public abstract class InsertOrderingReferenceSeveralDifferentSubclassBase extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
-
public static class OrderedTest extends InsertOrderingReferenceSeveralDifferentSubclassBase {
@Override
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InternalStateAssertionsTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InternalStateAssertionsTest.java
index 4a8d286dc..e295d5cff 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InternalStateAssertionsTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/InternalStateAssertionsTest.java
@@ -12,10 +12,9 @@
import org.hibernate.reactive.mutiny.Mutiny;
import org.hibernate.reactive.stage.Stage.Session;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.smallrye.mutiny.Uni;
import io.vertx.junit5.Timeout;
@@ -26,7 +25,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
/**
@@ -34,6 +32,10 @@
* @see org.hibernate.reactive.common.InternalStateAssertions
*/
@Timeout(value = 10, timeUnit = MINUTES)
+@EnabledFor(
+ value = POSTGRESQL,
+ reason = "These tests will fail before touching the database, so there is no reason to run them on all databases"
+)
public class InternalStateAssertionsTest extends BaseReactiveTest {
/**
@@ -43,11 +45,6 @@ public class InternalStateAssertionsTest extends BaseReactiveTest {
private Object currentSession;
- // These tests will fail before touching the database, so there is no reason
- // to run them on all databases
- @RegisterExtension
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Competition.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyReplaceOrphanedEntityTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyReplaceOrphanedEntityTest.java
index d14ef3114..084d55ea5 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyReplaceOrphanedEntityTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyReplaceOrphanedEntityTest.java
@@ -11,11 +11,10 @@
import java.util.List;
import java.util.UUID;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -38,13 +37,9 @@
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public class LazyReplaceOrphanedEntityTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
private Campaign theCampaign;
@Override
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyUniqueKeyTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyUniqueKeyTest.java
index b9ce6b0a5..054556a36 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyUniqueKeyTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/LazyUniqueKeyTest.java
@@ -11,10 +11,9 @@
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -29,20 +28,15 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @see EagerUniqueKeyTest
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public class LazyUniqueKeyTest extends BaseReactiveTest {
- // Db2: java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0. In JDBC we would normally block here
- @RegisterExtension
- public DBSelectionExtension skip = skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Foo.class, Bar.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/NativeQueryPlaceholderSubstitutionTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/NativeQueryPlaceholderSubstitutionTest.java
index 1fa546a22..f212a1bab 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/NativeQueryPlaceholderSubstitutionTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/NativeQueryPlaceholderSubstitutionTest.java
@@ -11,11 +11,10 @@
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.SqlStatementTracker;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -27,7 +26,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
/**
* The processing of the query is done by Hibernate ORM in {@link org.hibernate.reactive.query.sql.internal.ReactiveNativeSelectQueryPlanImpl}
@@ -39,11 +37,9 @@
*
*/
@Timeout(value = 10, timeUnit = MINUTES)
+@EnabledFor(POSTGRESQL)
public class NativeQueryPlaceholderSubstitutionTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension dbRule = runOnlyFor( POSTGRESQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Widget.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ORMReactivePersistenceTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ORMReactivePersistenceTest.java
index e0166881e..00c9b9ee7 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ORMReactivePersistenceTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ORMReactivePersistenceTest.java
@@ -14,12 +14,11 @@
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -41,13 +40,10 @@
* This test class verifies that data can be persisted and queried on the same database
* using both JPA/hibernate and reactive session factories.
*/
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
+@DisabledFor(value = COCKROACHDB, reason = "We need to change the URL schema we normally use for testing")
public class ORMReactivePersistenceTest extends BaseReactiveTest {
- // DB2: The CompletionStage test throw java.lang.IllegalStateException: Needed to have 6 in buffer...
- // Cockroach: We need to change the URL schema we normally use for testing
- @RegisterExtension
- public DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2, COCKROACHDB );
-
private SessionFactory ormFactory;
@Override
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderQueriesTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderQueriesTestBase.java
index c7788e4e2..62d5e4c5c 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderQueriesTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderQueriesTestBase.java
@@ -13,12 +13,11 @@
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.SqlStatementTracker;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.smallrye.mutiny.Uni;
import io.vertx.junit5.Timeout;
@@ -30,7 +29,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
/**
* Test {@code hibernate.order_updates} and {@code hibernate.order_inserts} configurations.
@@ -38,11 +36,9 @@
* @see Settings#ORDER_INSERTS
* @see Settings#ORDER_UPDATES
*/
-public abstract class OrderQueriesTestBase extends BaseReactiveTest {
- //Db2: java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0. In JDBC we would normally block
- @RegisterExtension
- public final DBSelectionExtension skip = skipTestsFor( DB2 );
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
+public abstract class OrderQueriesTestBase extends BaseReactiveTest {
public static class OrderUpdatesTest extends OrderQueriesTestBase {
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderedEmbeddableCollectionTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderedEmbeddableCollectionTest.java
index 509ce08fc..93b6d9ec0 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderedEmbeddableCollectionTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderedEmbeddableCollectionTest.java
@@ -10,7 +10,12 @@
import java.util.List;
import java.util.Objects;
+import org.hibernate.Hibernate;
+
+import org.junit.jupiter.api.Test;
+
import io.vertx.junit5.Timeout;
+import io.vertx.junit5.VertxTestContext;
import jakarta.persistence.Basic;
import jakarta.persistence.CollectionTable;
import jakarta.persistence.ElementCollection;
@@ -20,17 +25,9 @@
import jakarta.persistence.Id;
import jakarta.persistence.OrderColumn;
import jakarta.persistence.Table;
-
-import org.hibernate.Hibernate;
-import org.hibernate.reactive.testing.DBSelectionExtension;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-import io.vertx.junit5.VertxTestContext;
import org.assertj.core.api.Assertions;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -38,9 +35,6 @@
@Timeout(value = 10, timeUnit = MINUTES)
public class OrderedEmbeddableCollectionTest extends BaseReactiveTest {
- @RegisterExtension // This exposes a strange bug in the DB2 client
- public DBSelectionExtension dbRule = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Author.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrphanRemovalTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrphanRemovalTest.java
index 7077fdbe5..f45fa8be6 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrphanRemovalTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrphanRemovalTest.java
@@ -10,10 +10,10 @@
import java.util.List;
import java.util.Set;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -29,15 +29,12 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
@Timeout( value = 10, timeUnit = MINUTES)
+@DisabledFor( value = DB2, reason = "IllegalStateException: Needed to have 6 in buffer but only had 0" )
public class OrphanRemovalTest extends BaseReactiveTest {
- //Db2: java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0. In JDBC we would normally block
- @RegisterExtension
- public final DBSelectionExtension skip = skipTestsFor( DB2 );
@Override
protected Collection> annotatedEntities() {
return List.of( Shop.class, Version.class, Product.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantNoResolverTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantNoResolverTest.java
index cdc14829f..81f3469cb 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantNoResolverTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantNoResolverTest.java
@@ -15,10 +15,9 @@
import org.hibernate.reactive.mutiny.Mutiny;
import org.hibernate.reactive.provider.Settings;
import org.hibernate.reactive.stage.Stage;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.smallrye.mutiny.Uni;
import io.vertx.junit5.Timeout;
@@ -34,7 +33,6 @@
import static org.hibernate.reactive.MyCurrentTenantIdentifierResolver.Tenant.TENANT_1;
import static org.hibernate.reactive.MyCurrentTenantIdentifierResolver.Tenant.TENANT_2;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -51,13 +49,9 @@
* @see ReactiveMultitenantTest
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@EnabledFor(value = POSTGRESQL, reason = "Native queries for this test are targeted for PostgreSQL")
public class ReactiveMultitenantNoResolverTest extends BaseReactiveTest {
- // To check if we are using the right database we run native queries for PostgreSQL
- @RegisterExtension
- public DBSelectionExtension selectionRule = runOnlyFor( POSTGRESQL );
-
@Override
protected Configuration constructConfiguration() {
Configuration configuration = super.constructConfiguration();
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantTest.java
index 626a17b9c..84e7e92c9 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/ReactiveMultitenantTest.java
@@ -11,10 +11,9 @@
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -38,15 +37,11 @@
* on the database for the selected tenant.
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
+@EnabledFor(value = POSTGRESQL, reason = "Native queries for this test are targeted for PostgreSQL")
public class ReactiveMultitenantTest extends BaseReactiveTest {
private static final MyCurrentTenantIdentifierResolver TENANT_RESOLVER = new MyCurrentTenantIdentifierResolver();
- // To check if we are using the right database we run native queries for PostgreSQL
- @RegisterExtension
- public DBSelectionExtension selectionRule = DBSelectionExtension.runOnlyFor( POSTGRESQL );
-
@Override
protected Configuration constructConfiguration() {
Configuration configuration = super.constructConfiguration();
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/RowIdUpdateAndDeleteTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/RowIdUpdateAndDeleteTest.java
index af84be1e0..5d97537e5 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/RowIdUpdateAndDeleteTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/RowIdUpdateAndDeleteTest.java
@@ -11,12 +11,11 @@
import org.hibernate.annotations.RowId;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.SqlStatementTracker;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.VertxTestContext;
import jakarta.persistence.CascadeType;
@@ -30,18 +29,14 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
/**
* Adapted from the test with the same name in Hibernate ORM: {@literal org.hibernate.orm.test.rowid.RowIdUpdateAndDeleteTest}
*/
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
+@DisabledFor(value = ORACLE, reason = "Vert.x driver doesn't support RowId type parameters")
public class RowIdUpdateAndDeleteTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- // Oracle: Vert.x driver doesn't support RowId type parameters
- @RegisterExtension
- public final DBSelectionExtension skip = skipTestsFor( DB2, ORACLE );
-
private static SqlStatementTracker sqlTracker;
@Override
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SQLSelectTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SQLSelectTest.java
index e7990e486..f4d6d1176 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SQLSelectTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SQLSelectTest.java
@@ -12,12 +12,11 @@
import org.hibernate.annotations.SQLSelect;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.hibernate.reactive.testing.SqlStatementTracker;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.VertxTestContext;
import jakarta.persistence.Entity;
@@ -25,12 +24,11 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.reactive.SQLSelectTest.Person.SELECT_QUERY;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
+@EnabledFor(value = {POSTGRESQL, COCKROACHDB}, reason = "Test uses native queries")
public class SQLSelectTest extends BaseReactiveTest {
- @RegisterExtension // We use native queries, which may be different for other DBs
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
private SqlStatementTracker sqlTracker;
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SecondaryTableTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SecondaryTableTest.java
index 66d9cd30f..ee835eee4 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SecondaryTableTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SecondaryTableTest.java
@@ -10,10 +10,10 @@
import java.util.List;
import java.util.Objects;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -29,7 +29,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -37,12 +36,9 @@
@Timeout(value = 10, timeUnit = MINUTES)
+@DisabledFor( value = DB2, reason = "IllegalStateException: Needed to have 6 in buffer but only had 0" )
public class SecondaryTableTest extends BaseReactiveTest {
- //Db2: java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0. In JDBC we would normally block
- @RegisterExtension
- public final DBSelectionExtension skip = skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Book.class, Author.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SequenceGeneratorTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SequenceGeneratorTest.java
index 7f7f996e8..60cb625f7 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SequenceGeneratorTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/SequenceGeneratorTest.java
@@ -12,10 +12,9 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.containers.DatabaseConfiguration;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -35,7 +34,8 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = MYSQL, reason = "See https://github.com/hibernate/hibernate-reactive/issues/1525")
+@DisabledFor(value = COCKROACHDB, reason = "we don't have permission to create schema in the CI!")
public class SequenceGeneratorTest extends BaseReactiveTest {
@Override
@@ -74,11 +74,6 @@ public void testSequenceGenerator(VertxTestContext context) {
public static class SequenceGeneratorDefaultSchemaTest extends SequenceGeneratorTest {
- // COCKROACHDB: we don't have permission to create schema in the CI!
- // MYSQL: See https://github.com/hibernate/hibernate-reactive/issues/1525
- @RegisterExtension
- public DBSelectionExtension dbRule = DBSelectionExtension.skipTestsFor( COCKROACHDB, MYSQL );
-
@Override
protected Configuration constructConfiguration() {
Configuration configuration = super.constructConfiguration();
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/UUIDGeneratorTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/UUIDGeneratorTest.java
index b9bf175f8..76ac3f4f2 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/UUIDGeneratorTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/UUIDGeneratorTest.java
@@ -10,10 +10,8 @@
import java.util.Objects;
import java.util.UUID;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -25,17 +23,12 @@
import jakarta.persistence.Version;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Timeout(value = 10, timeUnit = MINUTES)
-
public class UUIDGeneratorTest extends BaseReactiveTest {
- @RegisterExtension // Storing UUID doesn't work with DB2
- public DBSelectionExtension dbRule = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( TableId.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledFor.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledFor.java
new file mode 100644
index 000000000..04dd0906a
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledFor.java
@@ -0,0 +1,32 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.hibernate.reactive.containers.DatabaseConfiguration;
+
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * Test will be disabled for the selected {@link org.hibernate.reactive.containers.DatabaseConfiguration.DBType}
+ *
+ * @see EnabledFor
+ */
+@Inherited
+@Retention( RetentionPolicy.RUNTIME )
+@Target({ ElementType.TYPE, ElementType.METHOD})
+@Repeatable( DisabledForDbTypes.class )
+@ExtendWith( DisabledForDBTypeCondition.class )
+public @interface DisabledFor {
+ DatabaseConfiguration.DBType[] value();
+ String reason() default "";
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledForDBTypeCondition.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledForDBTypeCondition.java
new file mode 100644
index 000000000..7d7369a06
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledForDBTypeCondition.java
@@ -0,0 +1,49 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.hibernate.reactive.containers.DatabaseConfiguration.DBType;
+
+import org.junit.jupiter.api.extension.ConditionEvaluationResult;
+import org.junit.jupiter.api.extension.ExecutionCondition;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
+import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
+import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
+import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations;
+
+class DisabledForDBTypeCondition implements ExecutionCondition {
+
+ @Override
+ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
+ List annotations = findRepeatableAnnotations( context.getElement(), DisabledFor.class );
+ if ( !annotations.isEmpty() ) {
+ return evaluateAnnotation( annotations );
+ }
+ return enabled( "No @DisabledFor condition resulting in 'disabled' execution encountered" );
+ }
+
+ private ConditionEvaluationResult evaluateAnnotation(Iterable values) {
+ StringBuilder disabledList = new StringBuilder( "," );
+ for ( DisabledFor annotation : values ) {
+ for ( DBType enabledDbType : annotation.value() ) {
+ if ( enabledDbType == dbType() ) {
+ return disabled( annotation.reason() );
+ }
+ disabledList.append( ',' ).append( Arrays.toString( annotation.value() ) );
+ }
+ }
+ return enabled( String.format(
+ "%s does not match any db in the disabled list: %s",
+ dbType(),
+ disabledList.substring( 1 )
+ ) );
+ }
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledForDbTypes.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledForDbTypes.java
new file mode 100644
index 000000000..c1a1d4d30
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/DisabledForDbTypes.java
@@ -0,0 +1,26 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * Allow repeatable {@link DisabledFor} annotations
+ */
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+@ExtendWith(DisabledForDBTypeCondition.class)
+public @interface DisabledForDbTypes {
+ DisabledFor[] value();
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledFor.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledFor.java
new file mode 100644
index 000000000..84dc1c1c2
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledFor.java
@@ -0,0 +1,32 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.hibernate.reactive.containers.DatabaseConfiguration;
+
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * Test will run only for the selected {@link org.hibernate.reactive.containers.DatabaseConfiguration.DBType}
+ *
+ * @see DisabledFor
+ */
+@Inherited
+@Retention( RetentionPolicy.RUNTIME )
+@Target({ ElementType.TYPE, ElementType.METHOD})
+@Repeatable( EnabledForDbTypes.class )
+@ExtendWith( EnabledForDBTypeCondition.class )
+public @interface EnabledFor {
+ DatabaseConfiguration.DBType[] value();
+ String reason() default "";
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledForDBTypeCondition.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledForDBTypeCondition.java
new file mode 100644
index 000000000..226334457
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledForDBTypeCondition.java
@@ -0,0 +1,49 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.hibernate.reactive.containers.DatabaseConfiguration.DBType;
+
+import org.junit.jupiter.api.extension.ConditionEvaluationResult;
+import org.junit.jupiter.api.extension.ExecutionCondition;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
+import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
+import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
+import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations;
+
+public class EnabledForDBTypeCondition implements ExecutionCondition {
+
+ @Override
+ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
+ List annotations = findRepeatableAnnotations( context.getElement(), EnabledFor.class );
+ if ( !annotations.isEmpty() ) {
+ return evaluateAnnotation( annotations );
+ }
+ return enabled( "No @EnabledFor condition resulting in 'disabled' execution encountered" );
+ }
+
+ private ConditionEvaluationResult evaluateAnnotation(Iterable values) {
+ StringBuilder enabledList = new StringBuilder( "," );
+ for ( EnabledFor annotation : values ) {
+ for ( DBType enabledDbType : annotation.value() ) {
+ if ( enabledDbType == dbType() ) {
+ return enabled( annotation.reason() );
+ }
+ enabledList.append( ',' ).append( Arrays.toString( annotation.value() ) );
+ }
+ }
+ return disabled( String.format(
+ "%s does not match any db in the enabled list: %s",
+ dbType(),
+ enabledList.substring( 1 )
+ ) );
+ }
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledForDbTypes.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledForDbTypes.java
new file mode 100644
index 000000000..ddda545cd
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/EnabledForDbTypes.java
@@ -0,0 +1,26 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * Allow repeatable {@link EnabledFor} annotations
+ */
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+@ExtendWith(EnabledForDBTypeCondition.class)
+public @interface EnabledForDbTypes {
+ EnabledFor[] value();
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/tests/FilterByDbTypeOnClassTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/tests/FilterByDbTypeOnClassTest.java
new file mode 100644
index 000000000..0bfd1c537
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/tests/FilterByDbTypeOnClassTest.java
@@ -0,0 +1,102 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations.tests;
+
+import org.hibernate.reactive.annotations.DisabledFor;
+import org.hibernate.reactive.annotations.DisabledForDbTypes;
+import org.hibernate.reactive.annotations.EnabledFor;
+import org.hibernate.reactive.annotations.EnabledForDbTypes;
+
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
+
+public class FilterByDbTypeOnClassTest {
+
+ @Nested
+ @DisabledFor(value = POSTGRESQL, reason = "some reason")
+ class DisabledForOneDbType {
+ @Test
+ public void test() {
+ assertThat( dbType() ).isNotIn( POSTGRESQL );
+ }
+ }
+
+ @Nested
+ @DisabledFor({POSTGRESQL, MYSQL, DB2})
+ class DisabledForMultipleDbType {
+ @Test
+ public void test() {
+ assertThat( dbType() ).isNotIn( POSTGRESQL, MYSQL, DB2 );
+ }
+ }
+
+ @Nested
+ @DisabledFor(value = MYSQL, reason = "some reason")
+ @DisabledFor(value = POSTGRESQL, reason = "some reason")
+ class DisabledForRepeatableTest {
+ @Test
+ public void testDisabledRepeatable() {
+ assertThat( dbType() ).isNotIn( POSTGRESQL, MYSQL );
+ }
+ }
+
+ @Nested
+ @DisabledForDbTypes({
+ @DisabledFor(MYSQL),
+ @DisabledFor(POSTGRESQL)
+ })
+ class DisabledForGroupTest {
+ @Test
+ public void testDisabledRepeatable() {
+ assertThat( dbType() ).isNotIn( POSTGRESQL, MYSQL );
+ }
+ }
+
+ @Nested
+ @EnabledFor(POSTGRESQL)
+ class EnabledForForOneDbTypeTest {
+ @Test
+ public void test() {
+ assertThat( dbType() ).isEqualTo( POSTGRESQL );
+ }
+ }
+
+ @Nested
+ @EnabledFor(value = {POSTGRESQL, MYSQL, DB2}, reason = "some reason")
+ class EnabledForForMultipleDbTypeTest {
+ @Test
+ public void test() {
+ assertThat( dbType() ).isIn( POSTGRESQL, MYSQL, DB2 );
+ }
+ }
+
+ @Nested
+ @EnabledFor(value = {POSTGRESQL, MYSQL, DB2}, reason = "some reason")
+ class EnabledForRepeatableDbTypeTest {
+ @Test
+ public void test() {
+ assertThat( dbType() ).isIn( POSTGRESQL, MYSQL, DB2 );
+ }
+ }
+
+ @Nested
+ @EnabledForDbTypes({
+ @EnabledFor(MYSQL),
+ @EnabledFor(POSTGRESQL)
+ })
+ class EnabledForForGroupTest {
+ @Test
+ public void test() {
+ assertThat( dbType() ).isIn( POSTGRESQL, MYSQL );
+ }
+ }
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/tests/FilterByDbTypeOnMethodTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/tests/FilterByDbTypeOnMethodTest.java
new file mode 100644
index 000000000..e76496bc8
--- /dev/null
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/annotations/tests/FilterByDbTypeOnMethodTest.java
@@ -0,0 +1,82 @@
+/* Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright: Red Hat Inc. and Hibernate Authors
+ */
+package org.hibernate.reactive.annotations.tests;
+
+import org.hibernate.reactive.annotations.DisabledFor;
+import org.hibernate.reactive.annotations.DisabledForDbTypes;
+import org.hibernate.reactive.annotations.EnabledFor;
+import org.hibernate.reactive.annotations.EnabledForDbTypes;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
+
+public class FilterByDbTypeOnMethodTest {
+
+ @Test
+ @DisabledFor(POSTGRESQL)
+ public void testDisableOneDb() {
+ // Throw exception if this test is run with POSTGRESQL database
+ assertThat( dbType() ).isNotEqualTo( POSTGRESQL );
+ }
+
+ @Test
+ @DisabledFor(value = {POSTGRESQL, MYSQL, DB2}, reason = "some reason")
+ public void testDisableMultipleDbs() {
+ // Throw exception if this test is run with POSTGRESQL database
+ assertThat( dbType() ).isNotIn( POSTGRESQL, MYSQL, DB2 );
+ }
+
+ @Test
+ @DisabledFor(value = MYSQL, reason = "some reason")
+ @DisabledFor(value = POSTGRESQL, reason = "some reason")
+ public void testDisabledRepeatable() {
+ // Throw exception if this test is run with POSTGRESQL or MYSQL database
+ assertThat( dbType() ).isNotIn( POSTGRESQL, MYSQL );
+ }
+
+ @Test
+ @DisabledForDbTypes({
+ @DisabledFor(MYSQL),
+ @DisabledFor(POSTGRESQL)
+ })
+ public void testDisabledForGroup() {
+ // Throw exception if this test is run with POSTGRESQL or MYSQL database
+ assertThat( dbType() ).isNotIn( POSTGRESQL, MYSQL );
+ }
+
+ @Test
+ @EnabledFor(POSTGRESQL)
+ public void testEnabledForForOneDb() {
+ assertThat( dbType() ).isEqualTo( POSTGRESQL );
+ }
+
+ @Test
+ @EnabledFor(value = {POSTGRESQL, MYSQL, DB2}, reason = "some reason")
+ public void testEnabledForMultipleDbs() {
+ assertThat( dbType() ).isIn( POSTGRESQL, MYSQL, DB2 );
+ }
+
+ @Test
+ @EnabledFor(value = MYSQL, reason = "some reason")
+ @EnabledFor(value = POSTGRESQL, reason = "some reason")
+ public void testEnabledForRepeatable() {
+ assertThat( dbType() ).isIn( POSTGRESQL, MYSQL );
+ }
+
+ @Test
+ @EnabledForDbTypes({
+ @EnabledFor(MYSQL),
+ @EnabledFor(POSTGRESQL)
+ })
+ public void testEnabledForForGroup() {
+ assertThat( dbType() ).isIn( POSTGRESQL, MYSQL );
+ }
+}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/configuration/ReactiveConnectionPoolTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/configuration/ReactiveConnectionPoolTest.java
index 06f904671..1e755aa62 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/configuration/ReactiveConnectionPoolTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/configuration/ReactiveConnectionPoolTest.java
@@ -18,8 +18,8 @@
import org.hibernate.reactive.pool.impl.DefaultSqlClientPool;
import org.hibernate.reactive.pool.impl.DefaultSqlClientPoolConfiguration;
import org.hibernate.reactive.pool.impl.SqlClientPoolConfiguration;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.hibernate.reactive.testing.TestingRegistryExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
@@ -39,23 +39,21 @@
import static org.hibernate.reactive.BaseReactiveTest.test;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
import static org.hibernate.reactive.containers.DatabaseConfiguration.getJdbcUrl;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertThrown;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ExtendWith(VertxExtension.class)
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
@Timeout(value = 10, timeUnit = TimeUnit.MINUTES)
+@EnabledFor(value = POSTGRESQL, reason = "Create new scratch file from selection")
public class ReactiveConnectionPoolTest {
- @RegisterExtension
- public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
-
@RegisterExtension
public TestingRegistryExtension registryExtension = new TestingRegistryExtension();
+ // Everything should work when running in a Vert.x context
@RegisterExtension
- public RunTestOnContext testOnContext = new RunTestOnContext();
+ public static final RunTestOnContext testOnContext = new RunTestOnContext();
private ReactiveConnectionPool configureAndStartPool(Map config) {
DefaultSqlClientPoolConfiguration poolConfig = new DefaultSqlClientPoolConfiguration();
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateCockroachDBTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateCockroachDBTestBase.java
index 4a9b78217..44b34c154 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateCockroachDBTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateCockroachDBTestBase.java
@@ -11,12 +11,11 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -41,10 +40,10 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+@EnabledFor(COCKROACHDB)
public abstract class SchemaUpdateCockroachDBTestBase extends BaseReactiveTest {
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class IndividuEachySchemaUpdateCockroachTestBase extends SchemaUpdateCockroachDBTestBase {
@Override
@@ -56,7 +55,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
}
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class GroupedSchemaUpdateCockroachTestBase extends SchemaUpdateCockroachDBTestBase {
@Override
@@ -74,9 +72,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
return configuration;
}
- @RegisterExtension
- public DBSelectionExtension dbRule = DBSelectionExtension.runOnlyFor( COCKROACHDB );
-
@BeforeEach
@Override
public void before(VertxTestContext context) {
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMariaDBTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMariaDBTestBase.java
index a66b68c42..7afed941e 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMariaDBTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMariaDBTestBase.java
@@ -8,6 +8,15 @@
import java.io.Serializable;
import java.util.Objects;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.reactive.BaseReactiveTest;
+import org.hibernate.reactive.provider.Settings;
+import org.hibernate.reactive.annotations.EnabledFor;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
import jakarta.persistence.CascadeType;
@@ -23,28 +32,17 @@
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.INDIVIDUALLY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+@EnabledFor(MARIA)
public abstract class SchemaUpdateMariaDBTestBase extends BaseReactiveTest {
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class IndividuallySchemaUpdateMariaDBTestBase
extends SchemaUpdateMariaDBTestBase {
@@ -74,9 +72,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
return configuration;
}
- @RegisterExtension
- public DBSelectionExtension dbRule = DBSelectionExtension.runOnlyFor( MARIA );
-
@BeforeEach
@Override
public void before(VertxTestContext context) {
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMySqlTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMySqlTestBase.java
index bef5a6a53..501a72282 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMySqlTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateMySqlTestBase.java
@@ -11,12 +11,11 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -40,6 +39,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+@EnabledFor(MYSQL)
public abstract class SchemaUpdateMySqlTestBase extends BaseReactiveTest {
@Timeout(value = 10, timeUnit = MINUTES)
@@ -71,9 +71,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
return configuration;
}
- @RegisterExtension
- public DBSelectionExtension dbRule = DBSelectionExtension.runOnlyFor( MYSQL );
-
@BeforeEach
@Override
public void before(VertxTestContext context) {
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateOracleTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateOracleTestBase.java
index 147cba94a..2e26d2751 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateOracleTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateOracleTestBase.java
@@ -8,6 +8,15 @@
import java.io.Serializable;
import java.util.Objects;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.reactive.BaseReactiveTest;
+import org.hibernate.reactive.provider.Settings;
+import org.hibernate.reactive.annotations.EnabledFor;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
import jakarta.persistence.CascadeType;
@@ -23,31 +32,17 @@
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.INDIVIDUALLY;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+@EnabledFor(ORACLE)
public abstract class SchemaUpdateOracleTestBase extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension dbRule = runOnlyFor( ORACLE );
-
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class IndividuallySchemaUpdateOracleTestBase extends SchemaUpdateOracleTestBase {
@Override
@@ -59,7 +54,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
}
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class GroupedSchemaUpdateOracleTestBase extends SchemaUpdateOracleTestBase {
@Override
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdatePostgreSqlTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdatePostgreSqlTestBase.java
index 972aea7de..ded7f0904 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdatePostgreSqlTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdatePostgreSqlTestBase.java
@@ -8,6 +8,15 @@
import java.io.Serializable;
import java.util.Objects;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.reactive.BaseReactiveTest;
+import org.hibernate.reactive.provider.Settings;
+import org.hibernate.reactive.annotations.EnabledFor;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
import jakarta.persistence.CascadeType;
@@ -23,16 +32,6 @@
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
@@ -41,10 +40,10 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
+@EnabledFor(POSTGRESQL)
public abstract class SchemaUpdatePostgreSqlTestBase extends BaseReactiveTest {
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class IndividuallySchemaUpdatePostgreSqlTestBase extends SchemaUpdatePostgreSqlTestBase {
@Override
@@ -56,7 +55,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
}
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class GroupedSchemaUpdatePostgreSqlTestBase extends SchemaUpdatePostgreSqlTestBase {
@Override
@@ -74,9 +72,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
return configuration;
}
- @RegisterExtension
- public DBSelectionExtension dbRule = DBSelectionExtension.runOnlyFor( POSTGRESQL );
-
@BeforeEach
@Override
public void before(VertxTestContext context) {
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateSqlServerTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateSqlServerTestBase.java
index c93a3a4de..1ebcf85d7 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateSqlServerTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateSqlServerTestBase.java
@@ -12,12 +12,11 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.EnabledFor;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -41,6 +40,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+@EnabledFor(SQLSERVER)
public abstract class SchemaUpdateSqlServerTestBase extends BaseReactiveTest {
// This is the default chosen by MSSQL
@@ -50,7 +50,6 @@ public abstract class SchemaUpdateSqlServerTestBase extends BaseReactiveTest {
* Test INDIVIDUALLY option without setting the default catalog name
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class IndividuallySchemaUpdateSqlServerTest extends SchemaUpdateSqlServerTestBase {
@Override
@@ -65,7 +64,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
* Test INDIVIDUALLY option when we set the catalog name to the default name
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class IndividuallySchemaUpdateWithCatalogTest extends SchemaUpdateSqlServerTestBase {
@Override
@@ -80,7 +78,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
* Test GROUPED option without setting the default catalog name
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class GroupedSchemaUpdateSqlServerTest extends SchemaUpdateSqlServerTestBase {
@Override
@@ -95,7 +92,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
* Test GROUPED option when we set the catalog name to default name
*/
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class GroupedSchemaUpdateWithCatalogNameTest extends SchemaUpdateSqlServerTestBase {
@Override
@@ -113,9 +109,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
return configuration;
}
- @RegisterExtension
- public DBSelectionExtension dbRule = DBSelectionExtension.runOnlyFor( SQLSERVER );
-
@BeforeEach
@Override
public void before(VertxTestContext context) {
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateTestBase.java
index 86d30df19..7cc63bc4c 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaUpdateTestBase.java
@@ -11,12 +11,11 @@
import org.hibernate.reactive.BaseReactiveTest;
import org.hibernate.reactive.provider.Settings;
import org.hibernate.reactive.stage.Stage;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -25,7 +24,6 @@
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.GROUPED;
import static org.hibernate.tool.schema.JdbcMetadaAccessStrategy.INDIVIDUALLY;
@@ -33,10 +31,10 @@
* Schema update will run different queries when the table already exists or
* when columns are missing.
*/
+@DisabledFor(value = DB2, reason = "No InformationExtractor for Dialect [org.hibernate.dialect.DB2Dialect..]")
public abstract class SchemaUpdateTestBase extends BaseReactiveTest {
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class IndividuallyStrategyTest extends SchemaUpdateTestBase {
@Override
@@ -48,7 +46,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
}
@Timeout(value = 10, timeUnit = MINUTES)
-
public static class GroupedStrategyTest extends SchemaUpdateTestBase {
@Override
@@ -59,9 +56,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
}
}
- @RegisterExtension
- public DBSelectionExtension dbRule = skipTestsFor( DB2 );
-
protected Configuration constructConfiguration(String action) {
Configuration configuration = super.constructConfiguration();
configuration.setProperty( Settings.HBM2DDL_AUTO, action );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaValidationTestBase.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaValidationTestBase.java
index 814344cdb..15f9c7e37 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaValidationTestBase.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/schema/SchemaValidationTestBase.java
@@ -10,13 +10,12 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
import org.hibernate.reactive.provider.Settings;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.hibernate.tool.schema.spi.SchemaManagementException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -39,6 +38,7 @@
* - TODO: Missing column
* - TODO: Wrong column type
*/
+@DisabledFor(value = DB2, reason = "No InformationExtractor for Dialect [org.hibernate.dialect.DB2Dialect..]")
public abstract class SchemaValidationTestBase extends BaseReactiveTest {
public static class IndividuallyStrategyTest extends SchemaValidationTestBase {
@@ -61,9 +61,6 @@ protected Configuration constructConfiguration(String hbm2DdlOption) {
}
}
- @RegisterExtension
- public DBSelectionExtension dbRule = DBSelectionExtension.skipTestsFor( DB2 );
-
protected Configuration constructConfiguration(String action) {
Configuration configuration = super.constructConfiguration();
configuration.setProperty( Settings.HBM2DDL_JDBC_METADATA_EXTRACTOR_STRATEGY, INDIVIDUALLY.toString() );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/testing/DBSelectionExtension.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/testing/DBSelectionExtension.java
deleted file mode 100644
index 9038f01f0..000000000
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/testing/DBSelectionExtension.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Hibernate, Relational Persistence for Idiomatic Java
- *
- * SPDX-License-Identifier: Apache-2.0
- * Copyright: Red Hat Inc. and Hibernate Authors
- */
-package org.hibernate.reactive.testing;
-
-import java.util.Arrays;
-import java.util.stream.Collectors;
-
-import org.hibernate.reactive.containers.DatabaseConfiguration.DBType;
-
-import org.junit.jupiter.api.extension.ConditionEvaluationResult;
-import org.junit.jupiter.api.extension.ExecutionCondition;
-import org.junit.jupiter.api.extension.ExtensionContext;
-
-import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
-import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled;
-import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled;
-
-/**
- * Define which db is enabled for the tests in a class.
- *
- * Examples of use:
- *
- * {@code
- *
- * @RegisterExtension public DBSelectionExtension dbSelection = DBSelectionExtension.skipTestsFor( DBType.POSTGRESQL );
- * }
- *
- * {@code
- * @RegisterExtension public DBSelectionExtension dbSelection = DBSelectionExtension.runOnlyFor( DBType.POSTGRESQL );
- * }
- *
- * @see DBType
- */
-public class DBSelectionExtension implements ExecutionCondition {
-
- /**
- * The selected db for running the tests
- */
- private final DBType selectedDb = dbType();
-
- /**
- * Skip the tests for these dbs
- */
- private final DBType[] skippable;
- private final String description;
-
- private DBSelectionExtension(DBType[] skippable, String description) {
- this.skippable = skippable;
- this.description = description;
- }
-
- /**
- * Create an extension that will skip the tests for the selected dbs
- *
- * @param dbTypes the dbs we want to skip
- *
- * @return an instance of {@link DBSelectionExtension}
- */
- public static DBSelectionExtension skipTestsFor(DBType... dbTypes) {
- return new DBSelectionExtension( dbTypes, "Skip tests for " + Arrays.toString( dbTypes ) );
- }
-
- /**
- * Create an extension that will run the tests only for the selected dbs
- *
- * @param dbTypes the dbs we want to use for running the tests
- *
- * @return an instance of {@link DBSelectionExtension}
- */
- public static DBSelectionExtension runOnlyFor(DBType... dbTypes) {
- DBType[] skippable = Arrays.stream( DBType.values() )
- .filter( dbType -> !Arrays.asList( dbTypes ).contains( dbType ) )
- .collect( Collectors.toList() )
- .toArray( new DBType[dbTypes.length] );
- return new DBSelectionExtension( skippable, "Run only for " + Arrays.toString( dbTypes ) );
- }
-
- private boolean isSkippable(DBType dbType) {
- for ( DBType db : skippable ) {
- if ( db == dbType ) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
- return isSkippable( selectedDb )
- ? disabled( "Test is not applicable for " + dbType().toString() )
- : enabled( "" );
- }
-}
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/AutoZonedTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/AutoZonedTest.java
index cad133056..a799f5d6b 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/AutoZonedTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/AutoZonedTest.java
@@ -13,7 +13,7 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import java.time.OffsetDateTime;
import java.time.ZoneId;
@@ -23,7 +23,6 @@
import java.util.List;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
@@ -33,13 +32,9 @@
import static org.hibernate.type.descriptor.DateTimeUtils.roundToDefaultPrecision;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public class AutoZonedTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Zoned.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/ColumnZonedTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/ColumnZonedTest.java
index 37c37a60b..f10e394e1 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/ColumnZonedTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/ColumnZonedTest.java
@@ -5,16 +5,6 @@
*/
package org.hibernate.reactive.timezones;
-import io.vertx.junit5.Timeout;
-import io.vertx.junit5.VertxTestContext;
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.Id;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
-
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
@@ -22,8 +12,17 @@
import java.util.Collection;
import java.util.List;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.reactive.BaseReactiveTest;
+import org.hibernate.reactive.annotations.DisabledFor;
+
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+
+import io.vertx.junit5.Timeout;
+import io.vertx.junit5.VertxTestContext;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.Id;
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
@@ -33,13 +32,9 @@
import static org.hibernate.type.descriptor.DateTimeUtils.roundToDefaultPrecision;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "java.sql.SQLException: An error occurred with a DB2 operation, SQLCODE=-180 SQLSTATE=22007")
public class ColumnZonedTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Zoned.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/DefaultZonedTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/DefaultZonedTest.java
index 598693364..6752b7219 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/DefaultZonedTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/DefaultZonedTest.java
@@ -5,16 +5,6 @@
*/
package org.hibernate.reactive.timezones;
-import io.vertx.junit5.Timeout;
-import io.vertx.junit5.VertxTestContext;
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.Id;
-
-import org.hibernate.dialect.TimeZoneSupport;
-import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
-
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
@@ -22,8 +12,17 @@
import java.util.Collection;
import java.util.List;
+import org.hibernate.dialect.TimeZoneSupport;
+import org.hibernate.reactive.BaseReactiveTest;
+import org.hibernate.reactive.annotations.DisabledFor;
+
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
+
+import io.vertx.junit5.Timeout;
+import io.vertx.junit5.VertxTestContext;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.Id;
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
@@ -32,13 +31,9 @@
import static org.hibernate.type.descriptor.DateTimeUtils.roundToDefaultPrecision;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public class DefaultZonedTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Zoned.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/JDBCTimeZoneZonedTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/JDBCTimeZoneZonedTest.java
index 5df4c0326..5b928c217 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/JDBCTimeZoneZonedTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/JDBCTimeZoneZonedTest.java
@@ -15,10 +15,9 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -35,13 +34,9 @@
import static org.hibernate.type.descriptor.DateTimeUtils.roundToDefaultPrecision;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public class JDBCTimeZoneZonedTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Zoned.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/PassThruZonedTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/PassThruZonedTest.java
index d8463102b..988db4a58 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/PassThruZonedTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/PassThruZonedTest.java
@@ -15,10 +15,9 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -29,18 +28,14 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.cfg.AvailableSettings.TIMEZONE_DEFAULT_STORAGE;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertWithTruncationThat;
+import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.type.descriptor.DateTimeUtils.roundToDefaultPrecision;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: SQLException: An error occurred with a DB2 operation, SQLCODE=-180 SQLSTATE=22007")
public class PassThruZonedTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Zoned.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/TimeZoneStorageMappingTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/TimeZoneStorageMappingTest.java
index 5539223df..ab9f28743 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/TimeZoneStorageMappingTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/TimeZoneStorageMappingTest.java
@@ -21,11 +21,10 @@
import org.hibernate.annotations.TimeZoneStorageType;
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -58,12 +57,9 @@
*
*/
@Timeout(value = 10, timeUnit = MINUTES)
+@DisabledFor(value = SQLSERVER, reason = "currently does not support java.time.OffsetTime")
public class TimeZoneStorageMappingTest extends BaseReactiveTest {
- // SQLSERVER currently does not support java.time.OffsetTime
- @RegisterExtension
- public DBSelectionExtension selectionRule = DBSelectionExtension.skipTestsFor( SQLSERVER );
-
private static final ZoneOffset JVM_TIMEZONE_OFFSET = OffsetDateTime.now().getOffset();
private static final OffsetTime OFFSET_TIME = OffsetTime.of(
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedInstantTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedInstantTest.java
index b9d0822b2..278b117e1 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedInstantTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedInstantTest.java
@@ -12,10 +12,9 @@
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -29,13 +28,9 @@
import static org.hibernate.reactive.testing.ReactiveAssertions.assertWithTruncationThat;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public class UTCNormalizedInstantTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Zoned.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedZonedTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedZonedTest.java
index fd686b543..9943a0f97 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedZonedTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/timezones/UTCNormalizedZonedTest.java
@@ -14,10 +14,9 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -33,13 +32,9 @@
import static org.hibernate.type.descriptor.DateTimeUtils.roundToDefaultPrecision;
@Timeout(value = 10, timeUnit = MINUTES)
-
+@DisabledFor(value = DB2, reason = "Exception: IllegalStateException: Needed to have 6 in buffer but only had 0")
public class UTCNormalizedZonedTest extends BaseReactiveTest {
- // Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Zoned.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/BasicTypesAndCallbacksForAllDBsTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/BasicTypesAndCallbacksForAllDBsTest.java
index 9d8a34d9f..3ff20c2b3 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/BasicTypesAndCallbacksForAllDBsTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/BasicTypesAndCallbacksForAllDBsTest.java
@@ -29,12 +29,10 @@
import org.hibernate.annotations.Type;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.VertxTestContext;
import jakarta.persistence.AttributeConverter;
@@ -64,7 +62,6 @@
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.reactive.testing.ReactiveAssertions.assertWithTruncationThat;
-
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -73,11 +70,8 @@
/**
* Test all the types and lifecycle callbacks that we expect to work on all supported DBs
*/
-public class BasicTypesAndCallbacksForAllDBsTest extends BaseReactiveTest {
- //Db2: testUUIDType throws NoStackTraceThrowable: parameter of type BufferImpl cannot be coerced to ByteBuf
- @RegisterExtension
- public final DBSelectionExtension skip = DBSelectionExtension.skipTestsFor( DB2 );
+public class BasicTypesAndCallbacksForAllDBsTest extends BaseReactiveTest {
@Override
protected Set> annotatedEntities() {
@@ -381,7 +375,6 @@ public void testBigIntegerType(VertxTestContext context) {
}
@Test
- @Disabled // Fail for MSSQL because the value changes before it's saved on the db. This also fails for ORM
public void testLocalTimeType(VertxTestContext context) {
Basic basic = new Basic();
basic.localTime = LocalTime.now();
@@ -418,6 +411,7 @@ public void testDuration(VertxTestContext context) {
}
@Test
+ @DisabledFor(value = DB2, reason = "java.sql.SQLException: An error occurred with a DB2 operation, SQLCODE=-180 SQLSTATE=22007 in insert query")
public void testInstant(VertxTestContext context) {
Basic basic = new Basic();
basic.instant = Instant.now();
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JavaTypesArrayTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JavaTypesArrayTest.java
index 739fb18a0..a9b08ac0d 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JavaTypesArrayTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JavaTypesArrayTest.java
@@ -18,9 +18,9 @@
import java.util.function.Consumer;
import org.hibernate.reactive.BaseReactiveTest;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.DisabledIf;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -34,13 +34,12 @@
import static java.lang.Boolean.TRUE;
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.dbType;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Timeout(value = 10, timeUnit = MINUTES)
-@DisabledIf("isNotSupported")
+@DisabledFor( value = ORACLE, reason = "Vert.x does not support arrays for Oracle" )
public class JavaTypesArrayTest extends BaseReactiveTest {
@Override
@@ -48,11 +47,6 @@ protected Set> annotatedEntities() {
return Set.of( Basic.class );
}
- public static boolean isNotSupported() {
- // Vert.x does not support arrays for Oracle
- return dbType() == ORACLE;
- }
-
private void testField(
VertxTestContext context, Basic
original, Consumer consumer) {
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JsonTypeTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JsonTypeTest.java
index 7c9a02730..5d18cdfad 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JsonTypeTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/JsonTypeTest.java
@@ -12,10 +12,9 @@
import java.util.function.Consumer;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.core.json.JsonObject;
import io.vertx.junit5.Timeout;
@@ -40,13 +39,12 @@
*/
@Timeout(value = 10, timeUnit = MINUTES)
+@DisabledFor(value = DB2, reason = "java.sql.SQLException: The object 'HREACT.JSONENTITY' provided is not defined, SQLCODE=-204 SQLSTATE=42704")
+@DisabledFor(value = SQLSERVER, reason = "java.lang.IllegalArgumentException: Unsupported value class: class io.vertx.core.json.JsonObject")
+@DisabledFor(value = ORACLE, reason = "java.sql.SQLException: ORA-17004: Invalid column type: https://docs.oracle.com/error-help/db/ora-17004/")
+@DisabledFor(value = MARIA, reason = "ORM 6 regression, see: https://github.com/hibernate/hibernate-reactive/issues/1529")
public class JsonTypeTest extends BaseReactiveTest {
- // MARIA: ORM 6 regression, see: https://github.com/hibernate/hibernate-reactive/issues/1529
- @RegisterExtension
- public DBSelectionExtension selectionRule = DBSelectionExtension
- .skipTestsFor( DB2, SQLSERVER, ORACLE, MARIA );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Basic.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LobTypeTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LobTypeTest.java
index 5644aa9b9..def7935ad 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LobTypeTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LobTypeTest.java
@@ -11,10 +11,9 @@
import java.util.function.Consumer;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -29,7 +28,6 @@
import static java.util.concurrent.TimeUnit.MINUTES;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -37,13 +35,10 @@
* Test types that we expect to work only on selected DBs.
*/
@Timeout(value = 10, timeUnit = MINUTES)
+@DisabledFor(value = DB2, reason = " Client doesn't support CLOB type. See https://github.com/hibernate/hibernate-reactive/issues/1662")
+@DisabledFor(value = POSTGRESQL, reason = "Client doesn't support OID type: See https://github.com/hibernate/hibernate-reactive/issues/1663")
public class LobTypeTest extends BaseReactiveTest {
- // Db2: Client doesn't support CLOB type. See https://github.com/hibernate/hibernate-reactive/issues/1662
- // Postgres: Client doesn't support OID type: See https://github.com/hibernate/hibernate-reactive/issues/1663
- @RegisterExtension
- public DBSelectionExtension selectionRule = skipTestsFor( DB2, POSTGRESQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Basic.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LongLobTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LongLobTest.java
index 4a4af38f0..80d8c6063 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LongLobTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/LongLobTest.java
@@ -11,10 +11,8 @@
import java.util.function.Consumer;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.junit5.Timeout;
import io.vertx.junit5.VertxTestContext;
@@ -26,18 +24,12 @@
import jakarta.persistence.Table;
import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
-import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Timeout(value = 10, timeUnit = MINUTES)
-
public class LongLobTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension selectionRule = runOnlyFor( MYSQL );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Basic.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/StringToJsonTypeTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/StringToJsonTypeTest.java
index 4319e37f9..1f8b164ec 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/StringToJsonTypeTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/StringToJsonTypeTest.java
@@ -12,10 +12,9 @@
import java.util.function.Consumer;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.core.json.JsonObject;
import io.vertx.junit5.Timeout;
@@ -33,7 +32,6 @@
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.hibernate.reactive.util.impl.CompletionStages.loop;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -43,11 +41,12 @@
*/
@Timeout(value = 10, timeUnit = MINUTES)
+@DisabledFor(value = DB2, reason = "SQLException: The object 'HREACT.JSONENTITY' provided is not defined, SQLCODE=-204 SQLSTATE=42704")
+@DisabledFor(value = SQLSERVER, reason = "Unsupported value class: class io.vertx.core.json.JsonObject from vertx.mssqlclient")
+@DisabledFor(value = MARIA, reason = " org.hibernate.HibernateException: Expecting raw JDBC value of type `io.vertx.core.json.JsonObject`, but found `java.lang.String` : [{\"int\":123,\"str\":\"hello\"}]")
+@DisabledFor(value = ORACLE, reason = "java.sql.SQLException: ORA-17004: Invalid column type: see https://docs.oracle.com/error-help/db/ora-17004/")
public class StringToJsonTypeTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension selectionRule = skipTestsFor( DB2, SQLSERVER, MARIA, ORACLE );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Basic.class );
diff --git a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/UserJsonTypeTest.java b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/UserJsonTypeTest.java
index 8cb7ec99e..252f71a14 100644
--- a/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/UserJsonTypeTest.java
+++ b/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/UserJsonTypeTest.java
@@ -13,10 +13,9 @@
import org.hibernate.annotations.Type;
import org.hibernate.reactive.BaseReactiveTest;
-import org.hibernate.reactive.testing.DBSelectionExtension;
+import org.hibernate.reactive.annotations.DisabledFor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
import io.vertx.core.json.JsonObject;
import io.vertx.junit5.Timeout;
@@ -32,7 +31,6 @@
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.ORACLE;
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.SQLSERVER;
-import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
import static org.hibernate.reactive.util.impl.CompletionStages.loop;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -41,11 +39,11 @@
* Test types that we expect to work only on selected DBs.
*/
@Timeout(value = 10, timeUnit = MINUTES)
+@DisabledFor(value = DB2, reason = "SQLException: The object 'HREACT.JSONENTITY' provided is not defined, SQLCODE=-204 SQLSTATE=42704")
+@DisabledFor(value = SQLSERVER, reason = "Unsupported value class: class io.vertx.core.json.JsonObject")
+@DisabledFor(value = ORACLE, reason = "java.sql.SQLException: ORA-17004: Invalid column type: see https://docs.oracle.com/error-help/db/ora-17004/")
public class UserJsonTypeTest extends BaseReactiveTest {
- @RegisterExtension
- public DBSelectionExtension selectionRule = skipTestsFor( DB2, SQLSERVER, ORACLE );
-
@Override
protected Collection> annotatedEntities() {
return List.of( Basic.class );