Search in sources :

Example 1 with UsedImageStacksV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImageStacksV4Response in project cloudbreak by hortonworks.

the class UsedImagesTest method verifyImagesAreUsed.

private <T extends CloudbreakTestDto> T verifyImagesAreUsed(TestContext testContext, T testDto) {
    testContext.given(UsedImagesTestDto.class).when(utilTestClient.usedImages()).then((tc, usedImagesTestDto, client) -> {
        List<UsedImageStacksV4Response> usedImages = usedImagesTestDto.getResponse().getUsedImages();
        UsedImageStacksV4Response usedImageStacksV4Response = usedImages.stream().filter(usedImage -> usedImage.getImage().getImageId().contains(sdxImageUuid)).findFirst().orElseThrow(() -> new TestFailException(String.format("SDX image is NOT in use with ID:: %s", sdxImageUuid)));
        LOGGER.info("Used SDX image ID:: {}", usedImageStacksV4Response.getImage().getImageId());
        return usedImagesTestDto;
    }).given(FreeipaUsedImagesTestDto.class).when(freeIpaTestClient.usedImages()).then((tc, usedImagesTestDto, client) -> {
        List<UsedImageStacksV1Response> usedImages = usedImagesTestDto.getResponse().getUsedImages();
        UsedImageStacksV1Response usedImageStacksV1Response = usedImages.stream().filter(usedImage -> usedImage.getImage().getImageId().contains(freeipaImageUuid)).findFirst().orElseThrow(() -> new TestFailException(String.format("FreeIpa image is NOT in use with ID:: %s", freeipaImageUuid)));
        LOGGER.info("Used FreeIpa image ID:: {}", usedImageStacksV1Response.getImage().getImageId());
        return usedImagesTestDto;
    }).validate();
    return testDto;
}
Also used : ImageCatalogTestClient(com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) LoggerFactory(org.slf4j.LoggerFactory) Test(org.testng.annotations.Test) Description(com.sequenceiq.it.cloudbreak.context.Description) EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) Inject(javax.inject.Inject) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) Status(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) Logger(org.slf4j.Logger) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) CloudbreakTestDto(com.sequenceiq.it.cloudbreak.dto.CloudbreakTestDto) FreeipaUsedImagesTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeipaUsedImagesTestDto) UsedImagesTestDto(com.sequenceiq.it.cloudbreak.dto.util.UsedImagesTestDto) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UUID(java.util.UUID) UsedImageStacksV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImageStacksV4Response) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) List(java.util.List) EnvironmentTestClient(com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) UtilTestClient(com.sequenceiq.it.cloudbreak.client.UtilTestClient) EnvironmentStatus(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus) UsedImageStacksV1Response(com.sequenceiq.freeipa.api.v1.util.model.UsedImageStacksV1Response) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) ImageCatalogTestDto(com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto) UsedImageStacksV1Response(com.sequenceiq.freeipa.api.v1.util.model.UsedImageStacksV1Response) FreeipaUsedImagesTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeipaUsedImagesTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) List(java.util.List) UsedImageStacksV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImageStacksV4Response)

Aggregations

UsedImageStacksV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.UsedImageStacksV4Response)1 EnvironmentStatus (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus)1 Status (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status)1 UsedImageStacksV1Response (com.sequenceiq.freeipa.api.v1.util.model.UsedImageStacksV1Response)1 EnvironmentTestClient (com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient)1 FreeIpaTestClient (com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient)1 ImageCatalogTestClient (com.sequenceiq.it.cloudbreak.client.ImageCatalogTestClient)1 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)1 UtilTestClient (com.sequenceiq.it.cloudbreak.client.UtilTestClient)1 Description (com.sequenceiq.it.cloudbreak.context.Description)1 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)1 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)1 CloudbreakTestDto (com.sequenceiq.it.cloudbreak.dto.CloudbreakTestDto)1 EnvironmentNetworkTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto)1 EnvironmentTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto)1 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)1 FreeipaUsedImagesTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeipaUsedImagesTestDto)1 ImageCatalogTestDto (com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)1 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)1 UsedImagesTestDto (com.sequenceiq.it.cloudbreak.dto.util.UsedImagesTestDto)1