Search in sources :

Example 86 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenClusterHasEmptyRdsConfigNamesThenEmptyRdsConfigShouldBeStored.

@Test
public void testConvertWhenClusterHasEmptyRdsConfigNamesThenEmptyRdsConfigShouldBeStored() {
    when(cluster.getDatabases()).thenReturn(Collections.emptySet());
    TemplatePreparationObject result = underTest.convert(source);
    assertTrue(result.getRdsConfigs().isEmpty());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Test(org.junit.Test)

Example 87 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject 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 88 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class CmTemplateProcessorTest method addInstantiatorKeepsCustomClusterName.

@Test
public void addInstantiatorKeepsCustomClusterName() {
    underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager-custom_cluster_name.bp"));
    GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
    generalClusterConfigs.setClusterName("cluster");
    TemplatePreparationObject templatePreparationObject = new TemplatePreparationObject.Builder().withGeneralClusterConfigs(generalClusterConfigs).build();
    underTest.addInstantiator(null, templatePreparationObject, null);
    ApiClusterTemplateInstantiator instantiator = underTest.getTemplate().getInstantiator();
    assertEquals("kusztom", instantiator.getClusterName());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ApiClusterTemplateInstantiator(com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator) Test(org.junit.jupiter.api.Test)

Example 89 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class HdfsConfigProviderTest method testGetHdfsServiceConfigsWithoutS3Guard.

@Test
public void testGetHdfsServiceConfigsWithoutS3Guard() {
    doNothing().when(s3ConfigProvider).getServiceConfigs(any(TemplatePreparationObject.class), any(StringBuilder.class));
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(false, 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) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 90 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class HdfsRoleConfigProviderTest method nameNodeHA.

@Test
void nameNodeHA() {
    HostgroupView gateway = new HostgroupView("gateway", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.CORE, 2);
    HostgroupView quorum = new HostgroupView("quorum", 0, InstanceGroupType.CORE, 3);
    HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, 3);
    String inputJson = FileReaderUtils.readFileFromClasspathQuietly("input/namenode-ha.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withHostgroupViews(Set.of(gateway, master, quorum, worker)).withBlueprintView(new BlueprintView(inputJson, "CDP", "1.0", cmTemplateProcessor)).build();
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = subject.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> namenodeConfigs = roleConfigs.get("hdfs-NAMENODE-BASE");
    Map<String, ApiClusterTemplateConfig> configMap = cmTemplateProcessor.mapByName(namenodeConfigs);
    assertEquals(NN_HA_PROPERTIES, configMap.keySet());
    assertEquals("true", configMap.get("autofailover_enabled").getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Aggregations

TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)266 Test (org.junit.Test)133 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)127 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)116 Test (org.junit.jupiter.api.Test)87 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)53 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)48 List (java.util.List)45 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)40 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)38 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)36 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)35 ArrayList (java.util.ArrayList)34 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)32 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)27 MethodSource (org.junit.jupiter.params.provider.MethodSource)23 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)20 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)17 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)16 DisplayName (org.junit.jupiter.api.DisplayName)16