File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed
hibernate-reactive-core/src/test/java/org/hibernate/reactive Expand file tree Collapse file tree 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) {
668668 );
669669 }
670670
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+
671703 private void assertThatPigsAreEqual (GuineaPig expected , GuineaPig actual ) {
672704 assertNotNull ( actual );
673705 assertEquals ( expected .getId (), actual .getId () );
Original file line number Diff line number Diff line change @@ -969,6 +969,38 @@ context, openSession()
969969 );
970970 }
971971
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+
9721004 private void assertThatPigsAreEqual (GuineaPig expected , GuineaPig actual ) {
9731005 assertNotNull ( actual );
9741006 assertEquals ( expected .getId (), actual .getId () );
You can’t perform that action at this time.
0 commit comments