Skip to content

Commit ec435d3

Browse files
committed
replace DBSelectionExtension with new annotations
1 parent 8108936 commit ec435d3

File tree

56 files changed

+233
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+233
-545
lines changed

hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomOneToOneStoredProcedureSqlTest.java

+20-16
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,41 @@
55
*/
66
package org.hibernate.reactive;
77

8-
import io.vertx.junit5.Timeout;
9-
import io.vertx.junit5.VertxTestContext;
10-
import jakarta.persistence.*;
8+
import java.time.LocalDateTime;
9+
import java.util.Collection;
10+
import java.util.List;
1111

1212
import org.hibernate.HibernateException;
1313
import org.hibernate.annotations.SQLDelete;
1414
import org.hibernate.annotations.SQLInsert;
15-
import org.hibernate.reactive.testing.DBSelectionExtension;
1615
import org.hibernate.reactive.testing.ReactiveAssertions;
16+
import org.hibernate.reactive.annotations.RunDBType;
1717

1818
import org.junit.jupiter.api.Assertions;
1919
import org.junit.jupiter.api.BeforeEach;
2020
import org.junit.jupiter.api.Test;
21-
import org.junit.jupiter.api.extension.RegisterExtension;
22-
23-
import java.time.LocalDateTime;
24-
import java.util.Collection;
25-
import java.util.List;
2621

27-
import static java.util.concurrent.TimeUnit.*;
22+
import io.vertx.junit5.Timeout;
23+
import io.vertx.junit5.VertxTestContext;
24+
import jakarta.persistence.Basic;
25+
import jakarta.persistence.Column;
26+
import jakarta.persistence.Entity;
27+
import jakarta.persistence.GeneratedValue;
28+
import jakarta.persistence.Id;
29+
import jakarta.persistence.JoinColumn;
30+
import jakarta.persistence.OneToOne;
31+
import jakarta.persistence.Table;
32+
33+
import static java.util.concurrent.TimeUnit.MINUTES;
2834
import static org.assertj.core.api.Assertions.assertThat;
29-
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.*;
30-
import static org.hibernate.reactive.testing.DBSelectionExtension.*;
31-
import static org.junit.jupiter.api.Assertions.*;
35+
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
36+
import static org.junit.jupiter.api.Assertions.assertEquals;
37+
import static org.junit.jupiter.api.Assertions.assertNotNull;
3238

