use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.
the class AdvertisedImageProviderTest method shouldSetDefaultFlags.
@Test
public void shouldSetDefaultFlags() {
when(latestDefaultImageUuidProvider.getLatestDefaultImageUuids(any(), any())).thenReturn(asList(BASE_IMAGE_ID_AWS_ADVERTISED, CDH_IMAGE_ID_AWS_ADVERTISED).stream().collect(toSet()));
StatedImages actual = victim.getImages(anImageCatalogV3(), createImageFilter(true));
assertTrue(imageAvailableWithIdAndDefaultFlag(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AWS_ADVERTISED, true));
assertTrue(imageAvailableWithIdAndDefaultFlag(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AWS_AZURE_ADVERTISED, false));
assertTrue(imageAvailableWithIdAndDefaultFlag(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AWS_ADVERTISED, true));
assertTrue(imageAvailableWithIdAndDefaultFlag(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AWS_AZURE_ADVERTISED, false));
}
use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.
the class AdvertisedImageProviderTest method shouldHaveImagesWithAdvertisedFlagAndWithTheEnabledPlatforms.
@Test
public void shouldHaveImagesWithAdvertisedFlagAndWithTheEnabledPlatforms() {
StatedImages actual = victim.getImages(anImageCatalogV3(), createImageFilter(true));
assertTrue(imageAvailableWithId(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AWS_ADVERTISED));
assertTrue(imageAvailableWithId(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AWS_AZURE_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AWS_NON_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AWS_AZURE_NON_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AZURE_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getBaseImages(), BASE_IMAGE_ID_AZURE_NON_ADVERTISED));
assertTrue(imageAvailableWithId(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AWS_ADVERTISED));
assertTrue(imageAvailableWithId(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AWS_AZURE_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AWS_NON_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AWS_AZURE_NON_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AZURE_ADVERTISED));
assertFalse(imageAvailableWithId(actual.getImages().getCdhImages(), CDH_IMAGE_ID_AZURE_NON_ADVERTISED));
}
use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.
the class RawImageProviderTest method testGetImagesShouldReturnOnlyTheAwsImagesFromTheImageCatalog.
@Test
void testGetImagesShouldReturnOnlyTheAwsImagesFromTheImageCatalog() {
ImageFilter imageFilter = createImageFilter();
CloudbreakImageCatalogV3 imageCatalogV3 = createImageCatalog();
StatedImages actual = underTest.getImages(imageCatalogV3, imageFilter);
assertEquals(IMAGE_CATALOG_NAME, actual.getImageCatalogName());
assertEquals(IMAGE_CATALOG_URL, actual.getImageCatalogUrl());
Images images = actual.getImages();
assertTrue(images.getBaseImages().stream().anyMatch(image -> BASE_IMAGE_AWS.equals(image.getUuid())));
assertTrue(images.getBaseImages().stream().noneMatch(image -> BASE_IMAGE_AZURE.equals(image.getUuid())));
assertTrue(images.getCdhImages().stream().anyMatch(image -> CDH_IMAGE_AWS.equals(image.getUuid())));
assertTrue(images.getCdhImages().stream().noneMatch(image -> CDH_IMAGE_AZURE.equals(image.getUuid())));
assertTrue(images.getFreeIpaImages().stream().anyMatch(image -> FREEIPA_IMAGE_AWS.equals(image.getUuid())));
assertTrue(images.getFreeIpaImages().stream().noneMatch(image -> FREEIPA_IMAGE_AZURE.equals(image.getUuid())));
}
use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testGetImagesShouldCallVersionBasedImageProviderWhenTheCbVersionIsPresent.
@Test
public void testGetImagesShouldCallVersionBasedImageProviderWhenTheCbVersionIsPresent() {
StatedImages statedImages = mock(StatedImages.class);
when(imageFilter.getCbVersion()).thenReturn("2.49");
when(versionBasedImageProvider.getImages(imageCatalogV3, imageFilter)).thenReturn(statedImages);
StatedImages actual = victim.getImages(imageCatalogV3, imageFilter);
assertEquals(statedImages, actual);
verify(versionBasedImageProvider).getImages(imageCatalogV3, imageFilter);
}
Aggregations