Search in sources :

Example 11 with Versions

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());
}
Also used : Versions(com.sequenceiq.cloudbreak.cloud.model.catalog.Versions) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) CloudbreakImageCatalogException(com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException) Test(org.junit.jupiter.api.Test)

Example 12 with Versions

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());
}
Also used : Versions(com.sequenceiq.cloudbreak.cloud.model.catalog.Versions) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.jupiter.api.Test)

Example 13 with Versions

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));
}
Also used : Versions(com.sequenceiq.cloudbreak.cloud.model.catalog.Versions) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.jupiter.api.Test)

Aggregations

Versions (com.sequenceiq.cloudbreak.cloud.model.catalog.Versions)13 Test (org.junit.jupiter.api.Test)11 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)10 CloudbreakImageCatalogV3 (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3)3 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)3 CloudbreakVersion (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakVersion)2 PrefixMatchImages (com.sequenceiq.cloudbreak.service.image.PrefixMatchImages)2 Test (org.junit.Test)2