@@ -116,7 +116,7 @@ public Session newSession( AccessMode mode )
116116 {
117117 if ( driver == null )
118118 {
119- driver = createDriver ( clusterRule .getCluster ().leader (). getRoutingUri () );
119+ driver = createDriver ( clusterRule .getCluster ().getRoutingUri () );
120120 }
121121
122122 return driver .session ( builder ().withDefaultAccessMode ( mode ).build () );
@@ -275,7 +275,7 @@ void shouldDropBrokenOldConnections() throws Exception
275275 FakeClock clock = new FakeClock ();
276276 ChannelTrackingDriverFactory driverFactory = new ChannelTrackingDriverFactory ( clock );
277277
278- URI routingUri = cluster .leader (). getRoutingUri ();
278+ URI routingUri = cluster .getRoutingUri ();
279279 AuthToken auth = clusterRule .getDefaultAuthToken ();
280280
281281 try ( Driver driver = driverFactory .newInstance ( routingUri , auth , RoutingSettings .DEFAULT , RetrySettings .DEFAULT , config , SecurityPlanImpl .insecure () ) )
@@ -335,10 +335,9 @@ void shouldAcceptMultipleBookmarks() throws Exception
335335 String value = "Alice" ;
336336
337337 Cluster cluster = clusterRule .getCluster ();
338- ClusterMember leader = cluster .leader ();
339338 executor = newExecutor ();
340339
341- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
340+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
342341 {
343342 List <Future <Bookmark >> futures = new ArrayList <>();
344343 for ( int i = 0 ; i < threadCount ; i ++ )
@@ -367,16 +366,18 @@ void shouldAcceptMultipleBookmarks() throws Exception
367366 void shouldNotReuseReadConnectionForWriteTransaction ()
368367 {
369368 Cluster cluster = clusterRule .getCluster ();
370- ClusterMember leader = cluster .leader ();
371369
372- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
370+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
373371 {
374372 AsyncSession session = driver .asyncSession ( builder ().withDefaultAccessMode ( AccessMode .READ ).build () );
375373
376374 CompletionStage <List <RecordAndSummary >> resultsStage = session .runAsync ( "RETURN 42" )
377- .thenCompose ( cursor1 ->
378- session .writeTransactionAsync ( tx -> tx .runAsync ( "CREATE (:Node1) RETURN 42" )
379- .thenCompose ( cursor2 -> combineCursors ( cursor2 , cursor1 ) ) ) );
375+ .thenCompose ( cursor1 ->
376+ session .writeTransactionAsync (
377+ tx -> tx .runAsync ( "CREATE (:Node1) RETURN 42" )
378+ .thenCompose (
379+ cursor2 -> combineCursors ( cursor2 ,
380+ cursor1 ) ) ) );
380381
381382 List <RecordAndSummary > results = await ( resultsStage );
382383 assertEquals ( 2 , results .size () );
@@ -405,15 +406,14 @@ void shouldNotReuseReadConnectionForWriteTransaction()
405406 void shouldRespectMaxConnectionPoolSizePerClusterMember ()
406407 {
407408 Cluster cluster = clusterRule .getCluster ();
408- ClusterMember leader = cluster .leader ();
409409
410410 Config config = Config .builder ()
411411 .withMaxConnectionPoolSize ( 2 )
412412 .withConnectionAcquisitionTimeout ( 42 , MILLISECONDS )
413413 .withLogging ( DEV_NULL_LOGGING )
414414 .build ();
415415
416- try ( Driver driver = createDriver ( leader .getRoutingUri (), config ) )
416+ try ( Driver driver = createDriver ( cluster .getRoutingUri (), config ) )
417417 {
418418 String database = "neo4j" ;
419419 Session writeSession1 =
@@ -443,11 +443,10 @@ void shouldRespectMaxConnectionPoolSizePerClusterMember()
443443 void shouldAllowExistingTransactionToCompleteAfterDifferentConnectionBreaks ()
444444 {
445445 Cluster cluster = clusterRule .getCluster ();
446- ClusterMember leader = cluster .leader ();
447446
448447 FailingConnectionDriverFactory driverFactory = new FailingConnectionDriverFactory ();
449448
450- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
449+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
451450 RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
452451 {
453452 Session session1 = driver .session ();
@@ -486,10 +485,9 @@ RoutingSettings.DEFAULT, RetrySettings.DEFAULT, configWithoutLogging(), Security
486485 void shouldRediscoverWhenConnectionsToAllCoresBreak ()
487486 {
488487 Cluster cluster = clusterRule .getCluster ();
489- ClusterMember leader = cluster .leader ();
490488
491489 ChannelTrackingDriverFactory driverFactory = new ChannelTrackingDriverFactory ();
492- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
490+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
493491 RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
494492 {
495493 String database = "neo4j" ;
@@ -556,7 +554,7 @@ void shouldKeepOperatingWhenConnectionsBreak() throws Exception
556554 .withMaxTransactionRetryTime ( testRunTimeMs , MILLISECONDS )
557555 .build ();
558556
559- try ( Driver driver = driverFactory .newInstance ( cluster .leader (). getRoutingUri (), clusterRule .getDefaultAuthToken (),
557+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
560558 RoutingSettings .DEFAULT , RetrySettings .DEFAULT , config , SecurityPlanImpl .insecure () ) )
561559 {
562560 List <Future <?>> results = new ArrayList <>();
0 commit comments