Search in sources :

Example 1 with ImagesResponse

use of com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse in project cloudbreak by hortonworks.

the class ImageSelectionTest method testImageSelection.

@Test
public void testImageSelection() throws Exception {
    // GIVEN
    IntegrationTestContext itContext = getItContext();
    // WHEN
    ImagesResponse imagesResponse = getCloudbreakClient().imageCatalogEndpoint().getImagesByProvider(itContext.getContextParam(CloudbreakITContextConstants.CLOUDPROVIDER));
    // THEN
    Assert.assertFalse(imagesResponse.getBaseImages().isEmpty());
    itContext.putContextParam(CloudbreakV2Constants.IMAGEID, imagesResponse.getBaseImages().get(0).getUuid());
}
Also used : IntegrationTestContext(com.sequenceiq.it.IntegrationTestContext) ImagesResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse) AbstractCloudbreakIntegrationTest(com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest) Test(org.testng.annotations.Test)

Example 2 with ImagesResponse

use of com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse in project cloudbreak by hortonworks.

the class ImagesToImagesResponseJsonConverter method convert.

@Override
public ImagesResponse convert(Images source) {
    ImagesResponse res = new ImagesResponse();
    List<BaseImageResponse> baseImages = getBaseImageResponses(source);
    res.setBaseImages(baseImages);
    List<ImageResponse> hdpImages = new ArrayList<>();
    for (Image hdpImg : source.getHdpImages()) {
        ImageResponse hdpImgJson = new ImageResponse();
        copyImageFieldsToJson(hdpImg, hdpImgJson);
        hdpImgJson.setStackDetails(convertStackDetailsToJson(hdpImg.getStackDetails()));
        hdpImages.add(hdpImgJson);
    }
    res.setHdpImages(hdpImages);
    List<ImageResponse> hdfImages = new ArrayList<>();
    for (Image hdfImg : source.getHdfImages()) {
        ImageResponse hdfImgJson = new ImageResponse();
        copyImageFieldsToJson(hdfImg, hdfImgJson);
        hdfImgJson.setStackDetails(convertStackDetailsToJson(hdfImg.getStackDetails()));
        hdfImages.add(hdfImgJson);
    }
    res.setHdfImages(hdfImages);
    return res;
}
Also used : ArrayList(java.util.ArrayList) BaseImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse) ImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.ImageResponse) BaseImageResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) ImagesResponse(com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse)

Aggregations

ImagesResponse (com.sequenceiq.cloudbreak.api.model.imagecatalog.ImagesResponse)2 BaseImageResponse (com.sequenceiq.cloudbreak.api.model.imagecatalog.BaseImageResponse)1 ImageResponse (com.sequenceiq.cloudbreak.api.model.imagecatalog.ImageResponse)1 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)1 IntegrationTestContext (com.sequenceiq.it.IntegrationTestContext)1 AbstractCloudbreakIntegrationTest (com.sequenceiq.it.cloudbreak.AbstractCloudbreakIntegrationTest)1 ArrayList (java.util.ArrayList)1 Test (org.testng.annotations.Test)1