use of com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo in project cloudbreak by hortonworks.
the class ImagesToImagesV4ResponseConverter method getDefaultCdhStackInfo.
private List<ClouderaManagerStackDetailsV4Response> getDefaultCdhStackInfo(Map<String, ImageBasedDefaultCDHInfo> defaultStackInfo) {
List<ClouderaManagerStackDetailsV4Response> result = new ArrayList<>();
for (ImageBasedDefaultCDHInfo info : defaultStackInfo.values()) {
ClouderaManagerStackDetailsV4Response json = new ClouderaManagerStackDetailsV4Response();
ClouderaManagerStackRepoDetailsV4Response repoJson = new ClouderaManagerStackRepoDetailsV4Response();
Map<String, String> stackRepo = info.getDefaultCDHInfo().getRepo().getStack();
if (stackRepo != null) {
repoJson.setStack(stackRepo);
}
json.setRepository(repoJson);
json.setVersion(info.getDefaultCDHInfo().getVersion());
result.add(json);
}
return result;
}
use of com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo in project cloudbreak by hortonworks.
the class StackMatrixServiceTest method setupStackEntries.
private void setupStackEntries() throws Exception {
Map<String, ImageBasedDefaultCDHInfo> cdhEntries = new HashMap<>();
DefaultCDHInfo cdhInfo = getDefaultCDHInfo("6.1.0-1.cdh6.1.0.p0.770702");
cdhEntries.put("6.1.0", new ImageBasedDefaultCDHInfo(cdhInfo, mock(Image.class)));
when(stackInfoToClouderaManagerStackDescriptorV4ResponseConverter.convert(cdhInfo)).thenReturn(getCMStackDescriptorResponse("6.1.0-1.cdh6.1.0.p0.770702"));
when(imageBasedDefaultCDHEntries.getEntries(WORKSPACE_ID, IMAGECATALOGPLATFORM, IMAGE_CATALOG_NAME)).thenReturn(cdhEntries);
}
use of com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo in project cloudbreak by hortonworks.
the class ClouderaManagerClusterCreationSetupServiceTest method init.
@Before
public void init() throws CloudbreakImageCatalogException {
MockitoAnnotations.initMocks(this);
Workspace workspace = new Workspace();
clusterRequest = new ClusterV4Request();
stack = new Stack();
stack.setId(STACK_ID);
stack.setName("test-stack");
stack.setWorkspace(workspace);
Blueprint blueprint = new Blueprint();
blueprint.setBlueprintText("{}");
Map<InstanceGroupType, String> userData = new HashMap<>();
userData.put(InstanceGroupType.CORE, "userdata");
Image image = new Image("imagename", userData, "centos7", REDHAT_7, "url", IMAGE_CATALOG_NAME, "id", Collections.emptyMap());
imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(image), stack);
cluster = new Cluster();
stack.setCluster(cluster);
cluster.setStack(stack);
cluster.setBlueprint(blueprint);
cluster.setWorkspace(workspace);
setupDefaultClouderaManagerEntries();
Map<String, ImageBasedDefaultCDHInfo> defaultCDHInfoMap = Map.of(OLDER_CDH_VERSION, new ImageBasedDefaultCDHInfo(getDefaultCDHInfo(OLDER_CDH_VERSION), mock(com.sequenceiq.cloudbreak.cloud.model.catalog.Image.class)), SOME_CDH_VERSION, new ImageBasedDefaultCDHInfo(getDefaultCDHInfo(SOME_CDH_VERSION), mock(com.sequenceiq.cloudbreak.cloud.model.catalog.Image.class)), NEWER_CDH_VERSION, new ImageBasedDefaultCDHInfo(getDefaultCDHInfo(NEWER_CDH_VERSION), mock(com.sequenceiq.cloudbreak.cloud.model.catalog.Image.class)));
when(imageBasedDefaultCDHEntries.getEntries(workspace.getId(), null, IMAGE_CATALOG_NAME)).thenReturn(defaultCDHInfoMap);
StackMatrixV4Response stackMatrixV4Response = new StackMatrixV4Response();
stackMatrixV4Response.setCdh(Collections.singletonMap(OLDER_CDH_VERSION, null));
when(stackMatrixService.getStackMatrix(Mockito.eq(workspace.getId()), Mockito.eq(null), Mockito.anyString())).thenReturn(stackMatrixV4Response);
when(platformStringTransformer.getPlatformStringForImageCatalog(anyString(), anyString())).thenReturn(imageCatalogPlatform("AWS"));
}
use of com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo in project cloudbreak by hortonworks.
the class StackMatrixService method getImageBasedStackMatrix.
private StackMatrixV4Response getImageBasedStackMatrix(Long workspaceId, ImageCatalogPlatform platform, String imageCatalogName) throws CloudbreakImageCatalogException {
Map<String, ImageBasedDefaultCDHInfo> cdhEntries = imageBasedDefaultCDHEntries.getEntries(workspaceId, platform, imageCatalogName);
StackMatrixV4Response stackMatrixV4Response = new StackMatrixV4Response();
Map<String, ClouderaManagerStackDescriptorV4Response> cdhStackDescriptors = new HashMap<>();
for (Entry<String, ImageBasedDefaultCDHInfo> defaultCDHInfoEntry : cdhEntries.entrySet()) {
DefaultCDHInfo defaultCDHInfo = defaultCDHInfoEntry.getValue().getDefaultCDHInfo();
Image image = defaultCDHInfoEntry.getValue().getImage();
ClouderaManagerStackDescriptorV4Response stackDescriptorV4 = getImageBasedCMStackDescriptor(defaultCDHInfo, image);
cdhStackDescriptors.put(defaultCDHInfoEntry.getKey(), stackDescriptorV4);
}
stackMatrixV4Response.setCdh(cdhStackDescriptors);
return stackMatrixV4Response;
}
use of com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo in project cloudbreak by hortonworks.
the class StackMatrixService method getImageBasedStackMatrix.
private StackMatrixV4Response getImageBasedStackMatrix(Long workspaceId, String platform, String imageCatalogName) throws CloudbreakImageCatalogException {
Map<String, ImageBasedDefaultCDHInfo> cdhEntries = imageBasedDefaultCDHEntries.getEntries(workspaceId, platform, imageCatalogName);
StackMatrixV4Response stackMatrixV4Response = new StackMatrixV4Response();
Map<String, ClouderaManagerStackDescriptorV4Response> cdhStackDescriptors = new HashMap<>();
for (Entry<String, ImageBasedDefaultCDHInfo> defaultCDHInfoEntry : cdhEntries.entrySet()) {
DefaultCDHInfo defaultCDHInfo = defaultCDHInfoEntry.getValue().getDefaultCDHInfo();
Image image = defaultCDHInfoEntry.getValue().getImage();
ClouderaManagerStackDescriptorV4Response stackDescriptorV4 = getImageBasedCMStackDescriptor(defaultCDHInfo, image);
cdhStackDescriptors.put(defaultCDHInfoEntry.getKey(), stackDescriptorV4);
}
stackMatrixV4Response.setCdh(cdhStackDescriptors);
return stackMatrixV4Response;
}
Aggregations