use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method testConvertToStackRequestWhenAzurePresentedWithoutSubnet.
@Test
public void testConvertToStackRequestWhenAzurePresentedWithoutSubnet() {
NetworkV1Request networkV1Request = azureEmptyNetworkV1Request();
DetailedEnvironmentResponse environmentNetworkResponse = azureEnvironmentNetwork();
NetworkV4Request networkV4Request = underTest.convertToNetworkV4Request(new ImmutablePair<>(networkV1Request, environmentNetworkResponse));
assertEquals(networkV4Request.createAzure().getNetworkId(), VPC_ID);
assertEquals(networkV4Request.createAzure().getResourceGroupName(), GROUP_NAME);
assertTrue(SUBNET_IDS.contains(networkV4Request.createAzure().getSubnetId()));
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method createEnvironmentNetworkResponseForMock.
private EnvironmentNetworkResponse createEnvironmentNetworkResponseForMock() {
EnvironmentNetworkResponse environmentNetworkResponse = new EnvironmentNetworkResponse();
environmentNetworkResponse.setSubnetIds(SUBNET_IDS);
environmentNetworkResponse.setPreferedSubnetId(SUBNET_ID);
environmentNetworkResponse.setMock(createEnvironmentNetworkMockParams());
return environmentNetworkResponse;
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class NetworkV1ToNetworkV4ConverterTest method testConvertToStackRequestWhenAwsPresentedWithoutSubnet.
@Test
public void testConvertToStackRequestWhenAwsPresentedWithoutSubnet() {
NetworkV1Request networkV1Request = awsEmptyNetworkV1Request();
DetailedEnvironmentResponse environmentNetworkResponse = awsEnvironmentNetwork();
NetworkV4Request[] networkV4Request = new NetworkV4Request[1];
ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> {
networkV4Request[0] = underTest.convertToNetworkV4Request(new ImmutablePair<>(networkV1Request, environmentNetworkResponse));
});
assertEquals(networkV4Request[0].createAws().getVpcId(), VPC_ID);
assertTrue(SUBNET_IDS.contains(networkV4Request[0].createAws().getSubnetId()));
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class EnvironmentValidatorTest method createNetwork.
private EnvironmentNetworkResponse createNetwork(Map<String, CloudSubnet> subnetMetas) {
EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
network.setSubnetMetas(subnetMetas);
return network;
}
use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.
the class MultiAzDecoratorTest method decorateStackRequestWithMultiAzShouldUseTheSingleEnvironmentPreferredSubnetIdWhenClusterShapeIsNotHA.
@Test
void decorateStackRequestWithMultiAzShouldUseTheSingleEnvironmentPreferredSubnetIdWhenClusterShapeIsNotHA() {
StackV4Request stackV4Request = new StackV4Request();
stackV4Request.setInstanceGroups(List.of(getInstanceGroupV4Request(InstanceGroupType.GATEWAY), getInstanceGroupV4Request(InstanceGroupType.CORE)));
EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
network.setPreferedSubnetId(PREFERRED_SUBNET_ID);
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setNetwork(network);
underTest.decorateStackRequestWithMultiAz(stackV4Request, environment, SdxClusterShape.LIGHT_DUTY);
Assertions.assertTrue(stackV4Request.getInstanceGroups().stream().allMatch(ig -> ig.getNetwork().getAws().getSubnetIds().stream().allMatch(PREFERRED_SUBNET_ID::equals)));
}
Aggregations