use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AzurePrivateEndpointValidatorTest method testCheckNetworkPoliciesWhenExistingNetworkWhenPrivateEndpointNetworkPoliciesDisabled.
@Test
void testCheckNetworkPoliciesWhenExistingNetworkWhenPrivateEndpointNetworkPoliciesDisabled() {
ValidationResult.ValidationResultBuilder validationResultBuilder = new ValidationResult.ValidationResultBuilder();
NetworkDto networkDto = getNetworkDto(getAzureParams());
when(azureCloudSubnetParametersService.isPrivateEndpointNetworkPoliciesDisabled(any())).thenCallRealMethod();
underTest.checkNetworkPoliciesWhenExistingNetwork(networkDto, getCloudSubnets(false), validationResultBuilder);
assertFalse(validationResultBuilder.build().hasError());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AzurePrivateEndpointValidatorTest method testCheckExistingPrivateDnsZoneWhenNoExistingDnsZonesProvided.
@Test
void testCheckExistingPrivateDnsZoneWhenNoExistingDnsZonesProvided() {
ValidationResult.ValidationResultBuilder validationResultBuilder = new ValidationResult.ValidationResultBuilder();
EnvironmentDto environmentDto = getEnvironmentDto(null, ResourceGroupUsagePattern.USE_SINGLE);
NetworkDto networkDto = getNetworkDto(getAzureParams(), ServiceEndpointCreation.ENABLED_PRIVATE_ENDPOINT);
when(azureExistingPrivateDnsZonesService.hasNoExistingZones(networkDto)).thenReturn(true);
underTest.checkExistingPrivateDnsZone(validationResultBuilder, environmentDto, networkDto);
verify(credentialToCloudCredentialConverter, never()).convert(any());
verify(azureClientService, never()).getClient(any());
verify(azureExistingPrivateDnsZoneValidatorService, never()).validate(any(), any(), any(), any(), any());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNetworkHasCidr.
@Test
void testValidateDuringRequestWhenNetworkHasCidr() {
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, null, null, null, "1.2.3.4/16", 1, RegistrationType.CREATE_NEW);
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setNetwork(networkDto);
EnvironmentValidationDto environmentValidationDto = EnvironmentValidationDto.builder().withEnvironmentDto(environmentDto).build();
underTest.validateDuringFlow(environmentValidationDto, networkDto, validationResultBuilder);
assertFalse(validationResultBuilder.build().hasError());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringFlowWhenTheAwsNetworkParamsContainsVPCId.
@Test
void testValidateDuringFlowWhenTheAwsNetworkParamsContainsVPCId() {
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
AwsParams awsParams = AwsParams.builder().withVpcId("aVPCResourceIDFromAWS").build();
NetworkDto networkDto = NetworkDto.builder().withId(1L).withName("networkName").withResourceCrn("aResourceCRN").withAws(awsParams).build();
underTest.validateDuringRequest(networkDto, validationResultBuilder);
assertFalse(validationResultBuilder.build().hasError());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringFlowWhenTheAwsNetworkParamsDoesNotContainVPCId.
@Test
void testValidateDuringFlowWhenTheAwsNetworkParamsDoesNotContainVPCId() {
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
AwsParams awsParams = AwsParams.builder().build();
NetworkDto networkDto = NetworkDto.builder().withId(1L).withName("networkName").withResourceCrn("aResourceCRN").withAws(awsParams).build();
underTest.validateDuringRequest(networkDto, validationResultBuilder);
NetworkTestUtils.checkErrorsPresent(validationResultBuilder, List.of("The 'VPC identifier(vpcId)' parameter should be specified for the 'AWS' environment specific network!"));
}
Aggregations