Search in sources :

Example 16 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class NetworkDtoToResponseConverterTest method testConvertWithYarnParams.

@Test
void testConvertWithYarnParams() {
    NetworkDto network = createNetworkDto().withYarn(createYarnParams()).build();
    ProvidedSubnetIds providedSubnetIds = new ProvidedSubnetIds(PREFERRED_SUBNET_ID, Set.of(PREFERRED_SUBNET_ID));
    when(subnetIdProvider.subnets(network, TUNNEL, network.getCloudPlatform(), true)).thenReturn(providedSubnetIds);
    EnvironmentNetworkResponse actual = underTest.convert(network, TUNNEL, true);
    assertCommonFields(network, actual);
    assertEquals(network.getYarn().getQueue(), actual.getYarn().getQueue());
    assertEquals(network.getYarn().getLifetime(), actual.getYarn().getLifetime());
    assertNull(actual.getAws());
    assertNull(actual.getMock());
    assertNull(actual.getAzure());
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) ProvidedSubnetIds(com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) Test(org.junit.jupiter.api.Test)

Example 17 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class NetworkDtoToResponseConverterTest method testConvertWithLoadBalancerEnabled.

@Test
void testConvertWithLoadBalancerEnabled() {
    NetworkDto network = createNetworkDto().withAws(createAwsParams()).withLoadBalancerCreation(LoadBalancerCreation.ENABLED).build();
    ProvidedSubnetIds providedSubnetIds = new ProvidedSubnetIds(PREFERRED_SUBNET_ID, Set.of(PREFERRED_SUBNET_ID));
    when(subnetIdProvider.subnets(network, TUNNEL, network.getCloudPlatform(), true)).thenReturn(providedSubnetIds);
    EnvironmentNetworkResponse actual = underTest.convert(network, TUNNEL, true);
    assertEquals(network.getAws().getVpcId(), actual.getAws().getVpcId());
    assertEquals(LoadBalancerCreation.ENABLED, actual.getLoadBalancerCreation());
    assertNull(actual.getAzure());
    assertNull(actual.getYarn());
    assertNull(actual.getMock());
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) ProvidedSubnetIds(com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) Test(org.junit.jupiter.api.Test)

Example 18 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto 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 19 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto 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)

Example 20 with NetworkDto

use of com.sequenceiq.environment.network.dto.NetworkDto in project cloudbreak by hortonworks.

the class NetworkTest method createEnvironmentDto.

protected EnvironmentDto createEnvironmentDto() {
    NetworkDto networkDto = NetworkDto.builder().build();
    EnvironmentDto environmentDto = new EnvironmentDto();
    environmentDto.setId(123L);
    environmentDto.setName("name");
    environmentDto.setNetwork(networkDto);
    return environmentDto;
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto)

Aggregations

NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)144 Test (org.junit.jupiter.api.Test)124 ValidationResultBuilder (com.sequenceiq.cloudbreak.validation.ValidationResult.ValidationResultBuilder)59 AzureParams (com.sequenceiq.environment.network.dto.AzureParams)40 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)31 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)27 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)21 EnvironmentValidationDto (com.sequenceiq.environment.environment.dto.EnvironmentValidationDto)21 UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)15 Environment (com.sequenceiq.environment.environment.domain.Environment)15 ProvidedSubnetIds (com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 AwsNetwork (com.sequenceiq.environment.network.dao.domain.AwsNetwork)12 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)10 AwsParams (com.sequenceiq.environment.network.dto.AwsParams)9 Features (com.sequenceiq.common.api.telemetry.model.Features)8 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)7 EnvironmentRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest)7 ExperimentalFeatures (com.sequenceiq.environment.environment.domain.ExperimentalFeatures)7 BaseNetwork (com.sequenceiq.environment.network.dao.domain.BaseNetwork)7