Search in sources :

Example 6 with StatedImages

use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.

the class VersionBasedImageCatalogServiceTest method testGetImagesShouldCallRawImageProviderWhenTheCbVersionIsNotPresent.

@Test
public void testGetImagesShouldCallRawImageProviderWhenTheCbVersionIsNotPresent() {
    StatedImages statedImages = mock(StatedImages.class);
    when(rawImageProvider.getImages(imageCatalogV3, imageFilter)).thenReturn(statedImages);
    StatedImages actual = victim.getImages(imageCatalogV3, imageFilter);
    assertEquals(statedImages, actual);
    verify(rawImageProvider).getImages(imageCatalogV3, imageFilter);
}
Also used : StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Example 7 with StatedImages

use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.

the class AdvertisedImageProviderTest method shouldIncludeBaseImagesWhenBaseImagesAreEnabled.

@Test
public void shouldIncludeBaseImagesWhenBaseImagesAreEnabled() {
    CloudbreakImageCatalogV3 imageCatalog = anImageCatalogV3();
    StatedImages actual = victim.getImages(anImageCatalogV3(), createImageFilter(true));
    assertFalse(imageCatalog.getImages().getBaseImages().isEmpty());
    assertFalse(actual.getImages().getBaseImages().isEmpty());
}
Also used : CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Example 8 with StatedImages

use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.

the class AdvertisedImageProviderTest method shouldSetUpImageCatalogNameAndUrl.

@Test
public void shouldSetUpImageCatalogNameAndUrl() {
    ImageFilter imageFilter = createImageFilter(false);
    StatedImages actual = victim.getImages(anImageCatalogV3(), createImageFilter(false));
    assertEquals(imageFilter.getImageCatalog().getImageCatalogUrl(), actual.getImageCatalogUrl());
    assertEquals(imageFilter.getImageCatalog().getName(), actual.getImageCatalogName());
}
Also used : ImageFilter(com.sequenceiq.cloudbreak.service.image.ImageFilter) StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Example 9 with StatedImages

use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.

the class ImageBasedDefaultCDHEntries method getEntries.

public Map<String, ImageBasedDefaultCDHInfo> getEntries(Long workspaceId, ImageCatalogPlatform platform, String imageCatalogName) throws CloudbreakImageCatalogException {
    String catalogName = Optional.ofNullable(imageCatalogName).orElse(ImageCatalogService.CDP_DEFAULT_CATALOG_NAME);
    StatedImages images = imageCatalogService.getImages(workspaceId, catalogName, platform);
    if (images.getImages().getCdhImages().isEmpty()) {
        LOGGER.warn("Missing CDH images for cloud platform: {}. Falling back to AWS.", platform);
        images = imageCatalogService.getImages(workspaceId, catalogName, imageCatalogPlatform(CloudPlatform.AWS.name()));
    }
    return getEntries(images.getImages());
}
Also used : StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages)

Example 10 with StatedImages

use of com.sequenceiq.cloudbreak.service.image.StatedImages in project cloudbreak by hortonworks.

the class AdvertisedImageProviderTest method shouldNotIncludeBaseImagesWhenBaseImagesAreDisabled.

@Test
public void shouldNotIncludeBaseImagesWhenBaseImagesAreDisabled() {
    CloudbreakImageCatalogV3 imageCatalog = anImageCatalogV3();
    StatedImages actual = victim.getImages(anImageCatalogV3(), createImageFilter(false));
    assertFalse(imageCatalog.getImages().getBaseImages().isEmpty());
    assertTrue(actual.getImages().getBaseImages().isEmpty());
}
Also used : CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) 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