use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class CloudbreakVersionListProviderTest method testGetVersionsWithFreeipaVersions.
@Test
public void testGetVersionsWithFreeipaVersions() {
CloudbreakImageCatalogV3 catalog = new CloudbreakImageCatalogV3(null, new Versions(null, freeipaVersions()));
List<CloudbreakVersion> versions = underTest.getVersions(catalog);
assertEquals(1, versions.size());
assertEquals(FREEIPA_VERSIONS, versions.get(0).getVersions());
assertEquals(FREEIPA_IMAGE_IDS, versions.get(0).getImageIds());
assertTrue(versions.get(0).getDefaults().isEmpty());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class CloudbreakVersionListProviderTest method testGetVersionsWithCloudbreakVersions.
@Test
public void testGetVersionsWithCloudbreakVersions() {
CloudbreakImageCatalogV3 catalog = new CloudbreakImageCatalogV3(null, new Versions(cloudbreakVersions(), null));
List<CloudbreakVersion> versions = underTest.getVersions(catalog);
assertEquals(1, versions.size());
assertEquals(CLOUDBREAK_VERSIONS, versions.get(0).getVersions());
assertEquals(CLOUDBREAK_IMAGE_IDS, versions.get(0).getImageIds());
assertEquals(CLOUDBREAK_DEFAULTS, versions.get(0).getDefaults());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testGetFreeipaImagesForCbVersionShouldReturnsEmptyListWhenThereAreNoSupportedImagesForCbVersion.
@Test
public void testGetFreeipaImagesForCbVersionShouldReturnsEmptyListWhenThereAreNoSupportedImagesForCbVersion() {
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.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.isEmpty());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testValidateWithEmptyVersionBlock.
@Test
public void testValidateWithEmptyVersionBlock() {
CloudbreakImageCatalogV3 catalog = createCatalog(new Versions(Collections.emptyList(), Collections.emptyList()));
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(catalog.getVersions().getCloudbreakVersions());
Exception exception = assertThrows(CloudbreakImageCatalogException.class, () -> victim.validate(catalog));
assertEquals("Cloudbreak versions cannot be NULL", exception.getMessage());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.Versions in project cloudbreak by hortonworks.
the class VersionBasedImageCatalogServiceTest method testValidateFreeipaImagesWhichAllStoredInVersionBlock.
@Test
public void testValidateFreeipaImagesWhichAllStoredInVersionBlock() throws CloudbreakImageCatalogException {
Image properImage1 = createImage(PROPER_IMAGE_ID);
Image properImage2 = createImage(PROPER_IMAGE_ID_2);
Image otherImage = createImage(OTHER_IMAGE_ID);
when(images.getFreeIpaImages()).thenReturn(List.of(properImage1, properImage2, otherImage));
Versions versions = createFreeipaVersions();
when(cloudbreakVersionListProvider.getVersions(any())).thenReturn(versions.getFreeipaVersions());
victim.validate(createCatalog(versions));
}
Aggregations