Search in sources :

Example 21 with CloudbreakImageCatalogV3

use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.

the class AdvertisedImageProviderTest method shouldIncludeBaseImagesWhenBaseImagesAreEnabled.

@Test
public void shouldIncludeBaseImagesWhenBaseImagesAreEnabled() {
    CloudbreakImageCatalogV3 imageCatalog = anImageCatalogV3();
    StatedImages actual = victim.getImages(anImageCatalogV3(), createImageFilter(true));
    assertFalse(imageCatalog.getImages().getBaseImages().isEmpty());
    assertFalse(actual.getImages().getBaseImages().isEmpty());
}
Also used : CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) StatedImages(com.sequenceiq.cloudbreak.service.image.StatedImages) Test(org.junit.jupiter.api.Test)

Example 22 with CloudbreakImageCatalogV3

use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.

the class ImageCatalogServiceTest method initTests.

@BeforeEach
public void initTests() {
    Image runtimeImage721 = mock(Image.class);
    Image runtimeImage722 = mock(Image.class);
    Image runtimeImage7210 = mock(Image.class);
    imageCatalogV3 = mock(CloudbreakImageCatalogV3.class);
    when(runtimeImage721.getVersion()).thenReturn(RUNTIME_721);
    when(runtimeImage722.getVersion()).thenReturn(RUNTIME_722);
    when(runtimeImage7210.getVersion()).thenReturn(RUNTIME_7210);
    ImageFilterResult imageFilterResult = new ImageFilterResult(List.of(runtimeImage722, runtimeImage7210, runtimeImage721, runtimeImage721), null);
    victim = new TestImplementation(imageCatalogV3, imageFilterResult);
}
Also used : CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) ImageFilterResult(com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterResult) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 23 with CloudbreakImageCatalogV3

use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 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());
}
Also used : Versions(com.sequenceiq.cloudbreak.cloud.model.catalog.Versions) CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) CloudbreakImageCatalogException(com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException) Test(org.junit.jupiter.api.Test)

Example 24 with CloudbreakImageCatalogV3

use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.

the class StackOperationsTest method testGenerateImageCatalog.

@Test
public void testGenerateImageCatalog() {
    NameOrCrn nameOrCrn = NameOrCrn.ofName(stack.getName());
    CloudbreakImageCatalogV3 imageCatalog = mock(CloudbreakImageCatalogV3.class);
    when(stackService.getByNameOrCrnInWorkspace(nameOrCrn, stack.getWorkspace().getId())).thenReturn(stack);
    when(generateImageCatalogService.generateImageCatalogForStack(stack)).thenReturn(imageCatalog);
    CloudbreakImageCatalogV3 actual = underTest.generateImageCatalog(nameOrCrn, stack.getWorkspace().getId());
    assertEquals(imageCatalog, actual);
}
Also used : CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) Test(org.junit.Test)

Example 25 with CloudbreakImageCatalogV3

use of com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3 in project cloudbreak by hortonworks.

the class DistroXV1ControllerTest method testGenerateImageCatalog.

@Test
void testGenerateImageCatalog() {
    CloudbreakImageCatalogV3 imageCatalog = Mockito.mock(CloudbreakImageCatalogV3.class);
    when(workspaceService.getForCurrentUser()).thenReturn(workspace);
    when(workspace.getId()).thenReturn(WORKSPACE_ID);
    when(stackOperations.generateImageCatalog(nameOrCrnArgumentCaptor.capture(), Mockito.eq(WORKSPACE_ID))).thenReturn(imageCatalog);
    DistroXGenerateImageCatalogV1Response actual = distroXV1Controller.generateImageCatalog(NAME);
    assertEquals(NAME, nameOrCrnArgumentCaptor.getValue().getName());
    assertEquals(imageCatalog, actual.getImageCatalog());
}
Also used : CloudbreakImageCatalogV3(com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3) DistroXGenerateImageCatalogV1Response(com.sequenceiq.distrox.api.v1.distrox.model.DistroXGenerateImageCatalogV1Response) Test(org.junit.jupiter.api.Test)

Aggregations

CloudbreakImageCatalogV3 (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3)48 Test (org.junit.jupiter.api.Test)21 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)17 Test (org.junit.Test)14 ImageFilterResult (com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterResult)10 UpgradeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeV4Response)8 ImageFilterParams (com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams)8 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)7 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)7 Images (com.sequenceiq.cloudbreak.cloud.model.catalog.Images)6 CloudbreakVersion (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakVersion)5 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)5 StatedImages (com.sequenceiq.cloudbreak.service.image.StatedImages)5 Image (com.sequenceiq.cloudbreak.cloud.model.Image)4 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)4 List (java.util.List)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Versions (com.sequenceiq.cloudbreak.cloud.model.catalog.Versions)3 ImageFilter (com.sequenceiq.cloudbreak.service.image.ImageFilter)3 ImageCatalogWrapper (com.sequenceiq.cloudbreak.service.image.catalog.model.ImageCatalogWrapper)3