Search in sources :

Example 6 with ImageBasedDefaultCDHInfo

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;
}
Also used : ClouderaManagerStackRepoDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackRepoDetailsV4Response) ClouderaManagerStackDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) ArrayList(java.util.ArrayList)

Example 7 with ImageBasedDefaultCDHInfo

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);
}
Also used : ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) DefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.DefaultCDHInfo) RepoTestUtil.getDefaultCDHInfo(com.sequenceiq.cloudbreak.RepoTestUtil.getDefaultCDHInfo) HashMap(java.util.HashMap) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo)

Example 8 with ImageBasedDefaultCDHInfo

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"));
}
Also used : InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) HashMap(java.util.HashMap) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Json(com.sequenceiq.cloudbreak.common.json.Json) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Component(com.sequenceiq.cloudbreak.domain.stack.Component) ClusterComponent(com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent) StackMatrixV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Before(org.junit.Before)

Example 9 with ImageBasedDefaultCDHInfo

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;
}
Also used : ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) DefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.DefaultCDHInfo) HashMap(java.util.HashMap) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) ClouderaManagerStackDescriptorV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) StackMatrixV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response)

Example 10 with ImageBasedDefaultCDHInfo

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;
}
Also used : ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) DefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.DefaultCDHInfo) HashMap(java.util.HashMap) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) ClouderaManagerStackDescriptorV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) StackMatrixV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response)

Aggregations

ImageBasedDefaultCDHInfo (com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo)10 DefaultCDHInfo (com.sequenceiq.cloudbreak.cloud.model.component.DefaultCDHInfo)7 HashMap (java.util.HashMap)7 StackMatrixV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response)6 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)4 ClouderaManagerStackDescriptorV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response)4 Image (com.sequenceiq.cloudbreak.cloud.model.Image)4 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)4 Json (com.sequenceiq.cloudbreak.common.json.Json)4 Component (com.sequenceiq.cloudbreak.domain.stack.Component)4 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)4 ArrayList (java.util.ArrayList)4 RepoTestUtil.getDefaultCDHInfo (com.sequenceiq.cloudbreak.RepoTestUtil.getDefaultCDHInfo)3 ImageBasedDefaultCDHEntries (com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHEntries)3 StackType (com.sequenceiq.cloudbreak.cloud.model.component.StackType)3 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)3 ClusterComponent (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent)3 List (java.util.List)3 Map (java.util.Map)3 Collectors (java.util.stream.Collectors)3