Search in sources :

Example 31 with ClouderaManagerRepo

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

the class DefaultClouderaManagerRepoServiceTest method testDefaultRepoWithCDHWhichExists.

@Test
public void testDefaultRepoWithCDHWhichExists() throws Exception {
    ClouderaManagerRepo repo = defaultClouderaManagerRepoService.getDefault("redhat7", CDH, "6.1.0", null);
    assertEquals("6.1.0", repo.getVersion());
    assertEquals("http://redhat7-base/6.1.0", repo.getBaseUrl());
    assertEquals("http://redhat7-gpg/6.1.0", repo.getGpgKeyUrl());
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Test(org.junit.Test)

Example 32 with ClouderaManagerRepo

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

the class DefaultClouderaManagerRepoServiceTest method testDefaultRepoWithStackTypeWhichDoesNotExists.

@Test
public void testDefaultRepoWithStackTypeWhichDoesNotExists() throws Exception {
    ClouderaManagerRepo repo = defaultClouderaManagerRepoService.getDefault("redhat7", "NA", "6.1.0", null);
    assertNull(repo);
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Test(org.junit.Test)

Example 33 with ClouderaManagerRepo

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

the class DefaultClouderaManagerRepoServiceTest method testDefaultRepoWithCDHWhichDoesNotExists.

@Test
public void testDefaultRepoWithCDHWhichDoesNotExists() throws Exception {
    ClouderaManagerRepo repo = defaultClouderaManagerRepoService.getDefault("redhat7", CDH, "2.6", null);
    assertNull(repo);
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Test(org.junit.Test)

Example 34 with ClouderaManagerRepo

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

the class CmTemplateProcessorTest method testAddInstantiatorWithBaseRoles.

@Test
public void testAddInstantiatorWithBaseRoles() {
    underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager.bp"));
    ClouderaManagerRepo clouderaManagerRepoDetails = new ClouderaManagerRepo();
    clouderaManagerRepoDetails.setVersion(CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_6_3_0.getVersion());
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setClusterName("cluster");
    TemplatePreparationObject.Builder tpoBuilder = new TemplatePreparationObject.Builder().withGeneralClusterConfigs(generalClusterConfigs);
    TemplatePreparationObject templatePreparationObject = tpoBuilder.build();
    underTest.addInstantiator(clouderaManagerRepoDetails, templatePreparationObject, "dszabo-sdx");
    ApiClusterTemplateInstantiator instantiator = underTest.getTemplate().getInstantiator();
    List<ApiClusterTemplateRoleConfigGroupInfo> roleConfigGroups = instantiator.getRoleConfigGroups();
    List<String> refNames = roleConfigGroups.stream().map(ApiClusterTemplateRoleConfigGroupInfo::getRcgRefName).collect(Collectors.toList());
    assertEquals(2, refNames.size());
    assertTrue(refNames.containsAll(List.of("yarn-NODEMANAGER-BASE", "hdfs-DATANODE-BASE")));
    assertEquals("cluster", instantiator.getClusterName());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ApiClusterTemplateInstantiator(com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator) ApiClusterTemplateRoleConfigGroupInfo(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroupInfo) Test(org.junit.jupiter.api.Test)

Example 35 with ClouderaManagerRepo

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

the class CmTemplateProcessor method addInstantiator.

public void addInstantiator(ClouderaManagerRepo clouderaManagerRepoDetails, TemplatePreparationObject templatePreparationObject, String sdxContextName) {
    ApiClusterTemplateInstantiator instantiator = ofNullable(cmTemplate.getInstantiator()).orElseGet(ApiClusterTemplateInstantiator::new);
    if (instantiator.getClusterName() == null) {
        instantiator.setClusterName(templatePreparationObject.getGeneralClusterConfigs().getClusterName());
    }
    addCmVersionDependantConfigs(clouderaManagerRepoDetails, templatePreparationObject, instantiator);
    for (ApiClusterTemplateService service : ofNullable(cmTemplate.getServices()).orElse(List.of())) {
        List<String> nonBaseRefs = ofNullable(service.getRoleConfigGroups()).orElse(List.of()).stream().filter(rcg -> rcg.getBase() == null || !rcg.getBase()).map(ApiClusterTemplateRoleConfigGroup::getRefName).collect(Collectors.toList());
        for (String nonBaseRef : nonBaseRefs) {
            instantiator.addRoleConfigGroupsItem(new ApiClusterTemplateRoleConfigGroupInfo().rcgRefName(nonBaseRef));
        }
    }
    ofNullable(sdxContextName).map(name -> List.of(new ApiDataContextRef().name(name))).map(apiDataContextRefs -> new ApiClusterTemplateClusterSpec().dataContextRefs(apiDataContextRefs)).ifPresent(instantiator::clusterSpec);
    cmTemplate.setInstantiator(instantiator);
}
Also used : InstanceCount(com.sequenceiq.cloudbreak.cloud.model.InstanceCount) InstanceCount.atLeast(com.sequenceiq.cloudbreak.cloud.model.InstanceCount.atLeast) LoggerFactory(org.slf4j.LoggerFactory) JsonUtil(com.sequenceiq.cloudbreak.common.json.JsonUtil) BigDecimal(java.math.BigDecimal) Collectors.toMap(java.util.stream.Collectors.toMap) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) ApiClusterTemplateRoleConfigGroup(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup) ApiConfigureForKerberosArguments(com.cloudera.api.swagger.model.ApiConfigureForKerberosArguments) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) Collectors.toSet(java.util.stream.Collectors.toSet) ApiClusterTemplateRoleConfigGroupInfo(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroupInfo) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) ClusterHostAttributes(com.sequenceiq.cloudbreak.cluster.model.ClusterHostAttributes) Versioned(com.sequenceiq.cloudbreak.common.type.Versioned) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Set(java.util.Set) ApiClusterTemplateHostTemplate(com.cloudera.api.swagger.model.ApiClusterTemplateHostTemplate) BlueprintTextProcessor(com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor) Collectors(java.util.stream.Collectors) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Objects(java.util.Objects) ServiceComponent(com.sequenceiq.cloudbreak.template.model.ServiceComponent) List(java.util.List) ApiEntityTag(com.cloudera.api.swagger.model.ApiEntityTag) YarnConstants(com.sequenceiq.cloudbreak.cmtemplate.configproviders.yarn.YarnConstants) ApiClusterTemplateHostInfo(com.cloudera.api.swagger.model.ApiClusterTemplateHostInfo) CollectionUtils(org.springframework.util.CollectionUtils) ApiProductVersion(com.cloudera.api.swagger.model.ApiProductVersion) ResizeRecommendation(com.sequenceiq.cloudbreak.cloud.model.ResizeRecommendation) Entry(java.util.Map.Entry) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Optional(java.util.Optional) ApiClusterTemplateClusterSpec(com.cloudera.api.swagger.model.ApiClusterTemplateClusterSpec) ApiClusterTemplateVariable(com.cloudera.api.swagger.model.ApiClusterTemplateVariable) CMRepositoryVersionUtil.isTagsResourceSupportedViaBlueprint(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isTagsResourceSupportedViaBlueprint) NotImplementedException(org.apache.commons.lang3.NotImplementedException) ApiDataContextRef(com.cloudera.api.swagger.model.ApiDataContextRef) SiteConfigurations(com.sequenceiq.cloudbreak.template.processor.configuration.SiteConfigurations) HashMap(java.util.HashMap) ServiceAttributes(com.sequenceiq.cloudbreak.template.model.ServiceAttributes) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Enums(com.google.common.base.Enums) HashSet(java.util.HashSet) Strings(com.google.common.base.Strings) ClusterManagerType(com.sequenceiq.cloudbreak.common.type.ClusterManagerType) ApiClusterTemplateInstantiator(com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator) CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited(com.sequenceiq.cloudbreak.cmtemplate.CMRepositoryVersionUtil.isVersionNewerOrEqualThanLimited) GatewayRecommendation(com.sequenceiq.cloudbreak.cloud.model.GatewayRecommendation) BlueprintProcessingException(com.sequenceiq.cloudbreak.template.BlueprintProcessingException) Entitlement(com.sequenceiq.cloudbreak.auth.altus.model.Entitlement) YarnRoles(com.sequenceiq.cloudbreak.cmtemplate.configproviders.yarn.YarnRoles) Nonnull(javax.annotation.Nonnull) InstanceCount.exactly(com.sequenceiq.cloudbreak.cloud.model.InstanceCount.exactly) CustomConfigurationPropertyView(com.sequenceiq.cloudbreak.template.views.CustomConfigurationPropertyView) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) AutoscaleRecommendation(com.sequenceiq.cloudbreak.cloud.model.AutoscaleRecommendation) Optional.ofNullable(java.util.Optional.ofNullable) HostgroupConfigurations(com.sequenceiq.cloudbreak.template.processor.configuration.HostgroupConfigurations) IOException(java.io.IOException) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) TreeMap(java.util.TreeMap) StackType(com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Collections(java.util.Collections) ApiDataContextRef(com.cloudera.api.swagger.model.ApiDataContextRef) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) ApiClusterTemplateInstantiator(com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator) ApiClusterTemplateRoleConfigGroupInfo(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroupInfo) ApiClusterTemplateClusterSpec(com.cloudera.api.swagger.model.ApiClusterTemplateClusterSpec)

Aggregations

ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)96 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)40 Test (org.junit.jupiter.api.Test)38 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)28 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)17 ApiClient (com.cloudera.api.swagger.client.ApiClient)15 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)15 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)15 Test (org.junit.Test)15 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)14 DisplayName (org.junit.jupiter.api.DisplayName)14 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)13 MethodSource (org.junit.jupiter.params.provider.MethodSource)13 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)12 Map (java.util.Map)10 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)9 BigDecimal (java.math.BigDecimal)9 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)8