3339
@Timeout(value = 10, timeUnit = MINUTES)
34-
40+
@RunDBType( value = POSTGRESQL )
3541
public class CustomOneToOneStoredProcedureSqlTest extends BaseReactiveTest {
3642

37-
@RegisterExtension
38-
public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
3943
private IndividualPerson individualPerson;
4044
private DriverLicence driverLicence;
4145
private static final String INITIAL_LICENCE_NO = "12545KLI12";

hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomSqlTest.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
import org.hibernate.annotations.SQLDelete;
1313
import org.hibernate.annotations.SQLInsert;
1414
import org.hibernate.annotations.SQLUpdate;
15-
import org.hibernate.reactive.testing.DBSelectionExtension;
15+
import org.hibernate.reactive.annotations.RunDBType;
1616

1717
import org.junit.jupiter.api.Test;
18-
import org.junit.jupiter.api.extension.RegisterExtension;
1918

2019
import io.vertx.junit5.Timeout;
2120
import io.vertx.junit5.VertxTestContext;
@@ -29,18 +28,15 @@
2928
import static java.util.concurrent.TimeUnit.MINUTES;
3029
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
3130
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
32-
import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
3331
import static org.junit.jupiter.api.Assertions.assertEquals;
3432
import static org.junit.jupiter.api.Assertions.assertNotNull;
3533
import static org.junit.jupiter.api.Assertions.assertNull;
3634

3735
@Timeout(value = 10, timeUnit = MINUTES)
38-
36+
@RunDBType( value = POSTGRESQL )
37+
@RunDBType( value = COCKROACHDB )
3938
public class CustomSqlTest extends BaseReactiveTest {
4039

41-
@RegisterExtension
42-
public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL, COCKROACHDB );
43-
4440
@Override
4541
protected Collection<Class<?>> annotatedEntities() {
4642
return List.of( Record.class );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/CustomStoredProcedureSqlTest.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
import org.hibernate.annotations.SQLDelete;
1414
import org.hibernate.annotations.SQLInsert;
1515
import org.hibernate.annotations.SQLUpdate;
16-
import org.hibernate.reactive.testing.DBSelectionExtension;
1716
import org.hibernate.reactive.testing.ReactiveAssertions;
17+
import org.hibernate.reactive.annotations.RunDBType;
1818

1919
import org.junit.jupiter.api.Assertions;
2020
import org.junit.jupiter.api.BeforeEach;
2121
import org.junit.jupiter.api.Test;
22-
import org.junit.jupiter.api.extension.RegisterExtension;
2322

2423
import io.vertx.junit5.Timeout;
2524
import io.vertx.junit5.VertxTestContext;
@@ -33,18 +32,14 @@
3332
import static java.util.concurrent.TimeUnit.MINUTES;
3433
import static org.assertj.core.api.Assertions.assertThat;
3534
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
36-
import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
3735
import static org.junit.jupiter.api.Assertions.assertEquals;
3836
import static org.junit.jupiter.api.Assertions.assertNotNull;
3937
import static org.junit.jupiter.api.Assertions.assertNull;
4038

4139
@Timeout(value = 10, timeUnit = MINUTES)
42-
40+
@RunDBType( value = POSTGRESQL )
4341
public class CustomStoredProcedureSqlTest extends BaseReactiveTest {
4442

45-
@RegisterExtension
46-
public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
47-
4843
private SimpleRecord theRecord;
4944

5045
private static final String INITIAL_TEXT = "blue suede shoes";

hibernate-reactive-core/src/test/java/org/hibernate/reactive/EmptyCompositeCollectionKeyTest.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
import org.hibernate.Hibernate;
1414
import org.hibernate.cfg.Configuration;
1515
import org.hibernate.cfg.Environment;
16-
import org.hibernate.reactive.testing.DBSelectionExtension;
16+
import org.hibernate.reactive.annotations.SkipDBType;
1717

1818
import org.junit.jupiter.api.Test;
19-
import org.junit.jupiter.api.extension.RegisterExtension;
2019

2120
import io.vertx.junit5.Timeout;
2221
import io.vertx.junit5.VertxTestContext;
@@ -28,19 +27,15 @@
2827

2928
import static java.util.concurrent.TimeUnit.MINUTES;
3029
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
31-
import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
3230
import static org.junit.jupiter.api.Assertions.assertFalse;
3331
import static org.junit.jupiter.api.Assertions.assertNotNull;
3432
import static org.junit.jupiter.api.Assertions.assertNull;
3533
import static org.junit.jupiter.api.Assertions.assertTrue;
3634

3735
@Timeout(value = 10, timeUnit = MINUTES)
36+
@SkipDBType( value = DB2, reason = "IllegalStateException: Needed to have 6 in buffer but only had 0" )
3837
public class EmptyCompositeCollectionKeyTest extends BaseReactiveTest {
3938

40-
// 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
41-
@RegisterExtension
42-
public DBSelectionExtension dbSelection = skipTestsFor( DB2 );
43-
4439
@Override
4540
protected Collection<Class<?>> annotatedEntities() {
4641
return List.of( Family.class );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/FetchedAssociationTest.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111

1212
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
1313
import org.hibernate.cfg.Configuration;
14-
import org.hibernate.reactive.testing.DBSelectionExtension;
1514
import org.hibernate.reactive.testing.SqlStatementTracker;
15+
import org.hibernate.reactive.annotations.RunDBType;
1616

1717
import org.junit.jupiter.api.Test;
18-
import org.junit.jupiter.api.extension.RegisterExtension;
1918

2019
import io.vertx.junit5.Timeout;
2120
import io.vertx.junit5.VertxTestContext;
@@ -32,18 +31,14 @@
3231
import static java.util.concurrent.TimeUnit.MINUTES;
3332
import static org.assertj.core.api.Assertions.assertThat;
3433
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
35-
import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
3634

3735
/**
3836
* Test that's not necessary to do a fetch when we want to add a new element to an association.
3937
*/
4038
@Timeout(value = 10, timeUnit = MINUTES)
41-
39+
@RunDBType( value = POSTGRESQL ) // We use native queries, they might be different for other DBs
4240
public class FetchedAssociationTest extends BaseReactiveTest {
4341

44-
@RegisterExtension // We use native queries, they might be different for other DBs
45-
public DBSelectionExtension dbSelection = runOnlyFor( POSTGRESQL );
46-
4742
private SqlStatementTracker sqlTracker;
4843

4944
@Override

hibernate-reactive-core/src/test/java/org/hibernate/reactive/FilterWithPaginationTest.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
import org.hibernate.annotations.ParamDef;
1616
import org.hibernate.reactive.mutiny.Mutiny;
1717
import org.hibernate.reactive.stage.Stage;
18-
import org.hibernate.reactive.testing.DBSelectionExtension;
18+
import org.hibernate.reactive.annotations.SkipDBType;
1919
import org.hibernate.type.descriptor.java.StringJavaType;
2020

2121
import org.junit.jupiter.api.BeforeEach;
2222
import org.junit.jupiter.api.Test;
23-
import org.junit.jupiter.api.extension.RegisterExtension;
2423

2524
import io.smallrye.mutiny.Uni;
2625
import io.vertx.junit5.Timeout;
@@ -36,19 +35,14 @@
3635
import static org.hibernate.query.Page.first;
3736
import static org.hibernate.query.Page.page;
3837
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.DB2;
39-
import static org.hibernate.reactive.testing.DBSelectionExtension.skipTestsFor;
4038

4139
/**
4240
* Test the combination of filters, max results, first result, and {@link org.hibernate.query.Page}.
4341
*/
4442
@Timeout(value = 10, timeUnit = MINUTES)
45-
43+
@SkipDBType(value = DB2, reason = "IllegalStateException: Needed to have 6 in buffer but only had 0")
4644
public class FilterWithPaginationTest extends BaseReactiveTest {
4745

48-
// Db2: Exception: IllegalStateException: Needed to have 6 in buffer but only had 0
49-
@RegisterExtension
50-
public final DBSelectionExtension skip = skipTestsFor( DB2 );
51-
5246
FamousPerson margaret = new FamousPerson( 1L, "Margaret Howe Lovatt", Status.LIVING, "the woman who lived in a half-flooded home with a dolphin." );
5347
FamousPerson nellie = new FamousPerson( 2L, "Nellie Bly", Status.DECEASED, "In 1888, she traveled around the world in 72 days." );
5448
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." );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/FormulaTest.java

-8
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
import java.util.List;
1111

1212
import org.hibernate.annotations.Formula;
13-
import org.hibernate.reactive.testing.DBSelectionExtension;
1413

1514
import org.junit.jupiter.api.Assertions;
1615
import org.junit.jupiter.api.Test;
17-
import org.junit.jupiter.api.extension.RegisterExtension;
1816

1917
import io.vertx.junit5.Timeout;
2018
import io.vertx.junit5.VertxTestContext;
@@ -25,16 +23,10 @@
2523
import jakarta.persistence.Table;
2624

2725
import static java.util.concurrent.TimeUnit.MINUTES;
28-
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
29-
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
3026

3127
@Timeout(value = 10, timeUnit = MINUTES)
32-
3328
public class FormulaTest extends BaseReactiveTest {
3429

35-
@RegisterExtension
36-
public DBSelectionExtension dbSelection = DBSelectionExtension.skipTestsFor( MARIA, MYSQL );
37-
3830
@Override
3931
protected Collection<Class<?>> annotatedEntities() {
4032
return List.of( Record.class );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyJoinedTableTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
import org.hibernate.annotations.GenerationTime;
1515
import org.hibernate.cfg.AvailableSettings;
1616
import org.hibernate.cfg.Configuration;
17-
import org.hibernate.reactive.testing.DBSelectionExtension;
17+
import org.hibernate.reactive.annotations.RunDBType;
1818

1919
import org.junit.jupiter.api.Test;
20-
import org.junit.jupiter.api.extension.RegisterExtension;
2120

2221
import io.vertx.junit5.Timeout;
2322
import io.vertx.junit5.VertxTestContext;
@@ -33,9 +32,9 @@
3332

3433
import static java.util.concurrent.TimeUnit.MINUTES;
3534
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
35+
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
3636
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
3737
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
38-
import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
3938
import static org.junit.jupiter.api.Assertions.assertEquals;
4039
import static org.junit.jupiter.api.Assertions.assertNotNull;
4140
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -44,13 +43,14 @@
4443
* Test the @{@link Generated} annotation with {@link InheritanceType#JOINED}
4544
*/
4645
@Timeout(value = 10, timeUnit = MINUTES)
47-
46+
// It requires native queries, so it won't work for every db
47+
// Fails with SQLSERVER, ORACLE and DB2
48+
@RunDBType( value = POSTGRESQL )
49+
@RunDBType( value = COCKROACHDB )
50+
@RunDBType( value = MYSQL )
51+
@RunDBType( value = MARIA )
4852
public class GeneratedPropertyJoinedTableTest extends BaseReactiveTest {
4953

50-
// It requires native queries, so it won't work for every db
51-
@RegisterExtension
52-
public DBSelectionExtension selectionRule = runOnlyFor( POSTGRESQL, COCKROACHDB, MYSQL );
53-
5454
@Override
5555
protected Collection<Class<?>> annotatedEntities() {
5656
return List.of( GeneratedWithIdentity.class, GeneratedRegular.class );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertySingleTableTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
import org.hibernate.annotations.GenerationTime;
1515
import org.hibernate.cfg.AvailableSettings;
1616
import org.hibernate.cfg.Configuration;
17-
import org.hibernate.reactive.testing.DBSelectionExtension;
17+
import org.hibernate.reactive.annotations.RunDBType;
1818

1919
import org.junit.jupiter.api.Test;
20-
import org.junit.jupiter.api.extension.RegisterExtension;
2120

2221
import io.vertx.junit5.Timeout;
2322
import io.vertx.junit5.VertxTestContext;
@@ -32,9 +31,9 @@
3231

3332
import static java.util.concurrent.TimeUnit.MINUTES;
3433
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
34+
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
3535
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
3636
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
37-
import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
3837
import static org.junit.jupiter.api.Assertions.assertEquals;
3938
import static org.junit.jupiter.api.Assertions.assertNotNull;
4039
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -43,13 +42,14 @@
4342
* Test the @{@link Generated} annotation
4443
*/
4544
@Timeout(value = 10, timeUnit = MINUTES)
46-
45+
// It requires native queries, so it won't work for every db
46+
// Fails with SQLSERVER, ORACLE and DB2
47+
@RunDBType( value = POSTGRESQL )
48+
@RunDBType( value = COCKROACHDB )
49+
@RunDBType( value = MYSQL )
50+
@RunDBType( value = MARIA )
4751
public class GeneratedPropertySingleTableTest extends BaseReactiveTest {
4852

49-
// It requires native queries, so it won't work for every db
50-
@RegisterExtension
51-
public DBSelectionExtension selectionRule = runOnlyFor( POSTGRESQL, COCKROACHDB, MYSQL );
52-
5353
@Override
5454
protected Collection<Class<?>> annotatedEntities() {
5555
return List.of( GeneratedWithIdentity.class, GeneratedRegular.class );

hibernate-reactive-core/src/test/java/org/hibernate/reactive/GeneratedPropertyUnionSubclassesTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
import org.hibernate.annotations.GenerationTime;
1515
import org.hibernate.cfg.AvailableSettings;
1616
import org.hibernate.cfg.Configuration;
17-
import org.hibernate.reactive.testing.DBSelectionExtension;
17+
import org.hibernate.reactive.annotations.RunDBType;
1818

1919
import org.junit.jupiter.api.Test;
20-
import org.junit.jupiter.api.extension.RegisterExtension;
2120

2221
import io.vertx.junit5.Timeout;
2322
import io.vertx.junit5.VertxTestContext;
@@ -33,9 +32,9 @@
3332

3433
import static java.util.concurrent.TimeUnit.MINUTES;
3534
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.COCKROACHDB;
35+
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MARIA;
3636
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.MYSQL;
3737
import static org.hibernate.reactive.containers.DatabaseConfiguration.DBType.POSTGRESQL;
38-
import static org.hibernate.reactive.testing.DBSelectionExtension.runOnlyFor;
3938
import static org.junit.jupiter.api.Assertions.assertEquals;
4039
import static org.junit.jupiter.api.Assertions.assertNotNull;
4140
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -47,13 +46,14 @@
4746
* </p>
4847
*/
4948
@Timeout(value = 10, timeUnit = MINUTES)
50-
49+
// It requires native queries, so it won't work for every db
50+
// Fails with SQLSERVER, ORACLE and DB2
51+
@RunDBType( value = POSTGRESQL )
52+
@RunDBType( value = COCKROACHDB )
53+
@RunDBType( value = MYSQL )
54+
@RunDBType( value = MARIA )
5155
public class GeneratedPropertyUnionSubclassesTest extends BaseReactiveTest {
5256

53-
// It requires native queries, so it won't work for every db
54-
@RegisterExtension
55-
public DBSelectionExtension selectionRule = runOnlyFor( POSTGRESQL, COCKROACHDB, MYSQL );
56-
5757
@Override
5858
protected Collection<Class<?>> annotatedEntities() {
5959
return List.of( GeneratedRegular.class );

0 commit comments

Comments
 (0)