Search in sources :

Example 81 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class HbaseCloudStorageServiceConfigProviderTest method testGetHbaseServiceConfigsWhenNoStorageConfiguredWithAttachedCluster.

@Test
public void testGetHbaseServiceConfigsWhenNoStorageConfiguredWithAttachedCluster() {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(false, false);
    String inputJson = getBlueprintText("input/clouderamanager.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject);
    assertEquals(0, serviceConfigs.size());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 82 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class HbaseCloudStorageServiceConfigProviderTest method testGetHbaseStorageServiceConfigsWhenDataLake721.

@Test
public void testGetHbaseStorageServiceConfigsWhenDataLake721() {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(true, true, "7.2.1");
    String inputJson = getBlueprintText("input/clouderamanager.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject);
    assertEquals(1, serviceConfigs.size());
    assertEquals("hdfs_rootdir", serviceConfigs.get(0).getName());
    assertEquals("s3a://bucket/cluster1/hbase", serviceConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 83 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class CentralCmTemplateUpdaterTest method configsAreInjected.

@Test
public void configsAreInjected() {
    List<ApiClusterTemplateConfig> serviceConfigs = List.of(config("service_config_name", "service_config_value"));
    List<ApiClusterTemplateConfig> roleConfigs = List.of(config("role_config_name", "role_config_value"));
    ReflectionTestUtils.setField(cmTemplateConfigInjectorProcessor, "injectors", List.of(new CmTemplateConfigInjector() {

        @Override
        public List<ApiClusterTemplateConfig> getServiceConfigs(ApiClusterTemplateService service, TemplatePreparationObject source) {
            return serviceConfigs;
        }

        @Override
        public List<ApiClusterTemplateConfig> getRoleConfigs(ApiClusterTemplateRoleConfigGroup roleConfigGroup, ApiClusterTemplateService service, TemplatePreparationObject source) {
            return roleConfigs;
        }
    }));
    when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/namenode-ha.bp"));
    ApiClusterTemplate generated = testGetCmTemplate();
    assertMatchesBlueprintAtPath("output/namenode-ha-injected.bp", generated);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) ApiClusterTemplateRoleConfigGroup(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Example 84 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class RangerRoleConfigProvider method getRoleConfigs.

@Override
protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) {
    switch(roleType) {
        case RangerRoles.RANGER_ADMIN:
            String cmVersion = getCmVersion(source);
            List<ApiClusterTemplateConfig> configList = new ArrayList<>();
            // In CM 7.2.1 and above, the ranger database parameters have moved to the service
            // config (see above getServiceConfigs).
            RdsView rangerRdsView = getRdsView(source);
            if (!isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_1)) {
                addDbConfigs(rangerRdsView, configList, cmVersion);
            }
            addDbSslConfigsIfNeeded(rangerRdsView, configList, cmVersion);
            VirtualGroupRequest virtualGroupRequest = source.getVirtualGroupRequest();
            if (isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_0_1)) {
                String adminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.RANGER_ADMIN);
                configList.add(config(RANGER_DEFAULT_POLICY_GROUPS, adminGroup));
            }
            if (isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_6_0)) {
                String hbaseAdminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.HBASE_ADMIN);
                configList.add(config(RANGER_HBASE_ADMIN_VIRTUAL_GROUPS, hbaseAdminGroup));
            }
            return configList;
        default:
            return List.of();
    }
}
Also used : VirtualGroupRequest(com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest) RdsView(com.sequenceiq.cloudbreak.template.views.RdsView) ArrayList(java.util.ArrayList) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig)

Example 85 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class StreamsMessagingManagerServiceConfigProvider method getServiceConfigs.

@Override
public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
    final List<ApiClusterTemplateConfig> configList;
    String cdhVersion = source.getBlueprintView().getProcessor().getStackVersion() == null ? "" : source.getBlueprintView().getProcessor().getStackVersion();
    if (isVersionNewerOrEqualThanLimited(cdhVersion, CLOUDERAMANAGER_VERSION_7_2_0)) {
        RdsView smmRdsView = getRdsView(source);
        configList = List.of(config(DATABASE_TYPE, dataBaseTypeForCM(smmRdsView.getDatabaseVendor())), config(DATABASE_NAME, smmRdsView.getDatabaseName()), config(DATABASE_HOST, smmRdsView.getHost()), config(DATABASE_PORT, smmRdsView.getPort()), config(DATABASE_USER, smmRdsView.getConnectionUserName()), config(DATABASE_PASSWORD, smmRdsView.getConnectionPassword()));
    } else {
        String cmHost = source.getGeneralClusterConfigs().getPrimaryGatewayInstanceDiscoveryFQDN().orElse(source.getGeneralClusterConfigs().getClusterManagerIp());
        boolean ssl = source.getGeneralClusterConfigs().getAutoTlsEnabled();
        configList = Lists.newArrayList(config("cm.metrics.host", cmHost), config("cm.metrics.username", source.getGeneralClusterConfigs().getCloudbreakAmbariUser()), config("cm.metrics.password", source.getGeneralClusterConfigs().getCloudbreakAmbariPassword()), config("cm.metrics.protocol", ssl ? "https" : "http"), config("cm.metrics.port", ssl ? "7183" : "7180"));
    }
    return configList;
}
Also used : RdsView(com.sequenceiq.cloudbreak.template.views.RdsView) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig)

Aggregations

ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)172 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)129 Test (org.junit.Test)78 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)74 Test (org.junit.jupiter.api.Test)57 ArrayList (java.util.ArrayList)55 List (java.util.List)50 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)25 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)22 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)21 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)18 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)17 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)17 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)13 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)13 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)12 HashMap (java.util.HashMap)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)9 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)8