use of com.sequenceiq.cloudbreak.service.image.ImageTestUtil.PLATFORM 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.service.image.ImageTestUtil.PLATFORM 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.service.image.ImageTestUtil.PLATFORM in project cloudbreak by hortonworks.
the class ImageServiceTest method testDetermineImageFromCatalogWithNonExistingCatalogNameAndIdSpecified.
@Test
public void testDetermineImageFromCatalogWithNonExistingCatalogNameAndIdSpecified() throws CloudbreakImageNotFoundException, CloudbreakImageCatalogException {
when(imageCatalogService.getImageByCatalogName(WORKSPACE_ID, "anImageId", "aCatalog")).thenThrow(new CloudbreakImageCatalogException("Image catalog not found with name: aCatalog"));
CloudbreakImageCatalogException exception = assertThrows(CloudbreakImageCatalogException.class, () -> underTest.determineImageFromCatalog(WORKSPACE_ID, imageSettingsV4Request, PLATFORM, PLATFORM, TestUtil.blueprint(), true, true, TestUtil.user(USER_ID, USER_ID_STRING), image -> true));
assertEquals("Image catalog not found with name: aCatalog", exception.getMessage());
}
use of com.sequenceiq.cloudbreak.service.image.ImageTestUtil.PLATFORM in project cloudbreak by hortonworks.
the class ImageServiceTest method testDetermineImageFromCatalogWithNonExistingCatalogName.
@Test
public void testDetermineImageFromCatalogWithNonExistingCatalogName() {
when(imageCatalogService.getImageCatalogByName(WORKSPACE_ID, "aCatalog")).thenThrow(new NotFoundException("Image catalog not found with name: aCatalog"));
ImageSettingsV4Request imageRequest = new ImageSettingsV4Request();
imageRequest.setCatalog("aCatalog");
imageRequest.setOs(OS);
CloudbreakImageCatalogException exception = assertThrows(CloudbreakImageCatalogException.class, () -> underTest.determineImageFromCatalog(WORKSPACE_ID, imageRequest, PLATFORM, PLATFORM, TestUtil.blueprint(), true, true, TestUtil.user(USER_ID, USER_ID_STRING), image -> true));
assertEquals("Image catalog not found with name: aCatalog", exception.getMessage());
}
Aggregations