@@ -116,7 +116,7 @@ public Session newSession( AccessMode mode )
116
116
{
117
117
if ( driver == null )
118
118
{
119
- driver = createDriver ( clusterRule .getCluster ().leader (). getRoutingUri () );
119
+ driver = createDriver ( clusterRule .getCluster ().getRoutingUri () );
120
120
}
121
121
122
122
return driver .session ( builder ().withDefaultAccessMode ( mode ).build () );
@@ -275,7 +275,7 @@ void shouldDropBrokenOldConnections() throws Exception
275
275
FakeClock clock = new FakeClock ();
276
276
ChannelTrackingDriverFactory driverFactory = new ChannelTrackingDriverFactory ( clock );
277
277
278
- URI routingUri = cluster .leader (). getRoutingUri ();
278
+ URI routingUri = cluster .getRoutingUri ();
279
279
AuthToken auth = clusterRule .getDefaultAuthToken ();
280
280
281
281
try ( Driver driver = driverFactory .newInstance ( routingUri , auth , RoutingSettings .DEFAULT , RetrySettings .DEFAULT , config , SecurityPlanImpl .insecure () ) )
@@ -458,10 +458,9 @@ void shouldAcceptMultipleBookmarks() throws Exception
458
458
String value = "Alice" ;
459
459
460
460
Cluster cluster = clusterRule .getCluster ();
461
- ClusterMember leader = cluster .leader ();
462
461
executor = newExecutor ();
463
462
464
- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
463
+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
465
464
{
466
465
List <Future <Bookmark >> futures = new ArrayList <>();
467
466
for ( int i = 0 ; i < threadCount ; i ++ )
@@ -490,16 +489,18 @@ void shouldAcceptMultipleBookmarks() throws Exception
490
489
void shouldNotReuseReadConnectionForWriteTransaction ()
491
490
{
492
491
Cluster cluster = clusterRule .getCluster ();
493
- ClusterMember leader = cluster .leader ();
494
492
495
- try ( Driver driver = createDriver ( leader .getRoutingUri () ) )
493
+ try ( Driver driver = createDriver ( cluster .getRoutingUri () ) )
496
494
{
497
495
AsyncSession session = driver .asyncSession ( builder ().withDefaultAccessMode ( AccessMode .READ ).build () );
498
496
499
497
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 ) ) ) );
503
504
504
505
List <RecordAndSummary > results = await ( resultsStage );
505
506
assertEquals ( 2 , results .size () );
@@ -528,15 +529,14 @@ void shouldNotReuseReadConnectionForWriteTransaction()
528
529
void shouldRespectMaxConnectionPoolSizePerClusterMember ()
529
530
{
530
531
Cluster cluster = clusterRule .getCluster ();
531
- ClusterMember leader = cluster .leader ();
532
532
533
533
Config config = Config .builder ()
534
534
.withMaxConnectionPoolSize ( 2 )
535
535
.withConnectionAcquisitionTimeout ( 42 , MILLISECONDS )
536
536
.withLogging ( DEV_NULL_LOGGING )
537
537
.build ();
538
538
539
- try ( Driver driver = createDriver ( leader .getRoutingUri (), config ) )
539
+ try ( Driver driver = createDriver ( cluster .getRoutingUri (), config ) )
540
540
{
541
541
Session writeSession1 = driver .session ( builder ().withDefaultAccessMode ( AccessMode .WRITE ).build () );
542
542
writeSession1 .beginTransaction ();
@@ -561,11 +561,10 @@ void shouldRespectMaxConnectionPoolSizePerClusterMember()
561
561
void shouldAllowExistingTransactionToCompleteAfterDifferentConnectionBreaks ()
562
562
{
563
563
Cluster cluster = clusterRule .getCluster ();
564
- ClusterMember leader = cluster .leader ();
565
564
566
565
FailingConnectionDriverFactory driverFactory = new FailingConnectionDriverFactory ();
567
566
568
- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
567
+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
569
568
RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
570
569
{
571
570
Session session1 = driver .session ();
@@ -604,10 +603,9 @@ RoutingSettings.DEFAULT, RetrySettings.DEFAULT, configWithoutLogging(), Security
604
603
void shouldRediscoverWhenConnectionsToAllCoresBreak ()
605
604
{
606
605
Cluster cluster = clusterRule .getCluster ();
607
- ClusterMember leader = cluster .leader ();
608
606
609
607
ChannelTrackingDriverFactory driverFactory = new ChannelTrackingDriverFactory ();
610
- try ( Driver driver = driverFactory .newInstance ( leader .getRoutingUri (), clusterRule .getDefaultAuthToken (),
608
+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
611
609
RoutingSettings .DEFAULT , RetrySettings .DEFAULT , configWithoutLogging (), SecurityPlanImpl .insecure () ) )
612
610
{
613
611
try ( Session session = driver .session () )
@@ -673,7 +671,7 @@ void shouldKeepOperatingWhenConnectionsBreak() throws Exception
673
671
.withMaxTransactionRetryTime ( testRunTimeMs , MILLISECONDS )
674
672
.build ();
675
673
676
- try ( Driver driver = driverFactory .newInstance ( cluster .leader (). getRoutingUri (), clusterRule .getDefaultAuthToken (),
674
+ try ( Driver driver = driverFactory .newInstance ( cluster .getRoutingUri (), clusterRule .getDefaultAuthToken (),
677
675
RoutingSettings .DEFAULT , RetrySettings .DEFAULT , config , SecurityPlanImpl .insecure () ) )
678
676
{
679
677
List <Future <?>> results = new ArrayList <>();
0 commit comments