use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response in project cloudbreak by hortonworks.
the class ImageToStackImageV4ResponseConverterTest method shouldAllowNullImageCatalogUrlInCaseOfCustomImageCatalog.
@Test
public void shouldAllowNullImageCatalogUrlInCaseOfCustomImageCatalog() {
ImageCatalog imageCatalog = new ImageCatalog();
Image image = anImageWithoutImageCatalogUrl();
when(restRequestThreadLocalService.getRequestedWorkspaceId()).thenReturn(WORKSPACE_ID);
when(imageCatalogService.getImageCatalogByName(WORKSPACE_ID, IMAGE_CATALOG_NAME)).thenReturn(imageCatalog);
StackImageV4Response actual = victim.convert(image);
assertNull(actual.getCatalogUrl());
assertEquals(IMAGE_CATALOG_NAME, actual.getCatalogName());
assertEquals(IMAGE_ID, actual.getId());
assertEquals(IMAGE_NAME, actual.getName());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response in project cloudbreak by hortonworks.
the class ImageToStackImageV4ResponseConverter method convert.
public StackImageV4Response convert(Image source) {
StackImageV4Response image = new StackImageV4Response();
image.setName(source.getImageName());
decorateWithImageCatalogUrl(source, image);
image.setCatalogName(Strings.isNullOrEmpty(source.getImageCatalogName()) ? "cloudbreak-default" : source.getImageCatalogName());
image.setId(Strings.isNullOrEmpty(source.getImageId()) ? null : source.getImageId());
return image;
}
Aggregations