use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkCidrValidatorTest method testValidatorShouldFailWhenMaskIsNot16.
@Test
void testValidatorShouldFailWhenMaskIsNot16() {
EnvironmentNetworkRequest request = new EnvironmentNetworkRequest();
request.setNetworkCidr("172.16.0.0/17");
Set<ConstraintViolation<EnvironmentNetworkRequest>> violation = validator.validate(request);
MatcherAssert.assertThat(violation, hasSize(1));
MatcherAssert.assertThat(violation, hasItem(hasProperty("message", is("The format of the CIDR is not accepted. Prefix mask must be /16"))));
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class OutboundInternetTrafficValidatorTest method testInvalidOutboundInternetTrafficRequest.
@ParameterizedTest
@MethodSource("invalidOutboundInternetTrafficRequests")
public void testInvalidOutboundInternetTrafficRequest(OutboundInternetTraffic outboundInternetTraffic, ServiceEndpointCreation serviceEndpointCreation) {
EnvironmentNetworkRequest environmentNetworkRequest = new EnvironmentNetworkRequest();
environmentNetworkRequest.setServiceEndpointCreation(serviceEndpointCreation);
environmentNetworkRequest.setOutboundInternetTraffic(outboundInternetTraffic);
Assertions.assertFalse(underTest.isValid(environmentNetworkRequest, null));
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class OutboundInternetTrafficValidatorTest method testValidOutboundInternetTrafficRequest.
@ParameterizedTest
@MethodSource("validOutboundInternetTrafficRequests")
public void testValidOutboundInternetTrafficRequest(OutboundInternetTraffic outboundInternetTraffic, ServiceEndpointCreation serviceEndpointCreation) {
EnvironmentNetworkRequest environmentNetworkRequest = new EnvironmentNetworkRequest();
environmentNetworkRequest.setServiceEndpointCreation(serviceEndpointCreation);
environmentNetworkRequest.setOutboundInternetTraffic(outboundInternetTraffic);
Assertions.assertTrue(underTest.isValid(environmentNetworkRequest, null));
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkRequestToDtoConverterTest method testConvertGcp.
@Test
void testConvertGcp() {
EnvironmentNetworkRequest network = createNetworkRequest();
network.setGcp(createGcpParams());
NetworkDto actual = underTest.convert(network);
assertEquals(network.getGcp().getNetworkId(), actual.getGcp().getNetworkId());
assertEquals(network.getGcp().getNetworkId(), actual.getNetworkId());
assertCommonFields(network, actual);
}
use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.
the class NetworkRequestToDtoConverterTest method testConvertAzure.
@Test
void testConvertAzure() {
EnvironmentNetworkRequest network = createNetworkRequest();
network.setAzure(createAzureParams());
NetworkDto actual = underTest.convert(network);
assertEquals(network.getAzure().getNetworkId(), actual.getAzure().getNetworkId());
assertEquals(network.getAzure().getResourceGroupName(), actual.getAzure().getResourceGroupName());
assertEquals(network.getAzure().getNoPublicIp(), actual.getAzure().isNoPublicIp());
assertCommonFields(network, actual);
}
Aggregations