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