Search in sources :

Example 41 with CmTemplateProcessor

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

the class UpdateNodeCountValidatorTest method setupMocksForStopStartInstanceGroupValidation.

private void setupMocksForStopStartInstanceGroupValidation(Stack stack) {
    CmTemplateProcessor cmTemplateProcessor = mock(CmTemplateProcessor.class);
    Cluster cluster = mock(Cluster.class);
    Blueprint blueprint = mock(Blueprint.class);
    when(stack.getCluster()).thenReturn(cluster);
    when(cluster.getBlueprint()).thenReturn(blueprint);
    when(blueprint.getBlueprintText()).thenReturn(TEST_BLUEPRINT_TEXT);
    when(cmTemplateProcessorFactory.get(anyString())).thenReturn(cmTemplateProcessor);
    when(cmTemplateProcessor.getComputeHostGroups(any())).thenReturn(Set.of(TEST_COMPUTE_GROUP));
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Example 42 with CmTemplateProcessor

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

the class CmCloudStorageConfigDetailsTest method prepareBlueprintProcessorFactoryMock.

private void prepareBlueprintProcessorFactoryMock(Map<String, Set<String>> entries) {
    CmTemplateProcessor cmTemplateProcessor = mock(CmTemplateProcessor.class);
    when(cmTemplateProcessor.getComponentsByHostGroup()).thenReturn(entries);
    when(cmTemplateProcessorFactory.get(anyString())).thenReturn(cmTemplateProcessor);
}
Also used : CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)

Example 43 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor 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 44 with CmTemplateProcessor

use of com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor 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)

Example 45 with CmTemplateProcessor

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

the class HiveLLAPServiceConfigProviderTest method testGetHiveLlapServiceConfigsWhenNoStorageConfigured.

@Test
public void testGetHiveLlapServiceConfigsWhenNoStorageConfigured() {
    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)

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