Search in sources :

Example 31 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class OozieRoleConfigProviderTest method testGetRoleConfigsWithOozieHA.

@Test
public void testGetRoleConfigsWithOozieHA() {
    String inputJson = getBlueprintText("input/de-ha.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(inputJson, cmTemplateProcessor, 2);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> oozieServer = roleConfigs.get("oozie-OOZIE_SERVER-BASE");
    assertEquals(5, oozieServer.size());
    assertEquals("oozie_database_host", oozieServer.get(0).getName());
    assertEquals("testhost", oozieServer.get(0).getValue());
    assertEquals("oozie_database_name", oozieServer.get(1).getName());
    assertEquals("ooziedb", oozieServer.get(1).getValue());
    assertEquals("oozie_database_type", oozieServer.get(2).getName());
    assertEquals("postgresql", oozieServer.get(2).getValue());
    assertEquals("oozie_database_user", oozieServer.get(3).getName());
    assertEquals("testuser", oozieServer.get(3).getValue());
    assertEquals("oozie_database_password", oozieServer.get(4).getName());
    assertEquals("testpassword", oozieServer.get(4).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArrayList(java.util.ArrayList) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 32 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class SchemaRegistryJarStorageConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(HostgroupView hostGroup) {
    String inputJson = FileReaderUtils.readFileFromClasspathQuietly("input/kafka.bp");
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withHostgroupViews(Set.of(hostGroup)).withBlueprintView(new BlueprintView(inputJson, "CDP", "1.0", new CmTemplateProcessor(inputJson))).build();
    return preparationObject;
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Example 33 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class SchemaRegistryServiceConfigProviderTest method testGetSchemaRegistryRoleConfigs710.

@Test
public void testGetSchemaRegistryRoleConfigs710() {
    String inputJson = loadBlueprint("7.1.0");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(cmTemplateProcessor);
    List<ApiClusterTemplateConfig> roleConfigs = underTest.getRoleConfigs(SchemaRegistryRoles.SCHEMA_REGISTRY_SERVER, preparationObject);
    assertThat(roleConfigs).hasSameElementsAs(List.of(config("schema.registry.storage.connector.connectURI", "jdbc:postgresql://testhost:5432/schema_registry"), config("schema.registry.storage.connector.user", "schema_registry_server"), config("schema.registry.storage.connector.password", "schema_registry_server_password")));
}
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 34 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class StreamsMessagingManagerServiceConfigProviderTest method testGetStreamsMessagingManagerServerConfigs.

@Test
public void testGetStreamsMessagingManagerServerConfigs() {
    String inputJson = getBlueprintText("input/cdp-streaming.bp").replace("__CDH_VERSION__", "7.2.0");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(null, false, cmTemplateProcessor);
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject);
    assertThat(serviceConfigs).hasSameElementsAs(List.of(config(DATABASE_TYPE, "postgresql"), config(DATABASE_NAME, "smm"), config(DATABASE_HOST, "testhost"), config(DATABASE_PORT, "5432"), config(DATABASE_USER, "smm_server"), config(DATABASE_PASSWORD, "smm_server_db_password")));
}
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 35 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor in project cloudbreak by hortonworks.

the class Spark3OnYarnRoleConfigProviderTest method validateClientConfig.

protected void validateClientConfig(String hmsExternalDirLocation, String clientConfigDirLocation) {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(hmsExternalDirLocation);
    String inputJson = getBlueprintText("input/clouderamanager-ds.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> sparkOnYarnConfigs = roleConfigs.get("spark3_on_yarn-GATEWAY-BASE");
    assertEquals(1, sparkOnYarnConfigs.size());
    assertEquals("spark3-conf/spark-defaults.conf_client_config_safety_valve", sparkOnYarnConfigs.get(0).getName());
    assertEquals("spark.kerberos.access.hadoopFileSystems=" + clientConfigDirLocation, sparkOnYarnConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArrayList(java.util.ArrayList) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig)

Aggregations

CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)149 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)115 Test (org.junit.Test)84 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)75 List (java.util.List)46 ArrayList (java.util.ArrayList)33 Test (org.junit.jupiter.api.Test)19 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)18 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)15 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)13 HashSet (java.util.HashSet)12 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)10 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)10 Set (java.util.Set)10 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)9 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)8 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)8 Map (java.util.Map)8 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)7 Collectors (java.util.stream.Collectors)7