Search in sources :

Example 11 with StatedImages

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));
}
Also used : StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Example 12 with StatedImages

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));
}
Also used : StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Example 13 with StatedImages

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())));
}
Also used : Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) ImageCatalog(com.sequenceiq.cloudbreak.domain.ImageCatalog) ImageFilter(com.sequenceiq.cloudbreak.service.image.ImageFilter) ImageCatalogPlatform.imageCatalogPlatform(com.sequenceiq.cloudbreak.service.image.catalog.model.ImageCatalogPlatform.imageCatalogPlatform) Test(org.junit.jupiter.api.Test) AWS(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.AWS) List(java.util.List) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Map(java.util.Map) Images(com.sequenceiq.cloudbreak.cloud.model.catalog.Images) AZURE(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.AZURE) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Collections(java.util.Collections) ImageFilter(com.sequenceiq.cloudbreak.service.image.ImageFilter) Images(com.sequenceiq.cloudbreak.cloud.model.catalog.Images) StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Example 14 with StatedImages

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);
}
Also used : StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Aggregations

StatedImages (com.sequenceiq.cloudbreak.service.image.StatedImages)14 Test (org.junit.jupiter.api.Test)10 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)5 CloudbreakImageCatalogV3 (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3)4 ImageCatalogPlatform (com.sequenceiq.cloudbreak.service.image.catalog.model.ImageCatalogPlatform)4 Images (com.sequenceiq.cloudbreak.cloud.model.catalog.Images)3 ImageFilter (com.sequenceiq.cloudbreak.service.image.ImageFilter)3 StatedImages.statedImages (com.sequenceiq.cloudbreak.service.image.StatedImages.statedImages)2 Collections (java.util.Collections)2 List (java.util.List)2 CloudbreakVersion (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakVersion)1 AWS (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.AWS)1 AZURE (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform.AZURE)1 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)1 CloudbreakVersionListProvider (com.sequenceiq.cloudbreak.service.image.CloudbreakVersionListProvider)1 ImageCatalogVersionFilter (com.sequenceiq.cloudbreak.service.image.ImageCatalogVersionFilter)1 LatestDefaultImageUuidProvider (com.sequenceiq.cloudbreak.service.image.LatestDefaultImageUuidProvider)1 PrefixMatchImages (com.sequenceiq.cloudbreak.service.image.PrefixMatchImages)1 PrefixMatcherService (com.sequenceiq.cloudbreak.service.image.PrefixMatcherService)1 ImageCatalogPlatform.imageCatalogPlatform (com.sequenceiq.cloudbreak.service.image.catalog.model.ImageCatalogPlatform.imageCatalogPlatform)1