Search in sources :

Example 6 with Images

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Images 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));
}
Also used : FreeIpaVersions(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.FreeIpaVersions) Image(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image) ImageCatalog(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog) Test(org.junit.Test)

Example 7 with Images

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Images 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());
}
Also used : FreeIpaVersions(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.FreeIpaVersions) Image(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image) ImageCatalog(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog) Test(org.junit.Test)

Example 8 with Images

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Images in project cloudbreak by hortonworks.

the class ImageService method generateImageCatalogForStack.

public ImageCatalog generateImageCatalogForStack(Stack stack) {
    final Image image = getImageForStack(stack);
    final Images images = new Images(List.of(copyImageWithAdvertisedFlag(image)));
    return new ImageCatalog(images, null);
}
Also used : Images(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Images) Image(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image) ImageCatalog(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog)

Example 9 with Images

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Images in project cloudbreak by hortonworks.

the class UpgradeService method getTargetImages.

private List<ImageInfoResponse> getTargetImages(String catalog, Stack stack, ImageInfoResponse currentImage) {
    ImageSettingsRequest imageSettingsRequest = new ImageSettingsRequest();
    imageSettingsRequest.setCatalog(catalog);
    LOGGER.debug("Using ImageSettingsRequest to query for possible target images: {}", imageSettingsRequest);
    List<ImageInfoResponse> targetImages = imageService.findTargetImages(stack, imageSettingsRequest, currentImage);
    LOGGER.debug("Found target images: {}", targetImages);
    return targetImages;
}
Also used : ImageInfoResponse(com.sequenceiq.freeipa.api.v1.freeipa.upgrade.model.ImageInfoResponse) ImageSettingsRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest)

Example 10 with Images

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Images in project cloudbreak by hortonworks.

the class FreeIpaImageProviderTest method testGetImagesNoInput.

@Test
public void testGetImagesNoInput() {
    ImageSettingsRequest imageSettingsRequest = setupImageSettingsRequest(null, null, null);
    List<ImageWrapper> images = underTest.getImages(imageSettingsRequest, DEFAULT_REGION, DEFAULT_PLATFORM);
    assertEquals(2, images.size());
    assertThat(images, everyItem(allOf(hasProperty("image", hasProperty("os", is(DEFAULT_OS))), hasProperty("catalogUrl", is(DEFAULT_CATALOG_URL)), hasProperty("catalogName", is(nullValue())))));
    assertThat(images, hasItem(allOf(hasProperty("image", allOf(hasProperty("uuid", is(IMAGE_UUID)), hasProperty("date", is(LATEST_DATE)))))));
    assertThat(images, hasItem(allOf(hasProperty("image", allOf(hasProperty("uuid", is("71851893-8340-411d-afb7-e1b55107fb10")), hasProperty("date", is(LATEST_DATE_NO_INPUT)))))));
}
Also used : ImageSettingsRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest) ImageWrapper(com.sequenceiq.freeipa.dto.ImageWrapper) Test(org.junit.jupiter.api.Test)

Aggregations

ImageSettingsRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest)11 Image (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image)10 ImageWrapper (com.sequenceiq.freeipa.dto.ImageWrapper)10 Test (org.junit.jupiter.api.Test)8 ImageCatalog (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.ImageCatalog)5 FreeIpaVersions (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.FreeIpaVersions)4 Images (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Images)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 Test (org.junit.Test)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 Value (org.springframework.beans.factory.annotation.Value)2 Service (org.springframework.stereotype.Service)2 ImageCatalogV4Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.ImageCatalogV4Endpoint)1 ImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response)1 ImagesV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response)1 WebApplicationExceptionMessageExtractor (com.sequenceiq.cloudbreak.common.exception.WebApplicationExceptionMessageExtractor)1