use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class GcpNetworkConnectorTest method testFilterSubnets.
@Test
public void testFilterSubnets() {
when(gcpSubnetSelectorService.select(anyCollection(), any(SubnetSelectionParameters.class))).thenReturn(new SubnetSelectionResult(new ArrayList<>()));
underTest.filterSubnets(new ArrayList<>(), SubnetSelectionParameters.builder().build());
verify(gcpSubnetSelectorService, times(1)).select(anyCollection(), any(SubnetSelectionParameters.class));
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class GcpSubnetSelectorServiceTest method testSelectWhenNoSubnetSelectionParametersShouldReturnError.
@Test
public void testSelectWhenNoSubnetSelectionParametersShouldReturnError() {
SubnetSelectionResult select = underTest.select(generateSubnetMetas(1), null);
Assert.assertEquals(select.getErrorMessage(), "GCP subnet selection: parameters were not specified.");
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionResult in project cloudbreak by hortonworks.
the class SubnetFilterStrategyMultiplePreferPrivateTest method testFilterPrivateSubnetWhenOnlyPrivateAndPublicSubnetPresentedShouldReturnPrivateSubnets.
@Test
public void testFilterPrivateSubnetWhenOnlyPrivateAndPublicSubnetPresentedShouldReturnPrivateSubnets() {
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, 3);
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 SubnetFilterStrategyMultiplePreferPrivateTest method testFilterHAPrivateSubnetWhenMixedSubnetWithDifferentAzPresentedShouldReturnPrivateAnPublicSubnets.
@Test
public void testFilterHAPrivateSubnetWhenMixedSubnetWithDifferentAzPresentedShouldReturnPrivateAnPublicSubnets() {
List<CloudSubnet> subnets = new SubnetBuilder().withPrivateSubnet(AZ_A).withPrivateSubnet(AZ_B).withPublicSubnet(AZ_C).build();
SubnetSelectionResult chosenSubnets = underTest.filter(subnets, 3);
verify(subnetSelectorService, times(1)).collectPrivateSubnets(anyCollection());
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 testSelectHAPublicSubnetWhenMixedSubnetPresentedShouldReturnMixedSubnets.
@Test
public void testSelectHAPublicSubnetWhenMixedSubnetPresentedShouldReturnMixedSubnets() {
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, 3);
verify(subnetSelectorService, times(1)).collectPublicSubnets(anyCollection());
verify(subnetSelectorService, times(1)).collectPrivateSubnets(anyCollection());
assertThat(chosenSubnets.getResult(), hasSize(3));
}
Aggregations