8
8
import java .util .Collection ;
9
9
import java .util .List ;
10
10
import java .util .Objects ;
11
- import java .util .concurrent .CompletionStage ;
12
11
import java .util .function .Consumer ;
13
12
14
13
import org .hibernate .reactive .BaseReactiveTest ;
26
25
import jakarta .persistence .Version ;
27
26
28
27
import static java .util .concurrent .TimeUnit .MINUTES ;
28
+ import static org .assertj .core .api .Assertions .assertThat ;
29
29
import static org .hibernate .reactive .containers .DatabaseConfiguration .DBType .DB2 ;
30
30
import static org .hibernate .reactive .containers .DatabaseConfiguration .DBType .MARIA ;
31
31
import static org .hibernate .reactive .containers .DatabaseConfiguration .DBType .ORACLE ;
32
32
import static org .hibernate .reactive .containers .DatabaseConfiguration .DBType .SQLSERVER ;
33
- import static org .hibernate .reactive .util .impl .CompletionStages .loop ;
34
33
import static org .junit .jupiter .api .Assertions .assertEquals ;
35
- import static org .junit .jupiter .api .Assertions .assertNotNull ;
36
34
37
35
/**
38
36
* Test types that we expect to work only on selected DBs.
39
37
*/
40
38
@ Timeout (value = 10 , timeUnit = MINUTES )
41
-
42
39
@ DisabledFor (value = DB2 , reason = "java.sql.SQLException: The object 'HREACT.JSONENTITY' provided is not defined, SQLCODE=-204 SQLSTATE=42704" )
43
40
@ DisabledFor (value = SQLSERVER , reason = "java.lang.IllegalArgumentException: Unsupported value class: class io.vertx.core.json.JsonObject" )
44
41
@ DisabledFor (value = ORACLE , reason = "java.sql.SQLException: ORA-17004: Invalid column type: https://docs.oracle.com/error-help/db/ora-17004/" )
@@ -50,15 +47,6 @@ protected Collection<Class<?>> annotatedEntities() {
50
47
return List .of ( Basic .class );
51
48
}
52
49
53
- @ Override
54
- public CompletionStage <Void > deleteEntities (Class <?>... types ) {
55
- return getSessionFactory ()
56
- .withTransaction ( s -> loop ( types , entityClass -> s
57
- .createSelectionQuery ( "from JsonEntity" , entityClass )
58
- .getResultList ()
59
- .thenCompose ( list -> loop ( list , entity -> s .remove ( entity ) ) ) ) );
60
- }
61
-
62
50
@ Test
63
51
public void testJsonType (VertxTestContext context ) {
64
52
Basic basic = new Basic ();
@@ -79,16 +67,15 @@ public void testNullJsonType(VertxTestContext context) {
79
67
* Persist the entity, find it and execute the assertions
80
68
*/
81
69
private void testField (VertxTestContext context , Basic original , Consumer <Basic > consumer ) {
82
- test (
83
- context ,
84
- getSessionFactory ().withTransaction ( (s , t ) -> s .persist ( original ) )
85
- .thenCompose ( v -> openSession () )
86
- .thenCompose ( s2 -> s2 .find ( Basic .class , original .id )
87
- .thenAccept ( found -> {
88
- assertNotNull ( found );
89
- assertEquals ( original , found );
90
- consumer .accept ( found );
91
- } ) )
70
+ test ( context , getSessionFactory ()
71
+ .withTransaction ( s -> s .persist ( original ) )
72
+ .thenCompose ( v -> getSessionFactory ().withTransaction ( s -> s
73
+ .find ( Basic .class , original .id ) )
74
+ )
75
+ .thenAccept ( found -> {
76
+ assertThat ( found ).isEqualTo ( original );
77
+ consumer .accept ( found );
78
+ } )
92
79
);
93
80
}
94
81
0 commit comments