File tree 2 files changed +64
-0
lines changed
hibernate-reactive-core/src/test/java/org/hibernate/reactive
2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -668,6 +668,38 @@ public void testForceFlushWithDelete(VertxTestContext context) {
668
668
);
669
669
}
670
670
671
+ @ Test
672
+ public void testCurrentSession (VertxTestContext context ) {
673
+ test ( context ,
674
+ getMutinySessionFactory ().withSession (session ->
675
+ getMutinySessionFactory ().withSession (s -> {
676
+ assertEquals (session , s );
677
+ Mutiny .Session currentSession = getMutinySessionFactory ().getCurrentSession ();
678
+ assertNotNull (currentSession );
679
+ assertTrue (currentSession .isOpen ());
680
+ assertEquals (session , currentSession );
681
+ return Uni .createFrom ().voidItem ();
682
+ })
683
+ )
684
+ );
685
+ }
686
+
687
+ @ Test
688
+ public void testCurrentStatelessSession (VertxTestContext context ) {
689
+ test ( context ,
690
+ getMutinySessionFactory ().withStatelessSession (session ->
691
+ getMutinySessionFactory ().withStatelessSession (s -> {
692
+ assertEquals (session , s );
693
+ Mutiny .StatelessSession currentSession = getMutinySessionFactory ().getCurrentStatelessSession ();
694
+ assertNotNull (currentSession );
695
+ assertTrue (currentSession .isOpen ());
696
+ assertEquals (session , currentSession );
697
+ return Uni .createFrom ().voidItem ();
698
+ })
699
+ )
700
+ );
701
+ }
702
+
671
703
private void assertThatPigsAreEqual (GuineaPig expected , GuineaPig actual ) {
672
704
assertNotNull ( actual );
673
705
assertEquals ( expected .getId (), actual .getId () );
Original file line number Diff line number Diff line change @@ -969,6 +969,38 @@ context, openSession()
969
969
);
970
970
}
971
971
972
+ @ Test
973
+ public void testCurrentSession (VertxTestContext context ) {
974
+ test ( context ,
975
+ getSessionFactory ().withSession (session ->
976
+ getSessionFactory ().withSession (s -> {
977
+ assertEquals (session , s );
978
+ Stage .Session currentSession = getSessionFactory ().getCurrentSession ();
979
+ assertNotNull (currentSession );
980
+ assertTrue (currentSession .isOpen ());
981
+ assertEquals (session , currentSession );
982
+ return CompletionStages .voidFuture ();
983
+ })
984
+ )
985
+ );
986
+ }
987
+
988
+ @ Test
989
+ public void testCurrentStatelessSession (VertxTestContext context ) {
990
+ test ( context ,
991
+ getSessionFactory ().withStatelessSession (session ->
992
+ getSessionFactory ().withStatelessSession (s -> {
993
+ assertEquals (session , s );
994
+ Stage .StatelessSession currentSession = getSessionFactory ().getCurrentStatelessSession ();
995
+ assertNotNull (currentSession );
996
+ assertTrue (currentSession .isOpen ());
997
+ assertEquals (session , currentSession );
998
+ return CompletionStages .voidFuture ();
999
+ })
1000
+ )
1001
+ );
1002
+ }
1003
+
972
1004
private void assertThatPigsAreEqual (GuineaPig expected , GuineaPig actual ) {
973
1005
assertNotNull ( actual );
974
1006
assertEquals ( expected .getId (), actual .getId () );
You can’t perform that action at this time.
0 commit comments