Search in sources :

Example 11 with EnvironmentNetworkRequest

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"))));
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest) Test(org.junit.jupiter.api.Test)

Example 12 with EnvironmentNetworkRequest

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));
}
Also used : EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 13 with EnvironmentNetworkRequest

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));
}
Also used : EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 14 with EnvironmentNetworkRequest

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);
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest) Test(org.junit.jupiter.api.Test)

Example 15 with EnvironmentNetworkRequest

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);
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest) Test(org.junit.jupiter.api.Test)

Aggregations

EnvironmentNetworkRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest)18 Test (org.junit.jupiter.api.Test)12 ConstraintViolation (javax.validation.ConstraintViolation)6 NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)5 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 EnvironmentRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 EnvironmentEditRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentEditRequest)1