use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPublicTest method testSelectHAPublicSubnetWhenMixedSubnetPresentedShouldReturnMixedSubnetsWithNotUniquePublicAzs.
@Test
public void testSelectHAPublicSubnetWhenMixedSubnetPresentedShouldReturnMixedSubnetsWithNotUniquePublicAzs() {
List<CloudSubnet> subnets = new SubnetBuilder().withPrivateSubnet(AZ_A).withPrivateSubnet(AZ_B).withPrivateSubnet(AZ_B).withPublicSubnet(AZ_C).withPublicSubnet(AZ_D).withPublicSubnet(AZ_D).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 3);
verify(subnetSelectorService, times(1)).collectPublicSubnets(anyCollection());
verify(subnetSelectorService, times(1)).collectPrivateSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(4));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPublicTest method testSelectNonHAMixedSubnetWhenOnlyPrivateSubnetPresentedShouldReturnMixedSubnets.
@Test
public void testSelectNonHAMixedSubnetWhenOnlyPrivateSubnetPresentedShouldReturnMixedSubnets() {
List<CloudSubnet> subnets = new SubnetBuilder().withPublicSubnet(AZ_A).withPublicSubnet(AZ_B).withPublicSubnet(AZ_B).withPrivateSubnet(AZ_C).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 1);
verify(subnetSelectorService, times(1)).collectPublicSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(3));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPublicTest method testSelectNonHAPrivateSubnetWhenOnlyPrivateAndPublicSubnetPresentedShouldReturnPrivateSubnets.
@Test
public void testSelectNonHAPrivateSubnetWhenOnlyPrivateAndPublicSubnetPresentedShouldReturnPrivateSubnets() {
List<CloudSubnet> subnets = new SubnetBuilder().withPrivateSubnet(AZ_A).withPrivateSubnet(AZ_B).withPrivateSubnet(AZ_B).withPublicSubnet(AZ_C).withPublicSubnet(AZ_D).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 1);
verify(subnetSelectorService, times(1)).collectPublicSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(2));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPublicTest method testSelectHAPublicSubnetWhenOnlyPublicSubnetPresentedShouldReturnPublicSubnets.
@Test
public void testSelectHAPublicSubnetWhenOnlyPublicSubnetPresentedShouldReturnPublicSubnets() {
List<CloudSubnet> subnets = new SubnetBuilder().withPublicSubnet(AZ_A).withPublicSubnet(AZ_B).withPublicSubnet(AZ_B).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 3);
verify(subnetSelectorService, times(1)).collectPublicSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(3));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class AzureSubnetSelectorServiceTest method testSelectWhenSubnetmetasNullThenReturnsError.
@Test
public void testSelectWhenSubnetmetasNullThenReturnsError() {
SubnetSelectionResult subnetSelectionResult = underTest.select(null, SubnetSelectionParameters.builder().build());
assertTrue(subnetSelectionResult.hasError());
assertEquals("Azure subnet selection: there are no subnets to choose from.", subnetSelectionResult.getErrorMessage());
}
Aggregations