use of com.amazonaws.services.elasticloadbalancingv2.model.DescribeLoadBalancersResult in project cloudbreak by hortonworks.
the class AwsNativeMetadataCollectorTest method collectLoadBalancerMetadataWhenTheSpecifiedArnsExists.
@Test
void collectLoadBalancerMetadataWhenTheSpecifiedArnsExists() {
List<LoadBalancerType> loadBalancerTypes = List.of();
CloudResource cloudResource = getCloudResource("aCrn", "lbname", null, ELASTIC_LOAD_BALANCER);
CloudResource secondCloudResource = getCloudResource("secondCrn", "lbnamesecond", null, ELASTIC_LOAD_BALANCER);
List<CloudResource> cloudResources = List.of(cloudResource, secondCloudResource);
when(awsClient.createElasticLoadBalancingClient(any(), any())).thenReturn(loadBalancingClient);
LoadBalancer loadBalancer = new LoadBalancer();
loadBalancer.setScheme(LoadBalancerSchemeEnum.Internal);
when(loadBalancingClient.describeLoadBalancers(any())).thenReturn(new DescribeLoadBalancersResult().withLoadBalancers(loadBalancer));
List<CloudLoadBalancerMetadata> cloudLoadBalancerMetadata = underTest.collectLoadBalancer(authenticatedContext, loadBalancerTypes, cloudResources);
verify(loadBalancingClient, times(2)).describeLoadBalancers(any());
assertFalse(cloudLoadBalancerMetadata.isEmpty());
assertEquals(cloudResources.size(), cloudLoadBalancerMetadata.size());
}
Aggregations