use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class NetworkRequestToDtoConverterTest method testConvertGcp.
@Test
void testConvertGcp() {
EnvironmentNetworkRequest network = createNetworkRequest();
network.setGcp(createGcpParams());
NetworkDto actual = underTest.convert(network);
assertEquals(network.getGcp().getNetworkId(), actual.getGcp().getNetworkId());
assertEquals(network.getGcp().getNetworkId(), actual.getNetworkId());
assertCommonFields(network, actual);
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class NetworkRequestToDtoConverterTest method testConvertAzure.
@Test
void testConvertAzure() {
EnvironmentNetworkRequest network = createNetworkRequest();
network.setAzure(createAzureParams());
NetworkDto actual = underTest.convert(network);
assertEquals(network.getAzure().getNetworkId(), actual.getAzure().getNetworkId());
assertEquals(network.getAzure().getResourceGroupName(), actual.getAzure().getResourceGroupName());
assertEquals(network.getAzure().getNoPublicIp(), actual.getAzure().isNoPublicIp());
assertCommonFields(network, actual);
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class NetworkRequestToDtoConverterTest method testConvertMock.
@Test
void testConvertMock() {
EnvironmentNetworkRequest network = createNetworkRequest();
network.setMock(createMockParams());
NetworkDto actual = underTest.convert(network);
assertEquals(network.getMock().getVpcId(), actual.getMock().getVpcId());
assertEquals(network.getMock().getInternetGatewayId(), actual.getMock().getInternetGatewayId());
assertCommonFields(network, actual);
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNetworkHasOneSubnet.
@Test
void testValidateDuringRequestWhenNetworkHasOneSubnet() {
int amountOfSubnets = 1;
AwsParams awsParams = getAwsParams();
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, getAwsParams(), null, awsParams.getVpcId(), null, amountOfSubnets, RegistrationType.EXISTING);
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setNetwork(networkDto);
EnvironmentValidationDto environmentValidationDto = EnvironmentValidationDto.builder().withEnvironmentDto(environmentDto).build();
Map<String, CloudSubnet> subnetMetas = new HashMap<>();
for (int i = 0; i < amountOfSubnets; i++) {
subnetMetas.put("key" + i, NetworkTestUtils.getCloudSubnet("eu-west-1-a"));
}
when(cloudNetworkService.retrieveSubnetMetadata(environmentDto, networkDto)).thenReturn(subnetMetas);
underTest.validateDuringFlow(environmentValidationDto, networkDto, validationResultBuilder);
NetworkTestUtils.checkErrorsPresent(validationResultBuilder, List.of("There should be at least two Subnets in the environment network configuration"));
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNetworkHasTwoSubnet.
@Test
void testValidateDuringRequestWhenNetworkHasTwoSubnet() {
AwsParams awsParams = getAwsParams();
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, getAwsParams(), null, awsParams.getVpcId(), null, 2);
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
underTest.validateDuringRequest(networkDto, validationResultBuilder);
ValidationResult validationResult = validationResultBuilder.build();
assertFalse(validationResult.hasError(), validationResult.getFormattedErrors());
}
Aggregations