use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testCheckNullableWhenNetworkIsNotNull.
@Test
public void testCheckNullableWhenNetworkIsNotNull() {
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
NetworkDto networkDto = mock(NetworkDto.class);
underTest.checkNullable(CloudPlatform.AWS, networkDto, resultBuilder);
ValidationResult actual = resultBuilder.build();
Assertions.assertThat(actual.hasError()).isFalse();
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AzureEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNetworkIdWithNoSubnets.
@Test
void testValidateDuringRequestWhenNetworkIdWithNoSubnets() {
AzureParams azureParams = NetworkTestUtils.getAzureParams(true, true, true);
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(azureParams, null, null, azureParams.getNetworkId(), null, null);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateDuringRequest(networkDto, resultBuilder);
NetworkTestUtils.checkErrorsPresent(resultBuilder, List.of("If networkId (aNetworkId) and resourceGroupName (aResourceGroupId) are specified then subnet ids must be specified as well."));
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AzureEnvironmentNetworkValidatorTest method testValidateDuringFlowWhenEnvironmentIsBeingEditedThenPrivateEndpointValidationsSkipped.
@Test
void testValidateDuringFlowWhenEnvironmentIsBeingEditedThenPrivateEndpointValidationsSkipped() {
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
AzureParams azureParams = getAzureParams("", "networkResourceGroupName");
NetworkDto networkDto = getNetworkDto(azureParams);
when(cloudNetworkService.retrieveSubnetMetadata(any(EnvironmentDto.class), any())).thenReturn(getCloudSubnets(false));
EnvironmentValidationDto environmentDto = environmentValidationDtoWithSingleRg(MY_SINGLE_RG, ResourceGroupUsagePattern.USE_SINGLE);
environmentDto.setValidationType(ValidationType.ENVIRONMENT_EDIT);
underTest.validateDuringFlow(environmentDto, networkDto, validationResultBuilder);
verify(azurePrivateEndpointValidator, never()).checkNewPrivateDnsZone(any(), any(), any());
verify(azurePrivateEndpointValidator, never()).checkMultipleResourceGroup(any(), any(), any());
verify(azurePrivateEndpointValidator, never()).checkNewPrivateDnsZone(any(), any(), any());
verify(azurePrivateEndpointValidator, never()).checkExistingPrivateDnsZone(any(), any(), any());
assertFalse(validationResultBuilder.build().hasError());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AzureEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenTheNetworkDoesNotContainAzureNetworkParams.
@Test
void testValidateDuringRequestWhenTheNetworkDoesNotContainAzureNetworkParams() {
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, null, null, null, null, 1);
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
underTest.validateDuringRequest(networkDto, validationResultBuilder);
NetworkTestUtils.checkErrorsPresent(validationResultBuilder, List.of("The 'AZURE' related network parameters should be specified!", "Either the AZURE network id or cidr needs to be defined!"));
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class AzureEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNetworkCidrAndNoAzureParams.
@Test
void testValidateDuringRequestWhenNetworkCidrAndNoAzureParams() {
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, null, null, null, "0.0.0.0/0", null);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateDuringRequest(networkDto, resultBuilder);
ValidationResult validationResult = resultBuilder.build();
assertFalse(validationResult.hasError(), validationResult.getFormattedErrors());
}
Aggregations