Search in sources :

Example 71 with ApiClusterTemplateConfig

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

the class HiveOnTezServiceConfigProviderTest method testGetHiveOnTezServiceConfigsWhenNoStorageConfigured.

@Test
public void testGetHiveOnTezServiceConfigsWhenNoStorageConfigured() {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(false);
    String inputJson = getBlueprintText("input/clouderamanager-ds.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) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 72 with ApiClusterTemplateConfig

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

the class HiveServer2ConfigProviderTest method testGetRoleConfigsWithSingleRolesPerHostGroup.

@Test
public void testGetRoleConfigsWithSingleRolesPerHostGroup() {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject();
    String inputJson = getBlueprintText("input/clouderamanager.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> hiveserver2 = roleConfigs.get("hive-HIVESERVER2-BASE");
    assertEquals(1, hiveserver2.size());
    assertEquals("hive_hs2_config_safety_valve", hiveserver2.get(0).getName());
    String expected = "<property><name>hive.server2.wm.namespace</name><value>" + preparationObject.getGeneralClusterConfigs().getUuid() + "</value></property>";
    assertEquals(expected, hiveserver2.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 73 with ApiClusterTemplateConfig

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

the class DasConfigProviderTest method getServiceConfigs.

@Test
public void getServiceConfigs() {
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setType(HIVE_DAS);
    rdsConfig.setConnectionURL(String.format("jdbc:%s://%s:%s/%s", DB_PROVIDER, HOST, PORT, DB_NAME));
    rdsConfig.setConnectionUserName(USER_NAME);
    rdsConfig.setConnectionPassword(PASSWORD);
    TemplatePreparationObject tpo = new Builder().withRdsConfigs(Set.of(rdsConfig)).build();
    List<ApiClusterTemplateConfig> result = underTest.getServiceConfigs(null, tpo);
    Map<String, String> paramToVariable = result.stream().collect(Collectors.toMap(ApiClusterTemplateConfig::getName, ApiClusterTemplateConfig::getValue));
    assertThat(paramToVariable).containsOnly(new SimpleEntry<>("data_analytics_studio_database_host", HOST), new SimpleEntry<>("data_analytics_studio_database_port", PORT), new SimpleEntry<>("data_analytics_studio_database_name", DB_NAME), new SimpleEntry<>("data_analytics_studio_database_username", USER_NAME), new SimpleEntry<>("data_analytics_studio_database_password", PASSWORD));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 74 with ApiClusterTemplateConfig

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

the class FlinkCloudStorageConfigProviderTest method testGetFlinkCloudStorageServiceConfigs.

@Test
public void testGetFlinkCloudStorageServiceConfigs() {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(true);
    String inputJson = getBlueprintText("input/flink.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject);
    Map<String, String> actual = serviceConfigs.stream().collect(Collectors.toMap(ApiClusterTemplateConfig::getName, ApiClusterTemplateConfig::getValue));
    Map<String, String> expectedServiceConfigs = Map.of(JOBMANAGER_ARCHIVE_FS_DIR_NAME, JOBMANAGER_ARCHIVE_FS_DIR_VALUE, STATE_CHECKPOINTS_DIR_NAME, STATE_CHECKPOINTS_DIR_VALUE, STATE_SAVEPOINTS_DIR_NAME, STATE_SAVEPOINTS_DIR_VALUE, HIGH_AVAILABILITY_STORAGE_DIR_NAME, HIGH_AVAILABILITY_STORAGE_DIR_VALUE);
    assertEquals(expectedServiceConfigs, actual);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 75 with ApiClusterTemplateConfig

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

the class FlinkCloudStorageConfigProviderTest method testGetFlinkCloudStorageServiceConfigsWhenNoCloudStorageProvided.

@Test
public void testGetFlinkCloudStorageServiceConfigsWhenNoCloudStorageProvided() {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(false);
    String inputJson = getBlueprintText("input/flink.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) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

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