Search in sources :

Example 26 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class AzureEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNoNetworkCidrAndNetworkId.

@Test
void testValidateDuringRequestWhenNoNetworkCidrAndNetworkId() {
    AzureParams azureParams = NetworkTestUtils.getAzureParams(true, true, true);
    NetworkDto networkDto = NetworkTestUtils.getNetworkDto(azureParams, null, null, azureParams.getNetworkId(), null, 1);
    ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
    underTest.validateDuringRequest(networkDto, resultBuilder);
    ValidationResult validationResult = resultBuilder.build();
    assertFalse(validationResult.hasError());
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) AzureParams(com.sequenceiq.environment.network.dto.AzureParams) ValidationResultBuilder(com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) Test(org.junit.jupiter.api.Test)

Example 27 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class AzureEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenSubnetsWithNoNetworkId.

@Test
void testValidateDuringRequestWhenSubnetsWithNoNetworkId() {
    AzureParams azureParams = NetworkTestUtils.getAzureParams(true, false, true);
    NetworkDto networkDto = NetworkTestUtils.getNetworkDto(azureParams, null, null, null, null, 2);
    ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
    underTest.validateDuringRequest(networkDto, resultBuilder);
    NetworkTestUtils.checkErrorsPresent(resultBuilder, List.of("Either the AZURE network id or cidr needs to be defined!", "If resourceGroupName is specified, then networkId must be specified too.", "If subnetIds are specified, then networkId must be specified too."));
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) AzureParams(com.sequenceiq.environment.network.dto.AzureParams) ValidationResultBuilder(com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder) Test(org.junit.jupiter.api.Test)

Example 28 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class AzureEnvironmentNetworkValidatorTest method testValidateDuringRequestWhenNoNetworkCidrAndNoResourceGroupName.

@Test
void testValidateDuringRequestWhenNoNetworkCidrAndNoResourceGroupName() {
    AzureParams azureParams = NetworkTestUtils.getAzureParams(true, true, false);
    NetworkDto networkDto = NetworkTestUtils.getNetworkDto(azureParams, null, null, azureParams.getNetworkId(), null, 1);
    ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
    underTest.validateDuringRequest(networkDto, resultBuilder);
    NetworkTestUtils.checkErrorsPresent(resultBuilder, List.of("If networkId is specified, then resourceGroupName must be specified too."));
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) AzureParams(com.sequenceiq.environment.network.dto.AzureParams) ValidationResultBuilder(com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder) Test(org.junit.jupiter.api.Test)

Example 29 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class AzureExistingPrivateDnsZonesServiceTest method testGetServicesWithExistingZonesWhenPostgresWithExistingPrivateDnsZone.

@Test
void testGetServicesWithExistingZonesWhenPostgresWithExistingPrivateDnsZone() {
    NetworkDto networkDto = getNetworkDto("postgresPrivateDnsZoneId");
    Set<AzurePrivateDnsZoneServiceEnum> servicesWithPrivateDnsZones = underTest.getServicesWithExistingZones(networkDto);
    assertThat(servicesWithPrivateDnsZones).hasSize(1);
    assertThat(servicesWithPrivateDnsZones).contains(AzurePrivateDnsZoneServiceEnum.POSTGRES);
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) AzurePrivateDnsZoneServiceEnum(com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum) Test(org.junit.jupiter.api.Test)

Example 30 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class AzureExistingPrivateDnsZonesServiceTest method testGetServicesWithExistingZonesWhenNoServicesWithExistingPrivateDnsZone.

@Test
void testGetServicesWithExistingZonesWhenNoServicesWithExistingPrivateDnsZone() {
    NetworkDto networkDto = getNetworkDto(null);
    Set<AzurePrivateDnsZoneServiceEnum> servicesWithPrivateDnsZones = underTest.getServicesWithExistingZones(networkDto);
    assertThat(servicesWithPrivateDnsZones).isEmpty();
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) AzurePrivateDnsZoneServiceEnum(com.sequenceiq.cloudbreak.cloud.azure.AzurePrivateDnsZoneServiceEnum) Test(org.junit.jupiter.api.Test)

Aggregations

NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)144 Test (org.junit.jupiter.api.Test)124 ValidationResultBuilder (com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder)59 AzureParams (com.sequenceiq.environment.network.dto.AzureParams)40 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)31 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)27 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)21 EnvironmentValidationDto (com.sequenceiq.environment.environment.dto.EnvironmentValidationDto)21 UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)15 Environment (com.sequenceiq.environment.environment.domain.Environment)15 ProvidedSubnetIds (com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 AwsNetwork (com.sequenceiq.environment.network.dao.domain.AwsNetwork)12 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)10 AwsParams (com.sequenceiq.environment.network.dto.AwsParams)9 Features (com.sequenceiq.common.api.telemetry.model.Features)8 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)7 EnvironmentRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest)7 ExperimentalFeatures (com.sequenceiq.environment.environment.domain.ExperimentalFeatures)7 BaseNetwork (com.sequenceiq.environment.network.dao.domain.BaseNetwork)7