use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class RangerRazDatalakeConfigProviderTest method getAdditionalServicesWhenRazIsEnabledWithCm720.
@ParameterizedTest(name = "{0}")
@MethodSource("razCloudPlatformDataProvider")
@DisplayName("CM 7.2.0 DL is used and Raz is requested, no additional service needs to be added to the template")
void getAdditionalServicesWhenRazIsEnabledWithCm720(String testCaseName, CloudPlatform cloudPlatform) {
ClouderaManagerRepo cmRepo = new ClouderaManagerRepo();
cmRepo.setVersion("7.2.0");
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setEnableRangerRaz(true);
HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.GATEWAY, List.of());
HostgroupView idbroker = new HostgroupView("idbroker", 0, InstanceGroupType.CORE, List.of());
TemplatePreparationObject preparationObject = Builder.builder().withStackType(StackType.DATALAKE).withCloudPlatform(cloudPlatform).withProductDetails(cmRepo, List.of()).withGeneralClusterConfigs(generalClusterConfigs).withHostgroupViews(Set.of(master, idbroker)).build();
Map<String, ApiClusterTemplateService> additionalServices = configProvider.getAdditionalServices(cmTemplateProcessor, preparationObject);
assertEquals(0, additionalServices.size());
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class RangerRazDatalakeConfigProviderTest method getAdditionalServicesWhenRazIsEnabledAndDataHub.
@ParameterizedTest(name = "{0}")
@MethodSource("razCloudPlatformDataProvider")
@DisplayName("CM 7.2.0 DL is used and Raz is requested, but Data Hub, no additional service needs to be added to the template")
void getAdditionalServicesWhenRazIsEnabledAndDataHub(String testCaseName, CloudPlatform cloudPlatform) {
ClouderaManagerRepo cmRepo = new ClouderaManagerRepo();
cmRepo.setVersion("7.2.0");
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.GATEWAY, List.of());
HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, List.of());
TemplatePreparationObject preparationObject = Builder.builder().withStackType(StackType.WORKLOAD).withCloudPlatform(cloudPlatform).withProductDetails(cmRepo, List.of()).withDataLakeView(new DatalakeView(true)).withGeneralClusterConfigs(generalClusterConfigs).withHostgroupViews(Set.of(master, worker)).build();
Map<String, ApiClusterTemplateService> additionalServices = configProvider.getAdditionalServices(cmTemplateProcessor, preparationObject);
assertEquals(0, additionalServices.size());
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class CmTemplateProcessorTest method testExtendTemplateWithAdditionalServicesWithKnoxServiceAndMultipleGateway.
@Test
public void testExtendTemplateWithAdditionalServicesWithKnoxServiceAndMultipleGateway() {
underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager-multi-gateway.bp"));
ApiClusterTemplateService knox = new ApiClusterTemplateService().serviceType("KNOX").refName("knox");
ApiClusterTemplateRoleConfigGroup knoxGateway = new ApiClusterTemplateRoleConfigGroup().roleType("KNOX_GATEWAY").base(true).refName("knox-KNOX_GATEWAY-BASE");
knox.roleConfigGroups(List.of(knoxGateway));
underTest.extendTemplateWithAdditionalServices(Map.of("master", knox, "master2", knox));
String actualTemplate = templateToString(underTest.getTemplate());
CmTemplateProcessor expectedProcessor = new CmTemplateProcessor(getBlueprintText("input/clouderamanager-knox-multi-gateway.bp"));
String expectedTemplate = templateToString(expectedProcessor.getTemplate());
assertEquals(expectedTemplate, actualTemplate);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class CmTemplateProcessorTest method testExtendTemplateWithAdditionalServicesWithKnoxService.
@Test
public void testExtendTemplateWithAdditionalServicesWithKnoxService() {
underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager.bp"));
ApiClusterTemplateService knox = new ApiClusterTemplateService().serviceType("KNOX").refName("knox");
ApiClusterTemplateRoleConfigGroup knoxGateway = new ApiClusterTemplateRoleConfigGroup().roleType("KNOX_GATEWAY").base(true).refName("knox-KNOX_GATEWAY-BASE");
knox.roleConfigGroups(List.of(knoxGateway));
underTest.extendTemplateWithAdditionalServices(Map.of("master", knox));
String actualTemplate = templateToString(underTest.getTemplate());
CmTemplateProcessor expectedProcessor = new CmTemplateProcessor(getBlueprintText("input/clouderamanager-knox.bp"));
String expectedTemplate = templateToString(expectedProcessor.getTemplate());
assertEquals(expectedTemplate, actualTemplate);
}
use of com.cloudera.api.swagger.model.ApiClusterTemplateService in project cloudbreak by hortonworks.
the class CmTemplateProcessorTest method testAddRoleConfigs.
@Test
public void testAddRoleConfigs() {
underTest = new CmTemplateProcessor(getBlueprintText("input/clouderamanager.bp"));
Map<String, List<ApiClusterTemplateConfig>> configs = new HashMap<>();
configs.put("hdfs-NAMENODE-BASE", List.of(new ApiClusterTemplateConfig().name("dfs_name_dir_list").variable("master_NAMENODE")));
configs.put("hdfs-DATANODE-BASE", List.of(new ApiClusterTemplateConfig().name("dfs_data_dir_list").variable("worker_DATANODE")));
underTest.addRoleConfigs("HDFS", configs);
ApiClusterTemplateService service = underTest.getTemplate().getServices().stream().filter(srv -> "HDFS".equals(srv.getServiceType())).findAny().get();
ApiClusterTemplateRoleConfigGroup dn = service.getRoleConfigGroups().stream().filter(rcg -> "DATANODE".equals(rcg.getRoleType())).findAny().get();
List<ApiClusterTemplateConfig> dnConfigs = dn.getConfigs();
ApiClusterTemplateRoleConfigGroup nn = service.getRoleConfigGroups().stream().filter(rcg -> "NAMENODE".equals(rcg.getRoleType())).findAny().get();
List<ApiClusterTemplateConfig> nnConfigs = nn.getConfigs();
assertEquals(1, nnConfigs.size());
assertEquals(1, dnConfigs.size());
assertEquals("dfs_name_dir_list", nnConfigs.get(0).getName());
assertEquals("dfs_data_dir_list", dnConfigs.get(0).getName());
}
Aggregations