3030import org .neo4j .driver .Record ;
3131import org .neo4j .driver .SessionConfig ;
3232import org .neo4j .driver .Values ;
33- import org .neo4j .driver .reactive .ReactiveResult ;
34- import org .neo4j .driver .reactive .ReactiveSession ;
33+ import org .neo4j .driver .reactivestreams .ReactiveResult ;
34+ import org .neo4j .driver .reactivestreams .ReactiveSession ;
3535import org .neo4j .driver .summary .ResultSummary ;
3636import org .neo4j .driver .types .TypeSystem ;
3737import org .springframework .data .neo4j .core .transaction .Neo4jTransactionUtils ;
3838import org .springframework .lang .Nullable ;
3939import org .springframework .util .ReflectionUtils ;
40- import reactor .adapter .JdkFlowAdapter ;
4140import reactor .core .publisher .Flux ;
4241import reactor .core .publisher .Mono ;
4342import reactor .core .scheduler .Schedulers ;
@@ -89,10 +88,10 @@ void prepareMocks() {
8988
9089 when (driver .defaultTypeSystem ()).thenReturn (typeSystem );
9190
92- when (driver .reactiveSession ( any (SessionConfig .class ))).thenReturn (session );
91+ when (driver .session ( eq ( ReactiveSession . class ), any (SessionConfig .class ))).thenReturn (session );
9392
9493 when (session .lastBookmarks ()).thenReturn (Set .of (Mockito .mock (Bookmark .class )));
95- when (session .close ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .empty () ));
94+ when (session .close ()).thenReturn (Mono .empty ());
9695 }
9796
9897 @ AfterEach
@@ -107,9 +106,9 @@ void databaseSelectionShouldWorkBeforeAsUser() {
107106
108107 prepareMocks ();
109108
110- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
111- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 , record2 ).publishOn (Schedulers .single () )));
112- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
109+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
110+ when (result .records ()).thenReturn (Flux .just (record1 , record2 ).publishOn (Schedulers .single ()));
111+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
113112
114113 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
115114
@@ -146,9 +145,9 @@ void databaseSelectionShouldWorkAfterAsUser() {
146145
147146 prepareMocks ();
148147
149- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
150- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 , record2 ).publishOn (Schedulers .single () )));
151- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
148+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
149+ when (result .records ()).thenReturn (Flux .just (record1 , record2 ).publishOn (Schedulers .single ()));
150+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
152151
153152 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
154153
@@ -185,9 +184,9 @@ void userSelectionShouldWork() {
185184
186185 prepareMocks ();
187186
188- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
189- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 , record2 ).publishOn (Schedulers .single () )));
190- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
187+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
188+ when (result .records ()).thenReturn (Flux .just (record1 , record2 ).publishOn (Schedulers .single ()));
189+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
191190
192191 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
193192
@@ -222,9 +221,9 @@ void queryCreationShouldFeelGood() {
222221
223222 prepareMocks ();
224223
225- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
226- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 , record2 ) ));
227- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
224+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
225+ when (result .records ()).thenReturn (Flux .just (record1 , record2 ));
226+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
228227
229228 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
230229
@@ -266,9 +265,9 @@ void databaseSelectionShouldBePossibleOnlyOnce() {
266265
267266 prepareMocks ();
268267
269- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
270- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 , record2 ).publishOn (Schedulers .single () )));
271- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
268+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
269+ when (result .records ()).thenReturn (Flux .just (record1 , record2 ).publishOn (Schedulers .single ()));
270+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
272271
273272 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
274273
@@ -318,9 +317,9 @@ void databaseSelectionBeanShouldGetRespectedIfExisting() {
318317
319318 prepareMocks ();
320319
321- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
322- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 , record2 ).publishOn (Schedulers .single () )));
323- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
320+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
321+ when (result .records ()).thenReturn (Flux .just (record1 , record2 ).publishOn (Schedulers .single ()));
322+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
324323
325324 String databaseName = "customDatabaseSelection" ;
326325 String cypher = "RETURN 1" ;
@@ -407,9 +406,9 @@ void reading() {
407406
408407 prepareMocks ();
409408
410- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
411- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 ) ));
412- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
409+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
410+ when (result .records ()).thenReturn (Flux .just (record1 ));
411+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
413412 when (record1 .get ("name" )).thenReturn (Values .value ("michael" ));
414413
415414 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
@@ -440,9 +439,9 @@ void shouldApplyNullChecksDuringReading() {
440439
441440 prepareMocks ();
442441
443- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
444- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 , record2 ) ));
445- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
442+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
443+ when (result .records ()).thenReturn (Flux .just (record1 , record2 ));
444+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
446445 when (record1 .get ("name" )).thenReturn (Values .value ("michael" ));
447446
448447 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
@@ -473,8 +472,8 @@ void writing() {
473472
474473 prepareMocks ();
475474
476- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
477- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
475+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
476+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
478477
479478 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
480479
@@ -505,9 +504,9 @@ void automaticConversion() {
505504
506505 prepareMocks ();
507506
508- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
509- when (result .records ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Flux .just (record1 ) ));
510- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
507+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
508+ when (result .records ()).thenReturn (Flux .just (record1 ));
509+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
511510 when (record1 .size ()).thenReturn (1 );
512511 when (record1 .get (0 )).thenReturn (Values .value (23L ));
513512
@@ -534,8 +533,8 @@ void queriesWithoutResultShouldFitInAsWell() {
534533
535534 prepareMocks ();
536535
537- when (session .run (anyString (), anyMap ())).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (result ) ));
538- when (result .consume ()).thenReturn (JdkFlowAdapter . publisherToFlowPublisher ( Mono .just (resultSummary ) ));
536+ when (session .run (anyString (), anyMap ())).thenReturn (Mono .just (result ));
537+ when (result .consume ()).thenReturn (Mono .just (resultSummary ));
539538
540539 ReactiveNeo4jClient client = ReactiveNeo4jClient .create (driver );
541540
@@ -559,7 +558,7 @@ void queriesWithoutResultShouldFitInAsWell() {
559558
560559 void verifyDatabaseSelection (@ Nullable String targetDatabase ) {
561560
562- verify (driver ).reactiveSession ( configArgumentCaptor .capture ());
561+ verify (driver ).session ( eq ( ReactiveSession . class ), configArgumentCaptor .capture ());
563562 SessionConfig config = configArgumentCaptor .getValue ();
564563
565564 if (targetDatabase != null ) {
@@ -571,7 +570,7 @@ void verifyDatabaseSelection(@Nullable String targetDatabase) {
571570
572571 void verifyUserSelection (@ Nullable String aUser ) {
573572
574- verify (driver ).reactiveSession ( configArgumentCaptor .capture ());
573+ verify (driver ).session ( eq ( ReactiveSession . class ), configArgumentCaptor .capture ());
575574 SessionConfig config = configArgumentCaptor .getValue ();
576575
577576 // We assume the driver supports this before the test
0 commit comments