use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request in project cloudbreak by hortonworks.
the class StackToStackV4RequestConverter method prepareImage.
private void prepareImage(Stack source, StackV4Request stackV2Request) {
try {
Image image = componentConfigProviderService.getImage(source.getId());
ImageSettingsV4Request is = new ImageSettingsV4Request();
is.setId(Strings.isNullOrEmpty(image.getImageId()) ? "" : image.getImageId());
is.setCatalog(Strings.isNullOrEmpty(image.getImageCatalogName()) ? "" : image.getImageCatalogName());
stackV2Request.setImage(is);
} catch (CloudbreakImageNotFoundException e) {
LOGGER.info(e.toString());
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request in project cloudbreak by hortonworks.
the class SdxCustomTestDto method valid.
@Override
public SdxCustomTestDto valid() {
ImageSettingsTestDto imageSettingsTestDto = getCloudProvider().imageSettings(getTestContext().init(ImageSettingsTestDto.class));
ImageSettingsV4Request imageSettingsV4Request = imageSettingsTestDto.getRequest();
ImageCatalogTestDto imageCatalogTestDto = getTestContext().get(ImageCatalogTestDto.class);
withName(getResourcePropertyProvider().getName(getCloudPlatform())).withEnvironmentName(getTestContext().get(EnvironmentTestDto.class).getRequest().getName()).withClusterShape(getCloudProvider().getClusterShape()).withTags(getCloudProvider().getTags()).withImageCatalogNameAndImageId(imageCatalogTestDto.getName(), imageSettingsV4Request.getId());
return getCloudProvider().sdxCustom(this);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request in project cloudbreak by hortonworks.
the class ImageServiceTest method testGivenBaseImageIdAndDisabledBaseImageShouldReturnError.
@Test
public void testGivenBaseImageIdAndDisabledBaseImageShouldReturnError() throws CloudbreakImageNotFoundException, CloudbreakImageCatalogException {
when(imageCatalogService.getImageByCatalogName(anyLong(), anyString(), anyString())).thenReturn(ImageTestUtil.getImageFromCatalog(false, "uuid", STACK_VERSION));
CloudbreakImageCatalogException exception = assertThrows(CloudbreakImageCatalogException.class, () -> underTest.determineImageFromCatalog(WORKSPACE_ID, imageSettingsV4Request, PLATFORM, PLATFORM, TestUtil.blueprint(), false, false, TestUtil.user(USER_ID, USER_ID_STRING), image -> true));
assertEquals("Inconsistent request, base images are disabled but image with id uuid is base image!", exception.getMessage());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request in project cloudbreak by hortonworks.
the class ImageServiceTest method testUseBaseImageAndDisabledBaseImageShouldReturnError.
@Test
public void testUseBaseImageAndDisabledBaseImageShouldReturnError() {
imageSettingsV4Request.setId(null);
CloudbreakImageCatalogException exception = assertThrows(CloudbreakImageCatalogException.class, () -> underTest.determineImageFromCatalog(WORKSPACE_ID, imageSettingsV4Request, PLATFORM, PLATFORM, TestUtil.blueprint(), true, false, TestUtil.user(USER_ID, USER_ID_STRING), image -> true));
assertEquals("Inconsistent request, base images are disabled but custom repo information is submitted!", exception.getMessage());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.image.ImageSettingsV4Request in project cloudbreak by hortonworks.
the class DistroXImageToImageSettingsConverterTest method testConvertImageSettingsV4RequestToDistroXImageV1Request.
@Test
void testConvertImageSettingsV4RequestToDistroXImageV1Request() {
ImageSettingsV4Request input = new ImageSettingsV4Request();
input.setCatalog("someCatalog");
input.setId("someId");
DistroXImageV1Request result = underTest.convert(input);
assertNotNull(result);
assertEquals(input.getCatalog(), result.getCatalog());
assertEquals(input.getId(), result.getId());
}
Aggregations