Search in sources :

Example 6 with FreeIpaCreationDto

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

the class FreeIpaConverterTest method testConvertWithFreeIpaImageCatalogAndId.

@Test
public void testConvertWithFreeIpaImageCatalogAndId() {
    // GIVEN
    FreeIpaCreationDto request = FreeIpaCreationDto.builder().withImageId(IMAGE_ID).withImageCatalog(IMAGE_CATALOG).build();
    // WHEN
    FreeIpaResponse result = underTest.convert(request);
    // THEN
    assertEquals(IMAGE_ID, result.getImage().getId());
    assertEquals(IMAGE_CATALOG, result.getImage().getCatalog());
}
Also used : FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) FreeIpaResponse(com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse) Test(org.junit.jupiter.api.Test)

Example 7 with FreeIpaCreationDto

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

the class FreeIpaConverterTest method testConvertWithTwoInstancesAndOnlySpotInstances.

@Test
public void testConvertWithTwoInstancesAndOnlySpotInstances() {
    // GIVEN
    FreeIpaCreationDto request = FreeIpaCreationDto.builder().withInstanceCountByGroup(2).withAws(FreeIpaCreationAwsParametersDto.builder().withSpot(FreeIpaCreationAwsSpotParametersDto.builder().withPercentage(100).withMaxPrice(0.9).build()).build()).build();
    // WHEN
    FreeIpaResponse result = underTest.convert(request);
    // THEN
    assertNotNull(result);
    assertNotNull(result.getInstanceCountByGroup());
    assertEquals(2, result.getInstanceCountByGroup());
    assertEquals(100, result.getAws().getSpot().getPercentage());
    assertEquals(0.9, result.getAws().getSpot().getMaxPrice());
}
Also used : FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) FreeIpaResponse(com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse) Test(org.junit.jupiter.api.Test)

Example 8 with FreeIpaCreationDto

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

the class FreeIpaConverterTest method testConvertWithoutImageIdAndImageCatalog.

@Test
public void testConvertWithoutImageIdAndImageCatalog() {
    // GIVEN
    AttachedFreeIpaRequest request = new AttachedFreeIpaRequest();
    request.setCreate(true);
    request.setImage(aFreeIpaImage(null, null));
    // WHEN
    FreeIpaCreationDto result = underTest.convert(request, "id", CloudConstants.AWS);
    // THEN
    assertNull(result.getImageCatalog());
    assertNull(result.getImageId());
}
Also used : AttachedFreeIpaRequest(com.sequenceiq.environment.api.v1.environment.model.request.AttachedFreeIpaRequest) FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) Test(org.junit.jupiter.api.Test)

Example 9 with FreeIpaCreationDto

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

the class FreeIpaConverterTest method testConvertWithNull.

@Test
public void testConvertWithNull() {
    // GIVEN
    FreeIpaCreationDto request = null;
    // WHEN
    FreeIpaResponse result = underTest.convert(request);
    // THEN
    assertNull(result);
}
Also used : FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) FreeIpaResponse(com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse) Test(org.junit.jupiter.api.Test)

Example 10 with FreeIpaCreationDto

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

the class FreeIpaConverterTest method testConvertWithFreeIpaImageIdButWithoutImageCatalog.

@Test
public void testConvertWithFreeIpaImageIdButWithoutImageCatalog() {
    // GIVEN
    FreeIpaCreationDto request = FreeIpaCreationDto.builder().withImageId(IMAGE_ID).build();
    // WHEN
    FreeIpaResponse result = underTest.convert(request);
    // THEN
    assertNull(result.getImage());
}
Also used : FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) FreeIpaResponse(com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse) Test(org.junit.jupiter.api.Test)

Aggregations

FreeIpaCreationDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationDto)21 Test (org.junit.jupiter.api.Test)16 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)8 Features (com.sequenceiq.common.api.telemetry.model.Features)7 EnvironmentRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest)7 ExperimentalFeatures (com.sequenceiq.environment.environment.domain.ExperimentalFeatures)7 EnvironmentCreationDto (com.sequenceiq.environment.environment.dto.EnvironmentCreationDto)7 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)7 NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)7 AccountTelemetry (com.sequenceiq.environment.telemetry.domain.AccountTelemetry)7 FreeIpaResponse (com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse)6 AttachedFreeIpaRequest (com.sequenceiq.environment.api.v1.environment.model.request.AttachedFreeIpaRequest)4 EnvironmentBackup (com.sequenceiq.environment.environment.dto.EnvironmentBackup)4 UsageProto (com.cloudera.thunderhead.service.common.usage.UsageProto)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)1 FreeIpaImageRequest (com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest)1 FreeIpaCreationAwsParametersDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsParametersDto)1 FreeIpaCreationAwsSpotParametersDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationAwsSpotParametersDto)1 InstanceGroupNetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest)1