Search in sources :

Example 46 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class NifiVolumeConfigProviderTest method testRoleConfigsWithFourVolumes.

@Test
void testRoleConfigsWithFourVolumes() {
    HostgroupView hostGroup = hostGroupWithVolumeCount(4);
    assertEquals(List.of(config("nifi.flowfile.repository.directory", "/hadoopfs/fs1/flowfile-repo"), config("nifi.content.repository.directory.default", "/hadoopfs/fs2/content-repo"), config("nifi.provenance.repository.directory.default", "/hadoopfs/fs3/provenance-repo"), config("log_dir", "/hadoopfs/fs4/nifi-log"), config("nifi.database.directory", "/hadoopfs/fs4/database-dir")), subject.getRoleConfigs(NifiRoles.NIFI_NODE, hostGroup, getTemplatePreparationObject(hostGroup)));
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 47 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class NifiVolumeConfigProviderTest method testRoleConfigsWithFourVolumesAndStackVersion7211.

@Test
void testRoleConfigsWithFourVolumesAndStackVersion7211() {
    when(cmTemplateProcessorMock.getStackVersion()).thenReturn("7.2.11");
    HostgroupView hostGroup = hostGroupWithVolumeCount(4);
    assertEquals(List.of(config("nifi.flowfile.repository.directory", "/hadoopfs/fs1/flowfile-repo"), config("nifi.content.repository.directory.default", "/hadoopfs/fs2/content-repo"), config("nifi.provenance.repository.directory.default", "/hadoopfs/fs3/provenance-repo"), config("log_dir", "/hadoopfs/fs4/nifi-log"), config("nifi.database.directory", "/hadoopfs/fs4/database-dir"), config("nifi.working.directory", "/hadoopfs/fs4/working-dir")), subject.getRoleConfigs(NifiRoles.NIFI_NODE, hostGroup, getTemplatePreparationObject(hostGroup)));
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 48 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method clonesBaseRoleConfigForHostGroups.

@Test
public void clonesBaseRoleConfigForHostGroups() {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    HostgroupView compute = new HostgroupView("compute", 3, InstanceGroupType.CORE, 2);
    setup("input/clouderamanager-3hg-same-DN-role.bp", Builder.builder().withHostgroupViews(Set.of(master, worker, compute)));
    underTest.process(templateProcessor, templatePreparator);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = mapRoleConfigs();
    assertNull(roleConfigs.get("hdfs-DATANODE-BASE"));
    assertEquals(List.of(config("dfs_data_dir_list", "/hadoopfs/fs1/datanode,/hadoopfs/fs2/datanode")), roleConfigs.get("hdfs-DATANODE-worker"));
    assertEquals(List.of(config("dfs_data_dir_list", "/hadoopfs/fs1/datanode,/hadoopfs/fs2/datanode,/hadoopfs/fs3/datanode")), roleConfigs.get("hdfs-DATANODE-compute"));
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 49 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method testGenerateConfigsWhenHdfsJournalNodeNull.

@Test
public void testGenerateConfigsWhenHdfsJournalNodeNull() {
    HostgroupView master1 = new HostgroupView("master1", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView master2 = new HostgroupView("master2", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    HostgroupView compute = new HostgroupView("compute", 3, InstanceGroupType.CORE, 2);
    HostgroupView quorum = new HostgroupView("quorum", 3, InstanceGroupType.CORE, 2);
    setup("input/cb5660.bp", Builder.builder().withHostgroupViews(Set.of(master1, master2, worker, compute, quorum)));
    Map<String, Map<String, List<ApiClusterTemplateConfig>>> actual = underTest.generateConfigs(templateProcessor, templatePreparator);
    assertNotNull(actual.get("hdfs-JOURNALNODE-BASE"));
    assertNotNull(actual.get("zookeeper-SERVER-BASE"));
}
Also used : ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 50 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method testProcessWhenSharedConfigThenAddVolumeConfig.

@Test
public void testProcessWhenSharedConfigThenAddVolumeConfig() {
    HostgroupView master1 = new HostgroupView("master1", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView master2 = new HostgroupView("master2", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    HostgroupView compute = new HostgroupView("compute", 3, InstanceGroupType.CORE, 2);
    HostgroupView quorum = new HostgroupView("quorum", 3, InstanceGroupType.CORE, 2);
    setup("input/cb5660.bp", Builder.builder().withHostgroupViews(Set.of(master1, master2, worker, compute, quorum)));
    underTest.process(templateProcessor, templatePreparator);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = mapRoleConfigs();
    List<ApiClusterTemplateConfig> journalNodeBase = roleConfigs.get("hdfs-JOURNALNODE-BASE");
    assertEquals(1, journalNodeBase.size());
    assertEquals("dfs_journalnode_edits_dir", journalNodeBase.get(0).getName());
    assertEquals("/hadoopfs/fs1/journalnode", journalNodeBase.get(0).getValue());
    List<ApiClusterTemplateConfig> zkServerBase = roleConfigs.get("zookeeper-SERVER-BASE");
    assertEquals("dataDir", zkServerBase.get(0).getName());
    assertEquals("/hadoopfs/fs1/zookeeper", zkServerBase.get(0).getValue());
    assertEquals("dataLogDir", zkServerBase.get(1).getName());
    assertEquals("/hadoopfs/fs1/zookeeper", zkServerBase.get(1).getValue());
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Aggregations

HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)122 Test (org.junit.jupiter.api.Test)63 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)39 ArrayList (java.util.ArrayList)34 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)26 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)25 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)23 List (java.util.List)23 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)23 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)19 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)19 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)18 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)18 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)16 DisplayName (org.junit.jupiter.api.DisplayName)16 MethodSource (org.junit.jupiter.params.provider.MethodSource)16 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)15 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)8 Map (java.util.Map)8 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)7