@@ -100,12 +100,9 @@ public void testDiskThreshold() {
100
100
new SameShardAllocationDecider (Settings .EMPTY , clusterSettings ),
101
101
makeDecider (diskSettings ))));
102
102
103
- ClusterInfoService cis = new ClusterInfoService () {
104
- @ Override
105
- public ClusterInfo getClusterInfo () {
106
- logger .info ("--> calling fake getClusterInfo" );
107
- return clusterInfo ;
108
- }
103
+ ClusterInfoService cis = () -> {
104
+ logger .info ("--> calling fake getClusterInfo" );
105
+ return clusterInfo ;
109
106
};
110
107
AllocationService strategy = new AllocationService (deciders ,
111
108
new TestGatewayAllocator (), new BalancedShardsAllocator (Settings .EMPTY ), cis );
@@ -278,12 +275,9 @@ public void testDiskThresholdWithAbsoluteSizes() {
278
275
new SameShardAllocationDecider (Settings .EMPTY , clusterSettings ),
279
276
makeDecider (diskSettings ))));
280
277
281
- ClusterInfoService cis = new ClusterInfoService () {
282
- @ Override
283
- public ClusterInfo getClusterInfo () {
284
- logger .info ("--> calling fake getClusterInfo" );
285
- return clusterInfo ;
286
- }
278
+ ClusterInfoService cis = () -> {
279
+ logger .info ("--> calling fake getClusterInfo" );
280
+ return clusterInfo ;
287
281
};
288
282
289
283
AllocationService strategy = new AllocationService (deciders , new TestGatewayAllocator (),
@@ -328,12 +322,9 @@ public ClusterInfo getClusterInfo() {
328
322
usagesBuilder .put (nodeWithoutPrimary , new DiskUsage (nodeWithoutPrimary , "" , "/dev/null" , 100 , 35 )); // 65% used
329
323
usages = usagesBuilder .build ();
330
324
final ClusterInfo clusterInfo2 = new DevNullClusterInfo (usages , usages , shardSizes );
331
- cis = new ClusterInfoService () {
332
- @ Override
333
- public ClusterInfo getClusterInfo () {
334
- logger .info ("--> calling fake getClusterInfo" );
335
- return clusterInfo2 ;
336
- }
325
+ cis = () -> {
326
+ logger .info ("--> calling fake getClusterInfo" );
327
+ return clusterInfo2 ;
337
328
};
338
329
strategy = new AllocationService (deciders , new TestGatewayAllocator (),
339
330
new BalancedShardsAllocator (Settings .EMPTY ), cis );
@@ -516,12 +507,9 @@ Settings.EMPTY, new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLU
516
507
),
517
508
makeDecider (diskSettings ))));
518
509
519
- ClusterInfoService cis = new ClusterInfoService () {
520
- @ Override
521
- public ClusterInfo getClusterInfo () {
522
- logger .info ("--> calling fake getClusterInfo" );
523
- return clusterInfo ;
524
- }
510
+ ClusterInfoService cis = () -> {
511
+ logger .info ("--> calling fake getClusterInfo" );
512
+ return clusterInfo ;
525
513
};
526
514
527
515
AllocationService strategy = new AllocationService (deciders , new TestGatewayAllocator (),
@@ -580,12 +568,9 @@ Settings.EMPTY, new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLU
580
568
),
581
569
makeDecider (diskSettings ))));
582
570
583
- ClusterInfoService cis = new ClusterInfoService () {
584
- @ Override
585
- public ClusterInfo getClusterInfo () {
586
- logger .info ("--> calling fake getClusterInfo" );
587
- return clusterInfo ;
588
- }
571
+ ClusterInfoService cis = () -> {
572
+ logger .info ("--> calling fake getClusterInfo" );
573
+ return clusterInfo ;
589
574
};
590
575
591
576
AllocationService strategy = new AllocationService (deciders , new TestGatewayAllocator (),
@@ -677,12 +662,9 @@ public void testShardRelocationsTakenIntoAccount() {
677
662
Settings .EMPTY , new ClusterSettings (Settings .EMPTY , ClusterSettings .BUILT_IN_CLUSTER_SETTINGS )
678
663
), decider )));
679
664
680
- ClusterInfoService cis = new ClusterInfoService () {
681
- @ Override
682
- public ClusterInfo getClusterInfo () {
683
- logger .info ("--> calling fake getClusterInfo" );
684
- return clusterInfo ;
685
- }
665
+ ClusterInfoService cis = () -> {
666
+ logger .info ("--> calling fake getClusterInfo" );
667
+ return clusterInfo ;
686
668
};
687
669
688
670
AllocationService strategy = new AllocationService (deciders , new TestGatewayAllocator (),
@@ -856,12 +838,9 @@ public void testCanRemainWithShardRelocatingAway() {
856
838
}
857
839
858
840
// Creating AllocationService instance and the services it depends on...
859
- ClusterInfoService cis = new ClusterInfoService () {
860
- @ Override
861
- public ClusterInfo getClusterInfo () {
862
- logger .info ("--> calling fake getClusterInfo" );
863
- return clusterInfo ;
864
- }
841
+ ClusterInfoService cis = () -> {
842
+ logger .info ("--> calling fake getClusterInfo" );
843
+ return clusterInfo ;
865
844
};
866
845
AllocationDeciders deciders = new AllocationDeciders (new HashSet <>(Arrays .asList (
867
846
new SameShardAllocationDecider (
@@ -948,13 +927,10 @@ public void testForSingleDataNode() {
948
927
949
928
// Two shards should start happily
950
929
assertThat (decision .type (), equalTo (Decision .Type .YES ));
951
- assertThat (((Decision .Single ) decision ).getExplanation (), containsString ("there is only a single data node present" ));
952
- ClusterInfoService cis = new ClusterInfoService () {
953
- @ Override
954
- public ClusterInfo getClusterInfo () {
955
- logger .info ("--> calling fake getClusterInfo" );
956
- return clusterInfo ;
957
- }
930
+ assertThat (decision .getExplanation (), containsString ("there is only a single data node present" ));
931
+ ClusterInfoService cis = () -> {
932
+ logger .info ("--> calling fake getClusterInfo" );
933
+ return clusterInfo ;
958
934
};
959
935
960
936
AllocationDeciders deciders = new AllocationDeciders (new HashSet <>(Arrays .asList (
0 commit comments