Search in sources :

Example 1 with Images

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

the class FreeIpaImageProviderTest method testGetImagesGivenUuidInputNotFoundWithNotDefaultOs.

@Test
public void testGetImagesGivenUuidInputNotFoundWithNotDefaultOs() {
    ImageSettingsRequest is = setupImageSettingsRequest(NON_DEFAULT_OS_IMAGE_UUID, null, null);
    List<ImageWrapper> images = underTest.getImages(is, DEFAULT_REGION, DEFAULT_PLATFORM);
    assertTrue(images.isEmpty());
}
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)

Example 2 with Images

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

the class FreeIpaImageProviderTest method testGetImagesGivenIdInputFound.

@Test
public void testGetImagesGivenIdInputFound() {
    ImageSettingsRequest is = setupImageSettingsRequest(EXISTING_ID, null, null);
    List<ImageWrapper> images = underTest.getImages(is, DEFAULT_REGION, DEFAULT_PLATFORM);
    assertEquals(1, images.size());
    ImageWrapper imageWrapper = images.get(0);
    assertEquals(DEFAULT_CATALOG_URL, imageWrapper.getCatalogUrl());
    assertNull(imageWrapper.getCatalogName());
    Image image = imageWrapper.getImage();
    assertEquals(DEFAULT_OS, image.getOs());
    assertEquals(LATEST_DATE, image.getDate());
    assertEquals(IMAGE_UUID, image.getUuid());
}
Also used : ImageSettingsRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest) ImageWrapper(com.sequenceiq.freeipa.dto.ImageWrapper) Image(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image) Test(org.junit.jupiter.api.Test)

Example 3 with Images

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

the class FreeIpaImageProviderTest method testGetImagesGivenIdInputNotFound.

@Test
public void testGetImagesGivenIdInputNotFound() {
    ImageSettingsRequest is = setupImageSettingsRequest(NON_EXISTING_ID, null, null);
    List<ImageWrapper> images = underTest.getImages(is, DEFAULT_REGION, DEFAULT_PLATFORM);
    assertTrue(images.isEmpty());
}
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)

Example 4 with Images

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

the class FreeIpaImageProviderTest method testGetImagesGivenNoInputWithInvalidAppVersion.

@Test
public void testGetImagesGivenNoInputWithInvalidAppVersion() {
    ReflectionTestUtils.setField(underTest, FreeIpaImageProvider.class, "freeIpaVersion", "2.21.0-dcv.1", null);
    ImageSettingsRequest is = setupImageSettingsRequest(null, null, "centos7");
    List<ImageWrapper> images = underTest.getImages(is, DEFAULT_REGION, DEFAULT_PLATFORM);
    assertTrue(images.isEmpty());
}
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)

Example 5 with Images

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

the class FreeIpaImageProviderTest method testGetImagesGivenAllInputNonExistentOS.

@Test
public void testGetImagesGivenAllInputNonExistentOS() {
    ImageSettingsRequest is = setupImageSettingsRequest(EXISTING_ID, CUSTOM_IMAGE_CATALOG_URL, NON_EXISTING_OS);
    List<ImageWrapper> images = underTest.getImages(is, DEFAULT_REGION, DEFAULT_PLATFORM);
    assertEquals(1, images.size());
    ImageWrapper imageWrapper = images.get(0);
    assertEquals(CUSTOM_IMAGE_CATALOG_URL, imageWrapper.getCatalogUrl());
    assertNull(imageWrapper.getCatalogName());
    Image image = imageWrapper.getImage();
    assertEquals(DEFAULT_OS, image.getOs());
    assertEquals(LATEST_DATE, image.getDate());
    assertEquals(IMAGE_UUID, image.getUuid());
}
Also used : ImageSettingsRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest) ImageWrapper(com.sequenceiq.freeipa.dto.ImageWrapper) Image(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image) 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