use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.AzureTargetGroupResponse in project cloudbreak by hortonworks.
the class LoadBalancerToLoadBalancerResponseConverter method convertAzureTargetGroup.
private AzureTargetGroupResponse convertAzureTargetGroup(AzureTargetGroupConfigDb azureConfig, Integer port) {
if (azureConfig != null) {
List<String> availabilitySets = azureConfig.getPortAvailabilitySetMapping().get(port);
AzureTargetGroupResponse azureSettings = new AzureTargetGroupResponse();
azureSettings.setAvailabilitySet(availabilitySets);
return azureSettings;
}
return null;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.loadbalancer.AzureTargetGroupResponse in project cloudbreak by hortonworks.
the class LoadBalancerToLoadBalancerResponseConverterTest method testConvertAzure.
@Test
public void testConvertAzure() {
LoadBalancer source = getSource();
// GIVEN
getSource().setProviderConfig(createAzureLoadBalancerConfig());
given(targetGroupService.findByLoadBalancerId(any())).willReturn(createAzureTargetGroups());
// WHEN
LoadBalancerResponse response = underTest.convert(source);
// THEN
assertAllFieldsNotNull(response, List.of("awsResourceId", "gcpResourceId"));
assertEquals(AZURE_LB_NAME, response.getAzureResourceId().getName());
assertEquals(1, response.getTargets().size());
TargetGroupResponse targetGroupResponse = response.getTargets().get(0);
assertEquals(PORT, targetGroupResponse.getPort());
assertEquals(Set.of(INSTANCE_ID), targetGroupResponse.getTargetInstances());
AzureTargetGroupResponse azureTargetGroupResponse = targetGroupResponse.getAzureResourceId();
assertNotNull(azureTargetGroupResponse);
assertEquals(List.of(AZURE_AS_NAME), azureTargetGroupResponse.getAvailabilitySet());
}
Aggregations