use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testGetCdhImagesForCbVersionShouldReturnsImagesWhenThereAreMultipleSupportedImagesAreAvailableForCbVersion.
@Test
public void testGetCdhImagesForCbVersionShouldReturnsImagesWhenThereAreMultipleSupportedImagesAreAvailableForCbVersion() {
ReflectionTestUtils.setField(victim, "cbVersion", CURRENT_CB_VERSION);
Image properImage1 = createImage(PROPER_IMAGE_ID);
Image properImage2 = createImage(PROPER_IMAGE_ID_2);
Image otherImage = createImage(OTHER_IMAGE_ID);
when(imageCatalogV3.getImages()).thenReturn(images);
when(images.getCdhImages()).thenReturn(List.of(properImage1, otherImage, properImage2));
Versions versions = createCbVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getCloudbreakVersions());
List<Image> actual = victim.getImageFilterResult(imageCatalogV3).getImages();
assertTrue(actual.contains(properImage1));
assertTrue(actual.contains(properImage2));
assertEquals(2, actual.size());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testGetCdhImagesForCbVersionShouldReturnsEmptyListWhenThereAreNoSupportedImagesForCbVersion.
@Test
public void testGetCdhImagesForCbVersionShouldReturnsEmptyListWhenThereAreNoSupportedImagesForCbVersion() {
ReflectionTestUtils.setField(victim, "cbVersion", "2.18");
Image properImage = createImage(PROPER_IMAGE_ID);
Image otherImage = createImage(OTHER_IMAGE_ID);
when(imageCatalogV3.getImages()).thenReturn(images);
when(prefixMatcherService.prefixMatchForCBVersion(eq("2.18"), any())).thenReturn(new PrefixMatchImages(Collections.emptySet(), Collections.emptySet(), Collections.emptySet()));
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.isEmpty());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testGetFreeipaImagesForCbVersionShouldReturnsImagesWhenThereAreMultipleSupportedImagesAreAvailableForCbVersion.
@Test
public void testGetFreeipaImagesForCbVersionShouldReturnsImagesWhenThereAreMultipleSupportedImagesAreAvailableForCbVersion() {
ReflectionTestUtils.setField(victim, "cbVersion", CURRENT_CB_VERSION);
Image properImage1 = createImage(PROPER_IMAGE_ID);
Image properImage2 = createImage(PROPER_IMAGE_ID_2);
Image otherImage = createImage(OTHER_IMAGE_ID);
when(imageCatalogV3.getImages()).thenReturn(images);
when(images.getFreeIpaImages()).thenReturn(List.of(properImage1, otherImage, properImage2));
Versions versions = createFreeipaVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getFreeipaVersions());
List<Image> actual = victim.getImageFilterResult(imageCatalogV3).getImages();
assertTrue(actual.contains(properImage1));
assertTrue(actual.contains(properImage2));
assertEquals(2, actual.size());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testValidateCbImagesWhichAnyStoredInVersionBlock.
@Test
public void testValidateCbImagesWhichAnyStoredInVersionBlock() {
Image properImage1 = createImage(PROPER_IMAGE_ID);
Image properImage2 = createImage(PROPER_IMAGE_ID_2);
when(images.getCdhImages()).thenReturn(List.of(properImage1, properImage2));
Versions versions = createCbVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getCloudbreakVersions());
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 testGetFreeipaImagesForCbVersionShouldReturnsImagesWhenThereAreSupportedImagesForCbVersion.
@Test
public void testGetFreeipaImagesForCbVersionShouldReturnsImagesWhenThereAreSupportedImagesForCbVersion() {
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.getFreeIpaImages()).thenReturn(List.of(properImage, otherImage));
Versions versions = createFreeipaVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getFreeipaVersions());
List<Image> actual = victim.getImageFilterResult(imageCatalogV3).getImages();
assertTrue(actual.contains(properImage));
assertEquals(1, actual.size());
}
Aggregations