use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentValidatorServiceTest method testValidateSecurityAccessModificationWhenDefaultSecGroupAdded.
@Test
void testValidateSecurityAccessModificationWhenDefaultSecGroupAdded() {
Environment environment = new Environment();
SecurityAccessDto securityAccessDto = SecurityAccessDto.builder().withDefaultSecurityGroupId("sec-group").build();
ValidationResult validationResult = underTest.validateSecurityAccessModification(securityAccessDto, environment);
assertFalse(validationResult.hasError());
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentValidatorServiceTest method testValidateSecurityAccessModificationWhenKnoxSecGroupAdded.
@Test
void testValidateSecurityAccessModificationWhenKnoxSecGroupAdded() {
Environment environment = new Environment();
SecurityAccessDto securityAccessDto = SecurityAccessDto.builder().withSecurityGroupIdForKnox("knox-sec-group").build();
ValidationResult validationResult = underTest.validateSecurityAccessModification(securityAccessDto, environment);
assertFalse(validationResult.hasError());
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentValidatorServiceTest method testValidateSecurityAccessModificationWhenCidrAndDefaultSecurityGroupAddedInRequest.
@Test
void testValidateSecurityAccessModificationWhenCidrAndDefaultSecurityGroupAddedInRequest() {
Environment environment = new Environment();
SecurityAccessDto securityAccessDto = SecurityAccessDto.builder().withCidr("cidr").withDefaultSecurityGroupId("sec-group").build();
ValidationResult validationResult = underTest.validateSecurityAccessModification(securityAccessDto, environment);
assertTrue(validationResult.hasError());
assertEquals("The CIDR could not be updated in the environment", validationResult.getFormattedErrors());
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentValidatorServiceTest method shouldFailOnChildEnvironmentCloudPlatformNotSupported.
@Test
void shouldFailOnChildEnvironmentCloudPlatformNotSupported() {
Environment environment = aValidEnvirontmentWithParent();
environment.setCloudPlatform(CloudPlatform.GCP.name());
ValidationResult validationResult = underTest.validateParentChildRelation(environment, "parentEnvName");
assertEquals("'GCP' platform is not supported for child environment.", validationResult.getFormattedErrors());
}
use of com.sequenceiq.environment.environment.domain.Environment in project cloudbreak by hortonworks.
the class EnvironmentValidatorServiceTest method testValidateAuthenticationModificationWhenPublicKeyAndPublicKeyIdIsEmptyAsWell.
@Test
void testValidateAuthenticationModificationWhenPublicKeyAndPublicKeyIdIsEmptyAsWell() {
Environment environment = new Environment();
environment.setCloudPlatform("AWS");
EnvironmentEditDto environmentEditDto = EnvironmentEditDto.builder().withAuthentication(AuthenticationDto.builder().build()).build();
ValidationResult validationResult = underTest.validateAuthenticationModification(environmentEditDto, environment);
assertEquals("You should define either the publicKey or the publicKeyId.", validationResult.getFormattedErrors());
}
Aggregations