use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog in project cloudbreak by hortonworks.
the class FreeIpaImageProviderTest method setupImageCatalogProvider.
private ImageCatalog setupImageCatalogProvider(String catalogUrl, String catalogFile) throws IOException {
String catalogJson = FileReaderUtils.readFileFromClasspath(catalogFile);
ImageCatalog catalog = objectMapper.readValue(catalogJson, ImageCatalog.class);
lenient().when(imageCatalogProvider.getImageCatalog(catalogUrl)).thenReturn(catalog);
lenient().when(imageCatalogProvider.getImageCatalog(DEFAULT_CATALOG_URL)).thenReturn(catalog);
return catalog;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogProviderTest method testReadImageCatalogFromFileWithoutVersionsButWithAdvertisedFlag.
@Test
public void testReadImageCatalogFromFileWithoutVersionsButWithAdvertisedFlag() {
String path = getPath(IMAGE_CATALOG_WITHOUT_VERSIONS);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", CB_CENTOS_7_FILTER);
ImageCatalog catalog = underTest.getImageCatalog(IMAGE_CATALOG_WITHOUT_VERSIONS);
List<com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image> images = catalog.getImages().getFreeipaImages();
assertEquals(2, images.size());
FreeIpaVersions freeIpaVersions = catalog.getVersions().getFreeIpaVersions().get(0);
assertEquals(1, freeIpaVersions.getImageIds().size());
assertEquals("91851893-8340-411d-afb7-e1b55107fb10", freeIpaVersions.getImageIds().get(0));
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogProviderTest method testImageCatalogFilterAllOs.
@Test
public void testImageCatalogFilterAllOs() {
String path = getPath(IMAGE_CATALOG_FILTER_ALL_OS_JSON);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", CB_CENTOS_7_FILTER);
ImageCatalog actualCatalog = underTest.getImageCatalog(IMAGE_CATALOG_FILTER_ALL_OS_JSON);
List<String> actualOsTypes = getImageCatalogOses(actualCatalog);
assertEquals(Collections.emptyList(), actualOsTypes);
assertEquals(Collections.emptyList(), mapToUuid(actualCatalog.getImages().getFreeipaImages()));
assertEquals(0, actualCatalog.getImages().getFreeipaImages().size());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogProviderTest method testReadImageCatalogFromFile.
@Test
public void testReadImageCatalogFromFile() {
String path = getPath(IMAGE_CATALOG_JSON);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", Collections.emptyList());
ImageCatalog catalog = underTest.getImageCatalog(IMAGE_CATALOG_JSON);
List<com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image> images = catalog.getImages().getFreeipaImages();
assertEquals(4, images.size());
assertEquals("61851893-8340-411d-afb7-e1b55107fb10", images.get(0).getUuid());
FreeIpaVersions freeIpaVersions = catalog.getVersions().getFreeIpaVersions().get(0);
assertEquals(2, freeIpaVersions.getImageIds().size());
assertEquals("61851893-8340-411d-afb7-e1b55107fb10", freeIpaVersions.getImageIds().get(0));
assertEquals(1, freeIpaVersions.getDefaults().size());
assertEquals(List.of("71851893-8340-411d-afb7-e1b55107fb10"), freeIpaVersions.getDefaults());
assertEquals(4, freeIpaVersions.getVersions().size());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogProviderTest method testImageCatalogFilterOs.
@Test
public void testImageCatalogFilterOs() {
String path = getPath(IMAGE_CATALOG_JSON);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", CB_CENTOS_7_FILTER);
ImageCatalog actualCatalog = underTest.getImageCatalog(IMAGE_CATALOG_JSON);
List<String> actualOsTypes = getImageCatalogOses(actualCatalog);
assertEquals(CB_CENTOS_7_FILTER, actualOsTypes);
List<String> expectedImagesList = List.of("81851893-8340-411d-afb7-e1b55107fb10", "91851893-8340-411d-afb7-e1b55107fb10");
assertEquals(expectedImagesList, mapToUuid(actualCatalog.getImages().getFreeipaImages()));
assertEquals(List.of(), actualCatalog.getVersions().getFreeIpaVersions().get(0).getImageIds());
assertEquals(List.of(), actualCatalog.getVersions().getFreeIpaVersions().get(0).getDefaults());
assertEquals(2, actualCatalog.getImages().getFreeipaImages().size());
}
Aggregations