@@ -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 () ) )
@@ -458,10 +458,9 @@ void shouldAcceptMultipleBookmarks() throws Exception
458458 String value = "Alice" ;
459459
460460 Cluster cluster = clusterRule .getCluster ();
461- ClusterMember leader = cluster .leader ();
462461 executor = newExecutor ();
463462
464- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
463+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
465464 {
466465 List <Future <Bookmark >> futures = new ArrayList <>();
467466 for ( int i = 0 ; i < threadCount ; i ++ )
@@ -490,16 +489,18 @@ void shouldAcceptMultipleBookmarks() throws Exception
490489 void shouldNotReuseReadConnectionForWriteTransaction ()
491490 {
492491 Cluster cluster = clusterRule .getCluster ();
493- ClusterMember leader = cluster .leader ();
494492
495- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
493+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
496494 {
497495 AsyncSession session = driver .asyncSession ( builder ().withDefaultAccessMode ( AccessMode .READ ).build () );
498496
499497 CompletionStage <List <RecordAndSummary >> resultsStage = session .runAsync ( "RETURN 42" )
500- .thenCompose ( cursor1 ->
501- session .writeTransactionAsync ( tx -> tx .runAsync ( "CREATE (:Node1) RETURN 42" )
502- .thenCompose ( cursor2 -> combineCursors ( cursor2 , cursor1 ) ) ) );
498+ .thenCompose ( cursor1 ->
499+ session .writeTransactionAsync (
500+ tx -> tx .runAsync ( "CREATE (:Node1) RETURN 42" )
501+ .thenCompose (
502+ cursor2 -> combineCursors ( cursor2 ,
503+ cursor1 ) ) ) );
503504
504505 List <RecordAndSummary > results = await ( resultsStage );
505506 assertEquals ( 2 , results .size () );
@@ -528,15 +529,14 @@ void shouldNotReuseReadConnectionForWriteTransaction()
528529 void shouldRespectMaxConnectionPoolSizePerClusterMember ()
529530 {
530531 Cluster cluster = clusterRule .getCluster ();
531- ClusterMember leader = cluster .leader ();
532532
533533 Config config = Config .builder ()
534534 .withMaxConnectionPoolSize ( 2 )
535535 .withConnectionAcquisitionTimeout ( 42 , MILLISECONDS )
536536 .withLogging ( DEV_NULL_LOGGING )
537537 .build ();
538538
539- try ( Driver driver = createDriver ( leader .getRoutingUri (), config ) )
539+ try ( Driver driver = createDriver ( cluster .getRoutingUri (), config ) )
540540 {
541541 Session writeSession1 = driver .session ( builder ().withDefaultAccessMode ( AccessMode .WRITE ).build () );
542542 writeSession1 .beginTransaction ();
@@ -561,11 +561,10 @@ void shouldRespectMaxConnectionPoolSizePerClusterMember()
561561 void shouldAllowExistingTransactionToCompleteAfterDifferentConnectionBreaks ()
562562 {
563563 Cluster cluster = clusterRule .getCluster ();
564- ClusterMember leader = cluster .leader ();
565564
566565 FailingConnectionDriverFactory driverFactory = new FailingConnectionDriverFactory ();
567566
568- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
567+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
569568 RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
570569 {
571570 Session session1 = driver .session ();
@@ -604,10 +603,9 @@ RoutingSettings.DEFAULT, RetrySettings.DEFAULT, configWithoutLogging(), Security
604603 void shouldRediscoverWhenConnectionsToAllCoresBreak ()
605604 {
606605 Cluster cluster = clusterRule .getCluster ();
607- ClusterMember leader = cluster .leader ();
608606
609607 ChannelTrackingDriverFactory driverFactory = new ChannelTrackingDriverFactory ();
610- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
608+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
611609 RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
612610 {
613611 try ( Session session = driver .session () )
@@ -673,7 +671,7 @@ void shouldKeepOperatingWhenConnectionsBreak() throws Exception
673671 .withMaxTransactionRetryTime ( testRunTimeMs , MILLISECONDS )
674672 .build ();
675673
676- try ( Driver driver = driverFactory .newInstance ( cluster .leader (). getRoutingUri (), clusterRule .getDefaultAuthToken (),
674+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
677675 RoutingSettings .DEFAULT , RetrySettings .DEFAULT , config , SecurityPlanImpl .insecure () ) )
678676 {
679677 List <Future <?>> results = new ArrayList <>();
0 commit comments