use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testValidateFreeipaImagesWhichAnyStoredInVersionBlock.
@Test
public void testValidateFreeipaImagesWhichAnyStoredInVersionBlock() {
Image properImage1 = createImage(PROPER_IMAGE_ID);
Image properImage2 = createImage(PROPER_IMAGE_ID_2);
when(images.getCdhImages()).thenReturn(List.of(properImage1, properImage2));
Versions versions = createFreeipaVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getFreeipaVersions());
Exception exception = assertThrows(CloudbreakImageCatalogException.class, () -> victim.validate(createCatalog(versions)));
assertEquals("Images with ids: " + OTHER_IMAGE_ID + " is not present in cdh-images block", exception.getMessage());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testGetCdhImagesForCbVersionShouldReturnsImagesWhenThereAreSupportedImagesForCbVersion.
@Test
public void testGetCdhImagesForCbVersionShouldReturnsImagesWhenThereAreSupportedImagesForCbVersion() {
ReflectionTestUtils.setField(victim, "cbVersion", CURRENT_CB_VERSION);
Image properImage = createImage(PROPER_IMAGE_ID);
Image otherImage = createImage(OTHER_IMAGE_ID);
when(imageCatalogV3.getImages()).thenReturn(images);
when(images.getCdhImages()).thenReturn(List.of(properImage, otherImage));
Versions versions = createCbVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getCloudbreakVersions());
List<Image> actual = victim.getImageFilterResult(imageCatalogV3).getImages();
assertTrue(actual.contains(properImage));
assertEquals(1, actual.size());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testValidateCbImagesWhichAllStoredInVersionBlock.
@Test
public void testValidateCbImagesWhichAllStoredInVersionBlock() throws CloudbreakImageCatalogException {
Image properImage1 = createImage(PROPER_IMAGE_ID);
Image properImage2 = createImage(PROPER_IMAGE_ID_2);
Image otherImage = createImage(OTHER_IMAGE_ID);
when(images.getCdhImages()).thenReturn(List.of(properImage1, properImage2, otherImage));
Versions versions = createCbVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getCloudbreakVersions());
victim.validate(createCatalog(versions));
}
Aggregations