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());
}
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);
}
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());
}
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);
}
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());
}
Aggregations