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;
}
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");
}
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);
}
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);
}
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);
}
Aggregations