use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class YarnEnvironmentNetworkValidatorTest method testValidateDuringFlowWhenNoQueueInYarnParams.
@Test
void testValidateDuringFlowWhenNoQueueInYarnParams() {
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, null, YarnParams.builder().build(), null, null, 1);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setNetwork(networkDto);
EnvironmentValidationDto environmentValidationDto = EnvironmentValidationDto.builder().withEnvironmentDto(environmentDto).build();
underTest.validateDuringFlow(environmentValidationDto, networkDto, resultBuilder);
NetworkTestUtils.checkErrorsPresent(resultBuilder, List.of("The 'Queue(queue)' parameter should be specified for the 'YARN' environment specific network!"));
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class YarnEnvironmentNetworkValidatorTest method testValidateDuringFlowWhenLifetimeLessThenZeroInYarnParams.
@Test
void testValidateDuringFlowWhenLifetimeLessThenZeroInYarnParams() {
YarnParams yarnParams = YarnParams.builder().withQueue("queue").withLifetime(-1).build();
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, null, yarnParams, null, null, 1);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
EnvironmentDto environmentDto = new EnvironmentDto();
environmentDto.setNetwork(networkDto);
EnvironmentValidationDto environmentValidationDto = EnvironmentValidationDto.builder().withEnvironmentDto(environmentDto).build();
underTest.validateDuringFlow(environmentValidationDto, networkDto, resultBuilder);
NetworkTestUtils.checkErrorsPresent(resultBuilder, List.of("The 'lifetime' parameter should be non negative for 'YARN' environment specific network!"));
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class YarnEnvironmentNetworkValidatorTest method testCheckNullableWhenNetworkIsNotNull.
@Test
public void testCheckNullableWhenNetworkIsNotNull() {
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
NetworkDto networkDto = mock(NetworkDto.class);
underTest.checkNullable(CloudPlatform.YARN, 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 YarnEnvironmentNetworkValidatorTest method testValidateWhenNoNetworkCidrAndNoNetworkId.
@Test
void testValidateWhenNoNetworkCidrAndNoNetworkId() {
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(null, null, YarnParams.builder().build(), null, null, 1);
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.validateDuringRequest(networkDto, resultBuilder);
assertFalse(resultBuilder.build().hasError());
}
use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.
the class NetworkCreationValidatorTest method testValidateWhenNoNetworkCidrAndNetworkIdOnAzure.
@Test
void testValidateWhenNoNetworkCidrAndNetworkIdOnAzure() {
AzureParams azureParams = NetworkTestUtils.getAzureParams(true, true, true);
NetworkDto networkDto = NetworkTestUtils.getNetworkDto(azureParams, null, null, azureParams.getNetworkId(), null, 1);
environment.setCloudPlatform(CloudPlatform.AZURE.name());
environment.setCidr(null);
ValidationResultBuilder resultBuilder = underTest.validateNetworkCreation(environment, networkDto);
ValidationResult validationResult = resultBuilder.build();
assertFalse(validationResult.hasError());
}
Aggregations