use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response in project cloudbreak by hortonworks.
the class ImageToImageV4ResponseConverterTest method testConvertWithoutCollections.
@Test
public void testConvertWithoutCollections() {
ImageV4Response result = underTest.convert(getTestImageWithoutCollections());
validateImageV4Response(result, true);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response in project cloudbreak by hortonworks.
the class ImageToImageV4ResponseConverterTest method testConvert.
@Test
public void testConvert() {
ImageV4Response result = underTest.convert(createSource());
validateImageV4Response(result, false);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response in project cloudbreak by hortonworks.
the class ImageToImageV4ResponseConverter method convert.
public ImageV4Response convert(Image source) {
ImageV4Response result = new ImageV4Response();
result.setDate(source.getDate());
result.setCreated(source.getCreated());
result.setPublished(source.getPublished());
result.setDescription(source.getDescription());
result.setOs(source.getOs());
result.setOsType(source.getOsType());
result.setUuid(source.getUuid());
result.setVersion(source.getVersion());
result.setDefaultImage(source.isDefaultImage());
result.setPackageVersions(source.getPackageVersions());
result.setRepository(source.getRepo());
result.setImageSetsByProvider(source.getImageSetsByProvider());
result.setCmBuildNumber(source.getCmBuildNumber());
result.setPreWarmCsd(source.getPreWarmCsd());
result.setPreWarmParcels(source.getPreWarmParcels());
result.setAdvertised(source.isAdvertised());
ImageStackDetails stackDetails = source.getStackDetails();
if (stackDetails != null) {
BaseStackDetailsV4Response stackDetailsResponse = new BaseStackDetailsV4Response();
stackDetailsResponse.setStackBuildNumber(stackDetails.getStackBuildNumber());
stackDetailsResponse.setVersion(stackDetails.getVersion());
result.setStackDetails(stackDetailsResponse);
}
result.setBaseParcelUrl(source.getBaseParcelUrl());
result.setSourceImageId(source.getSourceImageId());
return result;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response in project cloudbreak by hortonworks.
the class AzureCloudProvider method getPreviousPreWarmedImageID.
@Override
public String getPreviousPreWarmedImageID(TestContext testContext, ImageCatalogTestDto imageCatalogTestDto, CloudbreakClient cloudbreakClient) {
if (azureProperties.getBaseimage().getImageId() == null || azureProperties.getBaseimage().getImageId().isEmpty()) {
try {
List<ImageV4Response> images = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().getImagesByName(cloudbreakClient.getWorkspaceId(), imageCatalogTestDto.getRequest().getName(), null, CloudPlatform.AZURE.name(), null, null, false).getCdhImages();
ImageV4Response olderImage = images.get(images.size() - 2);
Log.log(LOGGER, format(" Image Catalog Name: %s ", imageCatalogTestDto.getRequest().getName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", imageCatalogTestDto.getRequest().getUrl()));
Log.log(LOGGER, format(" Selected Pre-warmed Image Date: %s | ID: %s | Description: %s | Stack Version: %s ", olderImage.getDate(), olderImage.getUuid(), olderImage.getStackDetails().getVersion(), olderImage.getDescription()));
azureProperties.getBaseimage().setImageId(olderImage.getUuid());
return olderImage.getUuid();
} catch (Exception e) {
LOGGER.error("Cannot fetch pre-warmed images of {} image catalog!", imageCatalogTestDto.getRequest().getName());
throw new TestFailException(" Cannot fetch pre-warmed images of " + imageCatalogTestDto.getRequest().getName() + " image catalog!", e);
}
} else {
Log.log(LOGGER, format(" Image Catalog Name: %s ", commonCloudProperties().getImageCatalogName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", commonCloudProperties().getImageCatalogUrl()));
Log.log(LOGGER, format(" Image ID for SDX create: %s ", azureProperties.getBaseimage().getImageId()));
return azureProperties.getBaseimage().getImageId();
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response in project cloudbreak by hortonworks.
the class GcpCloudProvider method getPreviousPreWarmedImageID.
@Override
public String getPreviousPreWarmedImageID(TestContext testContext, ImageCatalogTestDto imageCatalogTestDto, CloudbreakClient cloudbreakClient) {
if (gcpProperties.getBaseimage().getImageId() == null || gcpProperties.getBaseimage().getImageId().isEmpty()) {
try {
List<ImageV4Response> images = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().getImagesByName(cloudbreakClient.getWorkspaceId(), imageCatalogTestDto.getRequest().getName(), null, CloudPlatform.GCP.name(), null, null, false).getCdhImages();
ImageV4Response olderImage = images.get(images.size() - 2);
Log.log(LOGGER, format(" Image Catalog Name: %s ", imageCatalogTestDto.getRequest().getName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", imageCatalogTestDto.getRequest().getUrl()));
Log.log(LOGGER, format(" Selected Pre-warmed Image Date: %s | ID: %s | Description: %s | Stack Version: %s ", olderImage.getDate(), olderImage.getUuid(), olderImage.getStackDetails().getVersion(), olderImage.getDescription()));
gcpProperties.getBaseimage().setImageId(olderImage.getUuid());
return olderImage.getUuid();
} catch (Exception e) {
LOGGER.error("Cannot fetch pre-warmed images of {} image catalog!", imageCatalogTestDto.getRequest().getName());
throw new TestFailException(" Cannot fetch pre-warmed images of " + imageCatalogTestDto.getRequest().getName() + " image catalog!", e);
}
} else {
Log.log(LOGGER, format(" Image Catalog Name: %s ", commonCloudProperties().getImageCatalogName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", commonCloudProperties().getImageCatalogUrl()));
Log.log(LOGGER, format(" Image ID for SDX create: %s ", gcpProperties.getBaseimage().getImageId()));
return gcpProperties.getBaseimage().getImageId();
}
}
Aggregations