use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.
the class CachedImageCatalogWrapperProviderTest method testImageCatalogFilterNullImages.
@Test
public void testImageCatalogFilterNullImages() throws CloudbreakImageCatalogException {
String path = getPath(CB_IMAGE_CATALOG_FILTER_NULL_IMAGES_JSON);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", Collections.emptyList());
CloudbreakImageCatalogV3 imageCatalogV2 = underTest.getImageCatalogWrapper(CB_IMAGE_CATALOG_FILTER_NULL_IMAGES_JSON).getImageCatalog();
assertEquals(1L, imageCatalogV2.getImages().getBaseImages().get(0).getImageSetsByProvider().values().size());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.
the class CachedImageCatalogWrapperProviderTest method testImageCatalogFilterNothing.
@Test
public void testImageCatalogFilterNothing() throws CloudbreakImageCatalogException, IOException {
String path = getPath(CB_IMAGE_CATALOG_RC_JSON);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", Collections.emptyList());
CloudbreakImageCatalogV3 actualCatalog = underTest.getImageCatalogWrapper(CB_IMAGE_CATALOG_RC_JSON).getImageCatalog();
List<String> actualOsTypes = getImageCatalogOses(actualCatalog);
assertEquals(RC_IMAGE_CATALOG_OS_TYPES, actualOsTypes);
ObjectMapper objectMapper = new ObjectMapper();
CloudbreakImageCatalogV3 expectedCatalog = objectMapper.readValue(Paths.get(path, CB_IMAGE_CATALOG_RC_JSON).toFile(), CloudbreakImageCatalogV3.class);
assertEquals(mapToUuid(expectedCatalog.getImages().getBaseImages()), mapToUuid(actualCatalog.getImages().getBaseImages()));
assertEquals(mapToUuid(expectedCatalog.getImages().getCdhImages()), mapToUuid(actualCatalog.getImages().getCdhImages()));
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.
the class CachedImageCatalogWrapperProviderTest method testHttpImageCatalogValid.
@Test
public void testHttpImageCatalogValid() throws CloudbreakImageCatalogException, IOException {
String path = getPath(CB_IMAGE_CATALOG_VALID_JSON);
String catalogUrl = "http";
when(restClientFactory.getOrCreateDefault()).thenReturn(clientMock);
when(clientMock.target(catalogUrl)).thenReturn(webTargetMock);
when(webTargetMock.request()).thenReturn(builderMock);
when(builderMock.get()).thenReturn(responseMock);
when(responseMock.getStatusInfo()).thenReturn(statusTypeMock);
when(statusTypeMock.getFamily()).thenReturn(Response.Status.Family.SUCCESSFUL);
when(responseMock.readEntity(String.class)).thenReturn(Files.readString(Paths.get(path, CB_IMAGE_CATALOG_V2_JSON)));
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", Collections.emptyList());
CloudbreakImageCatalogV3 actualCatalog = underTest.getImageCatalogWrapper(catalogUrl).getImageCatalog();
CloudbreakImageCatalogV3 expectedCatalog = objectMapper.readValue(Paths.get(path, CB_IMAGE_CATALOG_V2_JSON).toFile(), CloudbreakImageCatalogV3.class);
assertEquals(mapToUuid(expectedCatalog.getImages().getBaseImages()), mapToUuid(actualCatalog.getImages().getBaseImages()));
assertEquals(mapToUuid(expectedCatalog.getImages().getCdhImages()), mapToUuid(actualCatalog.getImages().getCdhImages()));
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.
the class CachedImageCatalogWrapperProviderTest method testFreeipaImageCatalogFilterToRedhat7.
@Test
public void testFreeipaImageCatalogFilterToRedhat7() throws CloudbreakImageCatalogException, IOException {
String path = getPath(FREEIPA_IMAGE_CATALOG_V3_JSON);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", CB_REDHAT7_FILTER);
CloudbreakImageCatalogV3 actualCatalog = underTest.getImageCatalogWrapper(FREEIPA_IMAGE_CATALOG_V3_JSON).getImageCatalog();
assertEquals(mapToUuid(Collections.emptyList()), mapToUuid(actualCatalog.getImages().getBaseImages()));
assertEquals(mapToUuid(Collections.emptyList()), mapToUuid(actualCatalog.getImages().getCdhImages()));
assertEquals(1, actualCatalog.getImages().getFreeIpaImages().size());
assertEquals("81851893-8340-411d-afb7-e1b55107fb10", actualCatalog.getImages().getFreeIpaImages().get(0).getUuid());
}
use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.
the class CachedImageCatalogWrapperProviderTest method testImageCatalogWithoutBaseImages.
@Test
public void testImageCatalogWithoutBaseImages() throws CloudbreakImageCatalogException {
String path = getPath(CB_IMAGE_CATALOG_WITHOUT_BASE_IMAGES);
ReflectionTestUtils.setField(underTest, "etcConfigDir", path);
ReflectionTestUtils.setField(underTest, "enabledLinuxTypes", Collections.emptyList());
CloudbreakImageCatalogV3 imageCatalogV2 = underTest.getImageCatalogWrapper(CB_IMAGE_CATALOG_WITHOUT_BASE_IMAGES).getImageCatalog();
assertNotNull(imageCatalogV2.getImages().getBaseImages());
}
Aggregations