use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkRequestToDtoConverterTest method createNetworkRequest.
private EnvironmentNetworkRequest createNetworkRequest() {
EnvironmentNetworkRequest request = new EnvironmentNetworkRequest();
request.setNetworkCidr("10.10.10.10/16");
request.setSubnetIds(Set.of(SUBNET_ID));
request.setPrivateSubnetCreation(PrivateSubnetCreation.ENABLED);
request.setServiceEndpointCreation(ServiceEndpointCreation.ENABLED);
request.setServiceEndpointCreation(ServiceEndpointCreation.DISABLED);
return request;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkCidrValidatorTest method testValidatorShouldPassWhenCidrMaskIs16.
@Test
void testValidatorShouldPassWhenCidrMaskIs16() {
EnvironmentNetworkRequest request = new EnvironmentNetworkRequest();
request.setNetworkCidr("172.16.0.0/16");
Set<ConstraintViolation<EnvironmentNetworkRequest>> violation = validator.validate(request);
MatcherAssert.assertThat(violation, empty());
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkCidrValidatorTest method testValidatorShouldPassWhenCidrIsNull.
@Test
void testValidatorShouldPassWhenCidrIsNull() {
EnvironmentNetworkRequest request = new EnvironmentNetworkRequest();
request.setSubnetIds(Set.of("subnet-id"));
Set<ConstraintViolation<EnvironmentNetworkRequest>> violation = validator.validate(request);
MatcherAssert.assertThat(violation, empty());
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkCidrValidatorTest method testValidatorShouldFailWhenCidrIsNotRfcCompliant.
@Test
void testValidatorShouldFailWhenCidrIsNotRfcCompliant() {
EnvironmentNetworkRequest request = new EnvironmentNetworkRequest();
request.setNetworkCidr("0.0.0.0/16");
Set<ConstraintViolation<EnvironmentNetworkRequest>> violation = validator.validate(request);
MatcherAssert.assertThat(violation, hasSize(1));
MatcherAssert.assertThat(violation, hasItem(hasProperty("message", is("The field should contain a valid CIDR definition."))));
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkCidrValidatorTest method testValidatorShouldPassWhenCidrIsEmptySinceCliCanProduceThat.
@Test
void testValidatorShouldPassWhenCidrIsEmptySinceCliCanProduceThat() {
EnvironmentNetworkRequest request = new EnvironmentNetworkRequest();
request.setNetworkCidr(EMPTY_STRING);
Set<ConstraintViolation<EnvironmentNetworkRequest>> violation = validator.validate(request);
MatcherAssert.assertThat(violation, hasSize(0));
}
Aggregations