use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class CmTemplateProcessorTest method testIfCustomRoleConfigsMapIsRetrievedCorrectly.
@Test
void testIfCustomRoleConfigsMapIsRetrievedCorrectly() {
underTest = new CmTemplateProcessor(getBlueprintText("input/de-ha.bp"));
Map<String, List<ApiClusterTemplateRoleConfigGroup>> expectedMap = new HashMap<>();
Set<CustomConfigurationPropertyView> configs = Set.of(new CustomConfigurationPropertyView("property3", "value3", "role3", "service2"), new CustomConfigurationPropertyView("property2", "value2", "role2", "service1"), new CustomConfigurationPropertyView("property4", "value4", null, "service1"));
expectedMap.put("service2", List.of(new ApiClusterTemplateRoleConfigGroup().roleType("role3").addConfigsItem(new ApiClusterTemplateConfig().name("property3").value("value3"))));
expectedMap.put("service1", List.of(new ApiClusterTemplateRoleConfigGroup().roleType("role2").addConfigsItem(new ApiClusterTemplateConfig().name("property2").value("value2"))));
assertEquals(expectedMap, underTest.getCustomRoleConfigsMap(configs));
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class HbaseVolumeConfigProviderTest method getRoleConfigsWithMultipleEphemeralVolumes.
@Test
void getRoleConfigsWithMultipleEphemeralVolumes() {
HostgroupView worker = hostGroupWithVolumeTemplatesAndTemporaryStorage(2, Sets.newHashSet(new VolumeTemplate()), TemporaryStorage.EPHEMERAL_VOLUMES, 3);
List<ApiClusterTemplateConfig> roleConfigs = underTest.getRoleConfigs(HbaseRoles.REGIONSERVER, worker, preparatorWithHostGroups(worker));
assertEquals(List.of(config("hbase_bucketcache_ioengine", "file:/hadoopfs/ephfs1/hbase_cache")), roleConfigs);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig 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());
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig 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());
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.
the class HiveKnoxConfigProviderTest method testGetServiceConfigs.
private void testGetServiceConfigs(Iterable<String> versions, Iterable<ApiClusterTemplateConfig> expectedConfigs) {
for (String version : versions) {
when(cmTemplateProcessor.getVersion()).thenReturn(Optional.ofNullable(version));
TemplatePreparationObject tpo = createTemplatePreparationObject();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, tpo);
assertThat(serviceConfigs).as("Expected configs for cdh version: %s", version).hasSameElementsAs(expectedConfigs);
}
}
Aggregations