use of com.sequenceiq.cloudbreak.cloud.model.CloudLoadBalancerMetadata in project cloudbreak by hortonworks.
the class LoadBalancerConfigConverterTest method testConvertAwsLoadBalancer.
@Test
public void testConvertAwsLoadBalancer() {
CloudLoadBalancerMetadata cloudLoadBalancerMetadata = new CloudLoadBalancerMetadata.Builder().withParameters(createAwsParams(0)).build();
LoadBalancerConfigDbWrapper cloudLoadBalancerConfigDbWrapper = underTest.convertLoadBalancer(AWS, cloudLoadBalancerMetadata);
assertNotNull(cloudLoadBalancerConfigDbWrapper.getAwsConfig());
AwsLoadBalancerConfigDb awsLoadBalancerConfigDb = cloudLoadBalancerConfigDbWrapper.getAwsConfig();
assertEquals(LB_ARN, awsLoadBalancerConfigDb.getArn());
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudLoadBalancerMetadata in project cloudbreak by hortonworks.
the class LoadBalancerConfigConverterTest method testConvertAwsTargetGroup.
@Test
public void testConvertAwsTargetGroup() {
CloudLoadBalancerMetadata cloudLoadBalancerMetadata = new CloudLoadBalancerMetadata.Builder().withParameters(createAwsParams(1)).build();
TargetGroup targetGroup = new TargetGroup();
targetGroup.setType(TargetGroupType.KNOX);
TargetGroupPortPair portPair = new TargetGroupPortPair(PORT1, PORT2);
when(loadBalancerConfigService.getTargetGroupPortPairs(eq(targetGroup))).thenReturn(Set.of(portPair));
TargetGroupConfigDbWrapper targetGroupConfigDbWrapper = underTest.convertTargetGroup(AWS, cloudLoadBalancerMetadata, targetGroup);
assertNotNull(targetGroupConfigDbWrapper.getAwsConfig());
AwsTargetGroupConfigDb awsTargetGroupConfigDb = targetGroupConfigDbWrapper.getAwsConfig();
assertEquals(1, awsTargetGroupConfigDb.getPortArnMapping().size());
assertEquals(PORT1, awsTargetGroupConfigDb.getPortArnMapping().keySet().iterator().next());
AwsTargetGroupArnsDb targetGroupArns = awsTargetGroupConfigDb.getPortArnMapping().get(PORT1);
assertEquals(LISTENER_ARN, targetGroupArns.getListenerArn());
assertEquals(TARGET_ARN, targetGroupArns.getTargetGroupArn());
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudLoadBalancerMetadata in project cloudbreak by hortonworks.
the class LoadBalancerConfigConverterTest method testConvertAzureTargetGroup.
@Test
public void testConvertAzureTargetGroup() {
CloudLoadBalancerMetadata cloudLoadBalancerMetadata = new CloudLoadBalancerMetadata.Builder().withParameters(createAzureParams(1)).build();
TargetGroup targetGroup = new TargetGroup();
targetGroup.setType(TargetGroupType.KNOX);
TargetGroupPortPair portPair = new TargetGroupPortPair(PORT1, PORT2);
when(loadBalancerConfigService.getTargetGroupPortPairs(eq(targetGroup))).thenReturn(Set.of(portPair));
TargetGroupConfigDbWrapper targetGroupConfigDbWrapper = underTest.convertTargetGroup(AZURE, cloudLoadBalancerMetadata, targetGroup);
assertNotNull(targetGroupConfigDbWrapper.getAzureConfig());
AzureTargetGroupConfigDb azureTargetGroupConfigDb = targetGroupConfigDbWrapper.getAzureConfig();
assertEquals(1, azureTargetGroupConfigDb.getPortAvailabilitySetMapping().size());
assertEquals(PORT1, azureTargetGroupConfigDb.getPortAvailabilitySetMapping().keySet().iterator().next());
List<String> availabilitySets = azureTargetGroupConfigDb.getPortAvailabilitySetMapping().get(PORT1);
assertEquals(1, availabilitySets.size());
assertEquals(AVAILABILITY_SET_NAME, availabilitySets.get(0));
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudLoadBalancerMetadata in project cloudbreak by hortonworks.
the class LoadBalancerConfigConverterTest method testConvertAwsTargetGroupMissingPortInMetadata.
@Test
public void testConvertAwsTargetGroupMissingPortInMetadata() {
CloudLoadBalancerMetadata cloudLoadBalancerMetadata = new CloudLoadBalancerMetadata.Builder().withParameters(createAwsParams(1)).build();
TargetGroup targetGroup = new TargetGroup();
targetGroup.setType(TargetGroupType.KNOX);
TargetGroupPortPair portPair1 = new TargetGroupPortPair(PORT1, PORT1);
TargetGroupPortPair portPair2 = new TargetGroupPortPair(PORT2, PORT2);
when(loadBalancerConfigService.getTargetGroupPortPairs(eq(targetGroup))).thenReturn(Set.of(portPair1, portPair2));
TargetGroupConfigDbWrapper targetGroupConfigDbWrapper = underTest.convertTargetGroup(AWS, cloudLoadBalancerMetadata, targetGroup);
assertNotNull(targetGroupConfigDbWrapper.getAwsConfig());
AwsTargetGroupConfigDb awsTargetGroupConfigDb = targetGroupConfigDbWrapper.getAwsConfig();
assertEquals(2, awsTargetGroupConfigDb.getPortArnMapping().size());
assertEquals(Set.of(PORT1, PORT2), awsTargetGroupConfigDb.getPortArnMapping().keySet());
AwsTargetGroupArnsDb targetGroupArns = awsTargetGroupConfigDb.getPortArnMapping().get(PORT1);
assertEquals(LISTENER_ARN, targetGroupArns.getListenerArn());
assertEquals(TARGET_ARN, targetGroupArns.getTargetGroupArn());
targetGroupArns = awsTargetGroupConfigDb.getPortArnMapping().get(PORT2);
assertEquals(MISSING_CLOUD_RESOURCE, targetGroupArns.getListenerArn());
assertEquals(MISSING_CLOUD_RESOURCE, targetGroupArns.getTargetGroupArn());
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudLoadBalancerMetadata in project cloudbreak by hortonworks.
the class LoadBalancerConfigConverterTest method testConvertAzureLoadBalancer.
@Test
public void testConvertAzureLoadBalancer() {
CloudLoadBalancerMetadata cloudLoadBalancerMetadata = new CloudLoadBalancerMetadata.Builder().withParameters(createAzureParams(0)).build();
LoadBalancerConfigDbWrapper cloudLoadBalancerConfigDbWrapper = underTest.convertLoadBalancer(AZURE, cloudLoadBalancerMetadata);
assertNotNull(cloudLoadBalancerConfigDbWrapper.getAzureConfig());
AzureLoadBalancerConfigDb azureLoadBalancerConfigDb = cloudLoadBalancerConfigDbWrapper.getAzureConfig();
assertEquals(LB_NAME, azureLoadBalancerConfigDb.getName());
}
Aggregations