use of com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder 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!"));
}
use of com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testValidateDuringFlowWhenNetworkDtoIsNullThenNoCloudServiceRelatedCallHappens.
@Test
void testValidateDuringFlowWhenNetworkDtoIsNullThenNoCloudServiceRelatedCallHappens() {
ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder();
underTest.validateDuringFlow(new EnvironmentValidationDto(), null, validationResultBuilder);
verify(cloudNetworkService, times(0)).retrieveSubnetMetadata(any(EnvironmentDto.class), any(NetworkDto.class));
verify(cloudNetworkService, times(0)).retrieveSubnetMetadata(any(Environment.class), any(NetworkDto.class));
ValidationResult validationResult = validationResultBuilder.build();
assertFalse(validationResult.hasError());
}
use of com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder in project cloudbreak by hortonworks.
the class AwsEnvironmentNetworkValidatorTest method testCheckNullableWhenNetworkIsNull.
@Test
public void testCheckNullableWhenNetworkIsNull() {
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
underTest.checkNullable(CloudPlatform.AWS, null, resultBuilder);
ValidationResult actual = resultBuilder.build();
Assertions.assertThat(actual.hasError()).isTrue();
Assertions.assertThat(actual.getFormattedErrors()).isEqualTo("Environment network cannot be null");
}
use of com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder 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.cloudbreak.validation.ValidationResult.ValidationResultBuilder 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!"));
}
Aggregations