use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class CmTemplateProcessorTest method addExistingServiceConfigs.
@Test
public void addExistingServiceConfigs() {
underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager-existing-conf.bp"));
List<ApiClusterTemplateConfig> configs = new ArrayList<>();
configs.add(new ApiClusterTemplateConfig().name("redaction_policy_enabled").value("true"));
configs.add(new ApiClusterTemplateConfig().name("not_present_in_template").value("some_value"));
underTest.addServiceConfigs("HDFS", List.of("NAMENODE"), configs);
ApiClusterTemplateService service = underTest.getTemplate().getServices().stream().filter(srv -> "HDFS".equals(srv.getServiceType())).findAny().get();
List<ApiClusterTemplateConfig> serviceConfigs = service.getServiceConfigs();
assertEquals(2, serviceConfigs.size());
assertEquals("redaction_policy_enabled", serviceConfigs.get(0).getName());
assertEquals("false", serviceConfigs.get(0).getValue());
assertEquals(configs.get(1), serviceConfigs.get(1));
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class HiveMetastoreConfigProviderTest method initHmsServiceConfigs.
private void initHmsServiceConfigs(List<ApiClusterTemplateConfig> serviceConfigs) {
ApiClusterTemplateService service = new ApiClusterTemplateService();
service.setServiceConfigs(serviceConfigs);
when(templateProcessor.getServiceByType(HiveRoles.HIVE)).thenReturn(Optional.of(service));
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProviderTest method testGetAdditionalServicesWhenKnoxRequestedAndBlueprintDoesNoContainKnoxWithMultiGateway.
@Test
public void testGetAdditionalServicesWhenKnoxRequestedAndBlueprintDoesNoContainKnoxWithMultiGateway() {
HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
HostgroupView master2 = new HostgroupView("master2", 1, InstanceGroupType.GATEWAY, 1);
HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
Gateway gateway = new Gateway();
TemplatePreparationObject preparationObject = Builder.builder().withHostgroupViews(Set.of(master, master2, worker)).withGateway(gateway, "key", new HashSet<>()).build();
String inputJson = getBlueprintText("input/clouderamanager.bp");
CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
Map<String, ApiClusterTemplateService> additionalServices = underTest.getAdditionalServices(cmTemplateProcessor, preparationObject);
ApiClusterTemplateService knox1 = additionalServices.get("master");
ApiClusterTemplateService knox2 = additionalServices.get("master2");
assertEquals(2, additionalServices.size());
assertNotNull(knox1);
assertNotNull(knox2);
assertEquals("KNOX", knox1.getServiceType());
assertEquals("KNOX", knox2.getServiceType());
assertEquals("knox", knox1.getRefName());
assertEquals("knox", knox2.getRefName());
ApiClusterTemplateRoleConfigGroup roleConfigGroup1 = knox1.getRoleConfigGroups().get(0);
ApiClusterTemplateRoleConfigGroup roleConfigGroup2 = knox1.getRoleConfigGroups().get(0);
assertEquals("KNOX_GATEWAY", roleConfigGroup1.getRoleType());
assertTrue(roleConfigGroup1.getBase());
assertEquals("KNOX_GATEWAY", roleConfigGroup2.getRoleType());
assertTrue(roleConfigGroup2.getBase());
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProviderTest method testGetAdditionalServicesWhenKnoxRequestedAndBlueprintContainsIt.
@Test
public void testGetAdditionalServicesWhenKnoxRequestedAndBlueprintContainsIt() {
HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
Gateway gateway = new Gateway();
TemplatePreparationObject preparationObject = Builder.builder().withHostgroupViews(Set.of(master, worker)).withGateway(gateway, "key", new HashSet<>()).build();
String inputJson = getBlueprintText("input/clouderamanager-knox.bp");
CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
Map<String, ApiClusterTemplateService> additionalServices = underTest.getAdditionalServices(cmTemplateProcessor, preparationObject);
assertTrue(additionalServices.isEmpty());
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class DeclaredVersionService method collectDeclaredVersions.
public SupportedServices collectDeclaredVersions(String blueprintText) {
SupportedServices supportedServices = new SupportedServices();
Set<SupportedService> services = new HashSet<>();
CmTemplateProcessor cmTemplateProcessor = cmTemplateProcessorFactory.get(blueprintText);
String cdhVersion = cmTemplateProcessor.getTemplate().getCdhVersion();
StackVersion stackVersion = new StackVersion();
stackVersion.setVersion(cdhVersion);
stackVersion.setStackType("CDH");
Set<CdhService> cdhServices = cmTemplateGeneratorConfigurationResolver.cdhConfigurations().get(stackVersion);
if (cdhServices == null) {
cdhServices = fallbackForDefault();
}
for (ApiClusterTemplateService service : cmTemplateProcessor.getTemplate().getServices()) {
SupportedService supportedService = new SupportedService();
supportedService.setName(service.getServiceType());
for (CdhService cdhService : cdhServices) {
if (cdhService.getName().equals(service.getServiceType())) {
supportedService.setVersion(cdhService.getVersion());
}
}
for (ServiceConfig serviceConfig : cmTemplateGeneratorConfigurationResolver.serviceConfigs()) {
if (serviceConfig.getName().equals(service.getServiceType())) {
supportedService.setDisplayName(serviceConfig.getDisplayName());
supportedService.setComponentNameInParcel(serviceConfig.getComponentNameInParcel());
}
}
if (!Strings.isNullOrEmpty(supportedService.getDisplayName()) && !Strings.isNullOrEmpty(supportedService.getVersion())) {
services.add(supportedService);
}
}
supportedServices.setServices(services);
return supportedServices;
}
Aggregations