Search in sources :

Example 1 with EnvironmentNetworkRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.

the class NetworkCidrValidatorTest method testValidatorShouldFailWhenCidrIsNotACidr.

@Test
void testValidatorShouldFailWhenCidrIsNotACidr() {
    EnvironmentNetworkRequest request = new EnvironmentNetworkRequest();
    request.setNetworkCidr("16/16");
    Set<ConstraintViolation<EnvironmentNetworkRequest>> violation = validator.validate(request);
    MatcherAssert.assertThat(violation, hasSize(2));
    MatcherAssert.assertThat(violation, hasItem(hasProperty("message", is("The format of the CIDR is not accepted. Prefix mask must be /16"))));
    MatcherAssert.assertThat(violation, hasItem(hasProperty("message", is("The field should contain a valid CIDR definition."))));
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest) Test(org.junit.jupiter.api.Test)

Example 2 with EnvironmentNetworkRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.

the class EnvironmentControllerTest method setupNetworkRequestWithEndpointGatway.

private EnvironmentNetworkRequest setupNetworkRequestWithEndpointGatway() {
    EnvironmentNetworkRequest networkRequest = new EnvironmentNetworkRequest();
    networkRequest.setPublicEndpointAccessGateway(PublicEndpointAccessGateway.ENABLED);
    networkRequest.setEndpointGatewaySubnetIds(SUBNETS);
    return networkRequest;
}
Also used : EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest)

Example 3 with EnvironmentNetworkRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.

the class EnvironmentApiConverterTest method createEditEnvironmentRequest.

private EnvironmentEditRequest createEditEnvironmentRequest() {
    EnvironmentEditRequest request = new EnvironmentEditRequest();
    request.setDescription("Test description.");
    request.setNetwork(new EnvironmentNetworkRequest());
    request.setAuthentication(createAuthenticationRequest());
    request.setTelemetry(new TelemetryRequest());
    request.setSecurityAccess(createSecurityAccessRequest());
    request.setIdBrokerMappingSource(IdBrokerMappingSource.IDBMMS);
    request.setCloudStorageValidation(CloudStorageValidation.DISABLED);
    request.setAdminGroupName("cb-admin");
    request.setAws(createAwsRequest());
    return request;
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) EnvironmentEditRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentEditRequest) EnvironmentNetworkRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest)

Example 4 with EnvironmentNetworkRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.

the class NetworkRequestToDtoConverterTest method testConvertYarn.

@Test
void testConvertYarn() {
    EnvironmentNetworkRequest network = createNetworkRequest();
    network.setYarn(createYarnParams());
    NetworkDto actual = underTest.convert(network);
    assertEquals(network.getYarn().getQueue(), actual.getYarn().getQueue());
    assertEquals(network.getYarn().getLifetime(), actual.getYarn().getLifetime());
    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 5 with EnvironmentNetworkRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentNetworkRequest in project cloudbreak by hortonworks.

the class NetworkRequestToDtoConverterTest method testConvertAws.

@Test
void testConvertAws() {
    EnvironmentNetworkRequest network = createNetworkRequest();
    network.setAws(createAwsParams());
    NetworkDto actual = underTest.convert(network);
    assertEquals(network.getAws().getVpcId(), actual.getAws().getVpcId());
    assertEquals(network.getAws().getVpcId(), 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)

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