use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionParameters in project cloudbreak by hortonworks.
the class SubnetChooserServiceTest method testChooseSubnetsThenNetworkSelectorCalled.
@Test
public void testChooseSubnetsThenNetworkSelectorCalled() {
List<CloudSubnet> subnets = List.of(new CloudSubnet(SUBNET_1, "", AVAILABILITY_ZONE_A, ""), new CloudSubnet(SUBNET_2, "", AVAILABILITY_ZONE_B, ""), new CloudSubnet(SUBNET_3, "", AVAILABILITY_ZONE_B, ""));
NetworkConnector networkConnector = setupConnector();
underTest.chooseSubnets(subnets, CloudPlatform.AWS, new DBStack());
ArgumentCaptor<SubnetSelectionParameters> subnetSelectionParametersCaptor = ArgumentCaptor.forClass(SubnetSelectionParameters.class);
verify(networkConnector).chooseSubnets(eq(subnets), subnetSelectionParametersCaptor.capture());
assertTrue(subnetSelectionParametersCaptor.getValue().isPreferPrivateIfExist());
assertTrue(subnetSelectionParametersCaptor.getValue().isHa());
}
use of com.sequenceiq.cloudbreak.cloud.model.SubnetSelectionParameters in project cloudbreak by hortonworks.
the class SubnetChooserServiceTest method testChooseSubnetsWhenAwsNoHaThenHaIsFalse.
@Test
public void testChooseSubnetsWhenAwsNoHaThenHaIsFalse() {
List<CloudSubnet> subnets = List.of();
NetworkConnector networkConnector = setupConnector();
DBStack dbStack = mock(DBStack.class);
when(dbStack.isHa()).thenReturn(false);
underTest.chooseSubnets(subnets, CloudPlatform.AWS, dbStack);
ArgumentCaptor<SubnetSelectionParameters> subnetSelectionParametersCaptor = ArgumentCaptor.forClass(SubnetSelectionParameters.class);
verify(networkConnector).chooseSubnets(eq(subnets), subnetSelectionParametersCaptor.capture());
assertTrue(subnetSelectionParametersCaptor.getValue().isPreferPrivateIfExist());
assertFalse(subnetSelectionParametersCaptor.getValue().isHa());
}
Aggregations