Search in sources :

Example 21 with ImageStackDetails

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

the class ImageToImageV4ResponseConverter method convert.

public ImageV4Response convert(Image source) {
    ImageV4Response result = new ImageV4Response();
    result.setDate(source.getDate());
    result.setCreated(source.getCreated());
    result.setPublished(source.getPublished());
    result.setDescription(source.getDescription());
    result.setOs(source.getOs());
    result.setOsType(source.getOsType());
    result.setUuid(source.getUuid());
    result.setVersion(source.getVersion());
    result.setDefaultImage(source.isDefaultImage());
    result.setPackageVersions(source.getPackageVersions());
    result.setRepository(source.getRepo());
    result.setImageSetsByProvider(source.getImageSetsByProvider());
    result.setCmBuildNumber(source.getCmBuildNumber());
    result.setPreWarmCsd(source.getPreWarmCsd());
    result.setPreWarmParcels(source.getPreWarmParcels());
    result.setAdvertised(source.isAdvertised());
    ImageStackDetails stackDetails = source.getStackDetails();
    if (stackDetails != null) {
        BaseStackDetailsV4Response stackDetailsResponse = new BaseStackDetailsV4Response();
        stackDetailsResponse.setStackBuildNumber(stackDetails.getStackBuildNumber());
        stackDetailsResponse.setVersion(stackDetails.getVersion());
        result.setStackDetails(stackDetailsResponse);
    }
    result.setBaseParcelUrl(source.getBaseParcelUrl());
    result.setSourceImageId(source.getSourceImageId());
    return result;
}
Also used : ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) ImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response) BaseStackDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseStackDetailsV4Response)

Example 22 with ImageStackDetails

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

the class CdhPackageLocationFilterTest method testNotMatching.

@Test
public void testNotMatching() {
    Image image = mock(Image.class);
    when(image.getStackDetails()).thenReturn(new ImageStackDetails("1", new StackRepoDetails(Map.of("redhat7", "http://random.org/asdf/"), Map.of()), "1"));
    Image currentImage = mock(Image.class);
    when(currentImage.getOsType()).thenReturn("redhat7");
    boolean result = underTest.filterImage(image, currentImage, null);
    assertFalse(result);
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.jupiter.api.Test)

Example 23 with ImageStackDetails

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

the class CdhPackageLocationFilterTest method testRepoIsNull.

@Test
public void testRepoIsNull() {
    Image image = mock(Image.class);
    when(image.getStackDetails()).thenReturn(new ImageStackDetails("1", null, "1"));
    boolean result = underTest.filterImage(image, mock(Image.class), null);
    assertFalse(result);
}
Also used : ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.jupiter.api.Test)

Example 24 with ImageStackDetails

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

the class CdhPackageLocationFilterTest method testCurrentImageNull.

@Test
public void testCurrentImageNull() {
    Image image = mock(Image.class);
    when(image.getStackDetails()).thenReturn(new ImageStackDetails("1", new StackRepoDetails(Map.of(), Map.of()), "1"));
    boolean result = underTest.filterImage(image, null, null);
    assertFalse(result);
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.jupiter.api.Test)

Example 25 with ImageStackDetails

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

the class ImageTestUtil method getImage.

public static Image getImage(boolean prewarmed, String uuid, String stackVersion) {
    Map<String, String> packageVersions = Collections.singletonMap("package", "version");
    Map<String, String> regionImageIdMap = new HashMap<>();
    regionImageIdMap.put("region", uuid);
    Map<String, String> stackDetailsMap = new HashMap<>();
    stackDetailsMap.put("redhat7", "http://foo/parcels");
    stackDetailsMap.put("repoid", String.format("CDH-%s", stackVersion));
    stackDetailsMap.put("repository-version", String.format("%s-1.cdh%s.p0.2457278", stackVersion, stackVersion));
    Map<String, Map<String, String>> imageSetsByProvider = new HashMap<>();
    imageSetsByProvider.put(PLATFORM, regionImageIdMap);
    ImageStackDetails stackDetails = null;
    if (prewarmed) {
        StackRepoDetails repoDetails = new StackRepoDetails(stackDetailsMap, Collections.emptyMap());
        stackDetails = new ImageStackDetails(stackVersion, repoDetails, "1");
    }
    return new Image("imageDate", System.currentTimeMillis(), System.currentTimeMillis(), "imageDesc", "centos7", uuid, stackVersion, Collections.emptyMap(), imageSetsByProvider, stackDetails, "centos", packageVersions, Collections.emptyList(), Collections.emptyList(), "1", true, "myBaseUrl", "sourceId");
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) HashMap(java.util.HashMap) ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ImageStackDetails (com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails)25 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails)16 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)13 Test (org.junit.jupiter.api.Test)13 Map (java.util.Map)4 List (java.util.List)3 StackType (com.sequenceiq.cloudbreak.cloud.model.component.StackType)2 Component (com.sequenceiq.cloudbreak.domain.stack.Component)2 HashMap (java.util.HashMap)2 BaseStackDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseStackDetailsV4Response)1 ImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response)1 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 CustomImage (com.sequenceiq.cloudbreak.domain.CustomImage)1 VmImage (com.sequenceiq.cloudbreak.domain.VmImage)1 StatedImage (com.sequenceiq.cloudbreak.service.image.StatedImage)1 Arrays.asList (java.util.Arrays.asList)1 Collections (java.util.Collections)1 Optional (java.util.Optional)1 Set (java.util.Set)1