@@ -407,22 +407,22 @@ public void endpointAddressRewritten_whenProxyMetadataIsInEndpointMetadata() {
407407 100 /* localityWeight */ , 1 /* priority */ , localityMetadata );
408408
409409 xdsClient .deliverClusterLoadAssignment (
410- EDS_SERVICE_NAME1 ,
411- ImmutableMap .of (locality1 , localityLbEndpoints ));
410+ EDS_SERVICE_NAME1 ,
411+ ImmutableMap .of (locality1 , localityLbEndpoints ));
412412
413413 assertThat (childBalancers ).hasSize (1 );
414414 FakeLoadBalancer childBalancer = Iterables .getOnlyElement (childBalancers );
415415
416416 // Get the rewritten address
417417 SocketAddress rewrittenAddress =
418- childBalancer .addresses .get (0 ).getAddresses ().get (0 );
418+ childBalancer .addresses .get (0 ).getAddresses ().get (0 );
419419 assertThat (rewrittenAddress ).isInstanceOf (HttpConnectProxiedSocketAddress .class );
420420 HttpConnectProxiedSocketAddress proxiedSocket =
421- (HttpConnectProxiedSocketAddress ) rewrittenAddress ;
421+ (HttpConnectProxiedSocketAddress ) rewrittenAddress ;
422422
423423 // Assert that the target address is the original address
424424 assertThat (proxiedSocket .getTargetAddress ())
425- .isEqualTo (endpoint .getAddresses ().get (0 ));
425+ .isEqualTo (endpoint .getAddresses ().get (0 ));
426426
427427 // Assert that the proxy address is correctly set
428428 assertThat (proxiedSocket .getProxyAddress ()).isEqualTo (proxyAddress );
@@ -431,21 +431,21 @@ public void endpointAddressRewritten_whenProxyMetadataIsInEndpointMetadata() {
431431 @ Test
432432 public void endpointAddressRewritten_whenProxyMetadataIsInLocalityMetadata () {
433433 ClusterResolverConfig config = new ClusterResolverConfig (
434- edsDiscoveryMechanismWithOutlierDetection , leastRequest , true );
434+ edsDiscoveryMechanismWithOutlierDetection , leastRequest , true );
435435 deliverLbConfig (config );
436436 assertThat (xdsClient .watchers .keySet ()).containsExactly (EDS_SERVICE_NAME1 );
437437 assertThat (childBalancers ).isEmpty ();
438438
439439 EquivalentAddressGroup endpoint =
440- new EquivalentAddressGroup (InetSocketAddress .createUnresolved ("127.0.0.2" , 8080 ));
440+ new EquivalentAddressGroup (InetSocketAddress .createUnresolved ("127.0.0.2" , 8080 ));
441441
442442 // No proxy in endpointMetadata
443443 ImmutableMap <String , Object > endpointMetadata = ImmutableMap .of ();
444444
445445 // Proxy address is now in localityMetadata
446446 SocketAddress proxyAddress = new FakeSocketAddress ("proxy-addr" );
447447 ImmutableMap <String , Object > localityMetadata =
448- ImmutableMap .of ("envoy.http11_proxy_transport_socket.proxy_address" , proxyAddress );
448+ ImmutableMap .of ("envoy.http11_proxy_transport_socket.proxy_address" , proxyAddress );
449449
450450 LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints .create (
451451 Arrays .asList (
@@ -454,8 +454,8 @@ public void endpointAddressRewritten_whenProxyMetadataIsInLocalityMetadata() {
454454 100 /* localityWeight */ , 1 /* priority */ , localityMetadata );
455455
456456 xdsClient .deliverClusterLoadAssignment (
457- EDS_SERVICE_NAME1 ,
458- ImmutableMap .of (locality1 , localityLbEndpoints ));
457+ EDS_SERVICE_NAME1 ,
458+ ImmutableMap .of (locality1 , localityLbEndpoints ));
459459
460460 assertThat (childBalancers ).hasSize (1 );
461461 FakeLoadBalancer childBalancer = Iterables .getOnlyElement (childBalancers );
@@ -466,7 +466,7 @@ public void endpointAddressRewritten_whenProxyMetadataIsInLocalityMetadata() {
466466 // Assert that the address was rewritten
467467 assertThat (rewrittenAddress ).isInstanceOf (HttpConnectProxiedSocketAddress .class );
468468 HttpConnectProxiedSocketAddress proxiedSocket =
469- (HttpConnectProxiedSocketAddress ) rewrittenAddress ;
469+ (HttpConnectProxiedSocketAddress ) rewrittenAddress ;
470470
471471 // Assert that the target address is the original address
472472 assertThat (proxiedSocket .getTargetAddress ()).isEqualTo (endpoint .getAddresses ().get (0 ));
@@ -478,7 +478,7 @@ public void endpointAddressRewritten_whenProxyMetadataIsInLocalityMetadata() {
478478 @ Test
479479 public void onlyEdsClusters_receivedEndpoints () {
480480 ClusterResolverConfig config = new ClusterResolverConfig (
481- edsDiscoveryMechanism2 , roundRobin , false );
481+ edsDiscoveryMechanism2 , roundRobin , false );
482482 deliverLbConfig (config );
483483 assertThat (xdsClient .watchers .keySet ()).containsExactly (EDS_SERVICE_NAME2 );
484484 assertThat (childBalancers ).isEmpty ();
@@ -497,10 +497,10 @@ public void onlyEdsClusters_receivedEndpoints() {
497497 true , "hostname1" , ImmutableMap .of ())),
498498 70 /* localityWeight */ , 1 /* priority */ , ImmutableMap .of ());
499499 LocalityLbEndpoints localityLbEndpoints3 =
500- LocalityLbEndpoints .create (
501- Collections .singletonList (LbEndpoint .create (endpoint4 , 100 , true ,
502- "hostname3" , ImmutableMap .of ())),
503- 20 /* localityWeight */ , 2 /* priority */ , ImmutableMap .of ());
500+ LocalityLbEndpoints .create (
501+ Collections .singletonList (LbEndpoint .create (endpoint4 , 100 , true ,
502+ "hostname3" , ImmutableMap .of ())),
503+ 20 /* localityWeight */ , 2 /* priority */ , ImmutableMap .of ());
504504 String priority1 = CLUSTER2 + "[child1]" ;
505505 String priority2 = CLUSTER2 + "[child2]" ;
506506
@@ -515,56 +515,56 @@ public void onlyEdsClusters_receivedEndpoints() {
515515 assertThat (childBalancer .name ).isEqualTo (PRIORITY_POLICY_NAME );
516516 PriorityLbConfig priorityLbConfig = (PriorityLbConfig ) childBalancer .config ;
517517 assertThat (priorityLbConfig .priorities )
518- .containsExactly (priority1 , priority2 ).inOrder ();
518+ .containsExactly (priority1 , priority2 ).inOrder ();
519519
520520 PriorityChildConfig priorityChildConfig1 = priorityLbConfig .childConfigs .get (priority1 );
521521 assertThat (priorityChildConfig1 .ignoreReresolution ).isTrue ();
522522 assertThat (GracefulSwitchLoadBalancerAccessor .getChildProvider (priorityChildConfig1 .childConfig )
523- .getPolicyName ())
524- .isEqualTo (CLUSTER_IMPL_POLICY_NAME );
523+ .getPolicyName ())
524+ .isEqualTo (CLUSTER_IMPL_POLICY_NAME );
525525 ClusterImplConfig clusterImplConfig1 = (ClusterImplConfig )
526- GracefulSwitchLoadBalancerAccessor .getChildConfig (priorityChildConfig1 .childConfig );
526+ GracefulSwitchLoadBalancerAccessor .getChildConfig (priorityChildConfig1 .childConfig );
527527 assertClusterImplConfig (clusterImplConfig1 , CLUSTER2 , EDS_SERVICE_NAME2 , LRS_SERVER_INFO , 200L ,
528- tlsContext , Collections .<DropOverload >emptyList (), WRR_LOCALITY_POLICY_NAME );
528+ tlsContext , Collections .<DropOverload >emptyList (), WRR_LOCALITY_POLICY_NAME );
529529 WrrLocalityConfig wrrLocalityConfig1 = (WrrLocalityConfig )
530- GracefulSwitchLoadBalancerAccessor .getChildConfig (clusterImplConfig1 .childConfig );
530+ GracefulSwitchLoadBalancerAccessor .getChildConfig (clusterImplConfig1 .childConfig );
531531 LoadBalancerProvider childProvider1 =
532- GracefulSwitchLoadBalancerAccessor .getChildProvider (wrrLocalityConfig1 .childConfig );
532+ GracefulSwitchLoadBalancerAccessor .getChildProvider (wrrLocalityConfig1 .childConfig );
533533 assertThat (childProvider1 .getPolicyName ()).isEqualTo ("round_robin" );
534534
535535 PriorityChildConfig priorityChildConfig2 = priorityLbConfig .childConfigs .get (priority2 );
536536 assertThat (priorityChildConfig2 .ignoreReresolution ).isTrue ();
537537 assertThat (GracefulSwitchLoadBalancerAccessor .getChildProvider (priorityChildConfig2 .childConfig )
538- .getPolicyName ())
539- .isEqualTo (CLUSTER_IMPL_POLICY_NAME );
538+ .getPolicyName ())
539+ .isEqualTo (CLUSTER_IMPL_POLICY_NAME );
540540 ClusterImplConfig clusterImplConfig2 = (ClusterImplConfig )
541- GracefulSwitchLoadBalancerAccessor .getChildConfig (priorityChildConfig2 .childConfig );
541+ GracefulSwitchLoadBalancerAccessor .getChildConfig (priorityChildConfig2 .childConfig );
542542 assertClusterImplConfig (clusterImplConfig2 , CLUSTER2 , EDS_SERVICE_NAME2 , LRS_SERVER_INFO , 200L ,
543- tlsContext , Collections .<DropOverload >emptyList (), WRR_LOCALITY_POLICY_NAME );
543+ tlsContext , Collections .<DropOverload >emptyList (), WRR_LOCALITY_POLICY_NAME );
544544 WrrLocalityConfig wrrLocalityConfig2 = (WrrLocalityConfig )
545- GracefulSwitchLoadBalancerAccessor .getChildConfig (clusterImplConfig1 .childConfig );
545+ GracefulSwitchLoadBalancerAccessor .getChildConfig (clusterImplConfig1 .childConfig );
546546 LoadBalancerProvider childProvider2 =
547- GracefulSwitchLoadBalancerAccessor .getChildProvider (wrrLocalityConfig2 .childConfig );
547+ GracefulSwitchLoadBalancerAccessor .getChildProvider (wrrLocalityConfig2 .childConfig );
548548 assertThat (childProvider2 .getPolicyName ()).isEqualTo ("round_robin" );
549549
550550 WrrLocalityConfig wrrLocalityConfig3 = (WrrLocalityConfig )
551- GracefulSwitchLoadBalancerAccessor .getChildConfig (clusterImplConfig1 .childConfig );
551+ GracefulSwitchLoadBalancerAccessor .getChildConfig (clusterImplConfig1 .childConfig );
552552 LoadBalancerProvider childProvider3 =
553- GracefulSwitchLoadBalancerAccessor .getChildProvider (wrrLocalityConfig3 .childConfig );
553+ GracefulSwitchLoadBalancerAccessor .getChildProvider (wrrLocalityConfig3 .childConfig );
554554 assertThat (childProvider3 .getPolicyName ()).isEqualTo ("round_robin" );
555555
556556 for (EquivalentAddressGroup eag : childBalancer .addresses ) {
557557 if (eag .getAttributes ().get (XdsAttributes .ATTR_LOCALITY ) == locality1 ) {
558558 assertThat (eag .getAttributes ().get (XdsAttributes .ATTR_LOCALITY_WEIGHT ))
559- .isEqualTo (70 );
559+ .isEqualTo (70 );
560560 }
561561 if (eag .getAttributes ().get (XdsAttributes .ATTR_LOCALITY ) == locality2 ) {
562562 assertThat (eag .getAttributes ().get (XdsAttributes .ATTR_LOCALITY_WEIGHT ))
563- .isEqualTo (10 );
563+ .isEqualTo (10 );
564564 }
565565 if (eag .getAttributes ().get (XdsAttributes .ATTR_LOCALITY ) == locality3 ) {
566566 assertThat (eag .getAttributes ().get (XdsAttributes .ATTR_LOCALITY_WEIGHT ))
567- .isEqualTo (20 );
567+ .isEqualTo (20 );
568568 }
569569 }
570570 }
@@ -573,15 +573,15 @@ public void onlyEdsClusters_receivedEndpoints() {
573573 private void verifyEdsPriorityNames (List <String > want ,
574574 Map <Locality , LocalityLbEndpoints >... updates ) {
575575 ClusterResolverConfig config = new ClusterResolverConfig (
576- edsDiscoveryMechanism2 , roundRobin , false );
576+ edsDiscoveryMechanism2 , roundRobin , false );
577577 deliverLbConfig (config );
578578 assertThat (xdsClient .watchers .keySet ()).containsExactly (EDS_SERVICE_NAME2 );
579579 assertThat (childBalancers ).isEmpty ();
580580
581581 for (Map <Locality , LocalityLbEndpoints > update : updates ) {
582582 xdsClient .deliverClusterLoadAssignment (
583- EDS_SERVICE_NAME2 ,
584- update );
583+ EDS_SERVICE_NAME2 ,
584+ update );
585585 }
586586 assertThat (childBalancers ).hasSize (1 );
587587 FakeLoadBalancer childBalancer = Iterables .getOnlyElement (childBalancers );
@@ -612,44 +612,44 @@ public void edsUpdatePriorityName_addOnePriority() {
612612 @ SuppressWarnings ("unchecked" )
613613 public void edsUpdatePriorityName_swapTwoPriorities () {
614614 verifyEdsPriorityNames (Arrays .asList (CLUSTER2 + "[child2]" , CLUSTER2 + "[child1]" ,
615- CLUSTER2 + "[child3]" ),
616- ImmutableMap .of (locality1 , createEndpoints (1 ),
617- locality2 , createEndpoints (2 ),
618- locality3 , createEndpoints (3 )
619- ),
620- ImmutableMap .of (locality1 , createEndpoints (2 ),
621- locality2 , createEndpoints (1 ),
622- locality3 , createEndpoints (3 ))
615+ CLUSTER2 + "[child3]" ),
616+ ImmutableMap .of (locality1 , createEndpoints (1 ),
617+ locality2 , createEndpoints (2 ),
618+ locality3 , createEndpoints (3 )
619+ ),
620+ ImmutableMap .of (locality1 , createEndpoints (2 ),
621+ locality2 , createEndpoints (1 ),
622+ locality3 , createEndpoints (3 ))
623623 );
624624 }
625625
626626 @ Test
627627 @ SuppressWarnings ("unchecked" )
628628 public void edsUpdatePriorityName_mergeTwoPriorities () {
629629 verifyEdsPriorityNames (Arrays .asList (CLUSTER2 + "[child3]" , CLUSTER2 + "[child1]" ),
630- ImmutableMap .of (locality1 , createEndpoints (1 ),
631- locality3 , createEndpoints (3 ),
632- locality2 , createEndpoints (2 )),
633- ImmutableMap .of (locality1 , createEndpoints (2 ),
634- locality3 , createEndpoints (1 ),
635- locality2 , createEndpoints (1 )
636- ));
630+ ImmutableMap .of (locality1 , createEndpoints (1 ),
631+ locality3 , createEndpoints (3 ),
632+ locality2 , createEndpoints (2 )),
633+ ImmutableMap .of (locality1 , createEndpoints (2 ),
634+ locality3 , createEndpoints (1 ),
635+ locality2 , createEndpoints (1 )
636+ ));
637637 }
638638
639639 private LocalityLbEndpoints createEndpoints (int priority ) {
640640 return LocalityLbEndpoints .create (
641- Arrays .asList (
642- LbEndpoint .create (makeAddress ("endpoint-addr-1" ), 100 ,
643- true , "hostname1" , ImmutableMap .of ()),
644- LbEndpoint .create (makeAddress ("endpoint-addr-2" ), 100 ,
645- true , "hostname2" , ImmutableMap .of ())),
646- 70 /* localityWeight */ , priority /* priority */ , ImmutableMap .of ());
641+ Arrays .asList (
642+ LbEndpoint .create (makeAddress ("endpoint-addr-1" ), 100 ,
643+ true , "hostname1" , ImmutableMap .of ()),
644+ LbEndpoint .create (makeAddress ("endpoint-addr-2" ), 100 ,
645+ true , "hostname2" , ImmutableMap .of ())),
646+ 70 /* localityWeight */ , priority /* priority */ , ImmutableMap .of ());
647647 }
648648
649649 @ Test
650650 public void onlyEdsClusters_resourceNeverExist_returnErrorPicker () {
651651 ClusterResolverConfig config = new ClusterResolverConfig (
652- edsDiscoveryMechanism1 , roundRobin , false );
652+ edsDiscoveryMechanism1 , roundRobin , false );
653653 deliverLbConfig (config );
654654 assertThat (xdsClient .watchers .keySet ()).containsExactly (EDS_SERVICE_NAME1 );
655655 assertThat (childBalancers ).isEmpty ();
0 commit comments