Search in sources :

Example 11 with ApiClusterTemplate

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

the class ClouderaManagerShowBlueprintTest method checkValidFutureClouderaManagerTemplate.

private StackTestDto checkValidFutureClouderaManagerTemplate(TestContext testContext, StackTestDto stackTestDto, CloudbreakClient cloudbreakClient) {
    String extendedBlueprintText = stackTestDto.getGeneratedBlueprint().getBlueprintText();
    ApiClusterTemplate cmTemplate = parseCmTemplate(extendedBlueprintText);
    checkHostNumberNullOrZero(cmTemplate);
    return stackTestDto;
}
Also used : ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate)

Example 12 with ApiClusterTemplate

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

the class CmTemplateProcessorTest method addHostsTest.

@Test
void addHostsTest() {
    Map<String, List<Map<String, String>>> hostGroupMappings = Map.ofEntries(entry("hostGroup1", List.of()), entry("hostGroup2", List.of(hostAttributes("host2_1", false, null), hostAttributes("host2_2", true, null))), entry("hostGroup3", List.of(hostAttributes("host3_1", true, ""), hostAttributes("host3_2", true, "/rack3_2"))));
    underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager.bp"));
    ApiClusterTemplate template = underTest.getTemplate();
    ApiClusterTemplateInstantiator instantiator = new ApiClusterTemplateInstantiator();
    template.setInstantiator(instantiator);
    underTest.addHosts(hostGroupMappings);
    List<ApiClusterTemplateHostInfo> hosts = instantiator.getHosts();
    assertThat(hosts).hasSize(4);
    verifyHostInfo(hosts, "hostGroup2", "host2_1", null);
    verifyHostInfo(hosts, "hostGroup2", "host2_2", null);
    verifyHostInfo(hosts, "hostGroup3", "host3_1", null);
    verifyHostInfo(hosts, "hostGroup3", "host3_2", "/rack3_2");
}
Also used : ApiClusterTemplateHostInfo(com.cloudera.api.swagger.model.ApiClusterTemplateHostInfo) ApiClusterTemplateInstantiator(com.cloudera.api.swagger.model.ApiClusterTemplateInstantiator) ArrayList(java.util.ArrayList) List(java.util.List) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.jupiter.api.Test)

Example 13 with ApiClusterTemplate

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

the class CentralCmTemplateUpdaterTest method customConfigsAreInjected.

@Test
public void customConfigsAreInjected() {
    when(customConfigurationsView.getConfigurations()).thenReturn(Set.of(new CustomConfigurationPropertyView("service_config_name", "service_config_value", null, "zookeeper"), new CustomConfigurationPropertyView("service_config_name", "service_config_value", null, "hdfs"), new CustomConfigurationPropertyView("role_config_name", "role_config_value", "server", "zookeeper"), new CustomConfigurationPropertyView("role_config_name", "role_config_value", "namenode", "hdfs"), new CustomConfigurationPropertyView("role_config_name", "role_config_value", "datanode", "hdfs"), new CustomConfigurationPropertyView("role_config_name", "role_config_value", "journalnode", "hdfs"), new CustomConfigurationPropertyView("role_config_name", "role_config_value", "failovercontroller", "hdfs"), new CustomConfigurationPropertyView("role_config_name", "role_config_value", "balancer", "hdfs")));
    when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/namenode-ha.bp"));
    ApiClusterTemplate generated = testGetCmTemplate();
    assertMatchesBlueprintAtPath("output/namenode-ha-injected.bp", generated);
}
Also used : CustomConfigurationPropertyView(com.sequenceiq.cloudbreak.template.views.CustomConfigurationPropertyView) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Example 14 with ApiClusterTemplate

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

the class CentralCmTemplateUpdaterTest method getCmTemplateIfCoresettingspresentedShouldNotOverrideThePropertyWithEmptyString.

@Test
public void getCmTemplateIfCoresettingspresentedShouldNotOverrideThePropertyWithEmptyString() {
    List<StorageLocationView> locations = new ArrayList<>();
    StorageLocation hbaseRootDir = new StorageLocation();
    hbaseRootDir.setProperty("hbase.rootdir");
    hbaseRootDir.setValue("s3a://bucket/cluster1/hbase");
    locations.add(new StorageLocationView(hbaseRootDir));
    StorageLocation coresettings = new StorageLocation();
    coresettings.setProperty("core_defaultfs");
    coresettings.setValue("s3a://bucket/cluster1/hbase");
    locations.add(new StorageLocationView(coresettings));
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(Optional.of(fileSystemConfigurationsView));
    when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/core-settings-empty.bp"));
    ApiClusterTemplate generated = testGetCmTemplate();
    assertMatchesBlueprintAtPath("output/core-settings-empty.bp", generated);
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) ArrayList(java.util.ArrayList) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Example 15 with ApiClusterTemplate

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

the class CentralCmTemplateUpdaterTest method getCmTemplateIfCoresettingspresentedShouldNotOverrideTheProperty.

@Test
public void getCmTemplateIfCoresettingspresentedShouldNotOverrideTheProperty() {
    List<StorageLocationView> locations = new ArrayList<>();
    StorageLocation hbaseRootDir = new StorageLocation();
    hbaseRootDir.setProperty("hbase.rootdir");
    hbaseRootDir.setValue("s3a://bucket/cluster1/hbase");
    locations.add(new StorageLocationView(hbaseRootDir));
    StorageLocation coresettings = new StorageLocation();
    coresettings.setProperty("core_defaultfs");
    coresettings.setValue("s3a://bucket/cluster1/hbase");
    locations.add(new StorageLocationView(coresettings));
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(Optional.of(fileSystemConfigurationsView));
    when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/core-settings.bp"));
    ApiClusterTemplate generated = testGetCmTemplate();
    assertMatchesBlueprintAtPath("output/core-settings.bp", generated);
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) ArrayList(java.util.ArrayList) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem) ApiClusterTemplate(com.cloudera.api.swagger.model.ApiClusterTemplate) Test(org.junit.Test)

Aggregations

ApiClusterTemplate (com.cloudera.api.swagger.model.ApiClusterTemplate)15 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)3 ApiException (com.cloudera.api.swagger.client.ApiException)2 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)2 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)2 ClusterClientInitException (com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException)2 ClouderaManagerClientInitException (com.sequenceiq.cloudbreak.cm.client.ClouderaManagerClientInitException)2 CloudStorageConfigurationFailedException (com.sequenceiq.cloudbreak.cm.exception.CloudStorageConfigurationFailedException)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)2 StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)2 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)2 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)2 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)2 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)2 IOException (java.io.IOException)2 List (java.util.List)2 ClouderaManagerResourceApi (com.cloudera.api.swagger.ClouderaManagerResourceApi)1