Search in sources :

Example 36 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class OozieRoleConfigProviderTest method testGetRoleConfigsWithSingleRolesPerHostGroup.

@Test
public void testGetRoleConfigsWithSingleRolesPerHostGroup() {
    String inputJson = getBlueprintText("input/clouderamanager-db-config.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(inputJson, cmTemplateProcessor, 1);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> oozieServer = roleConfigs.get("oozie-OOZIE_SERVER-BASE");
    assertEquals(5, oozieServer.size());
    assertEquals("oozie_database_host", oozieServer.get(0).getName());
    assertEquals("testhost", oozieServer.get(0).getValue());
    assertEquals("oozie_database_name", oozieServer.get(1).getName());
    assertEquals("ooziedb", oozieServer.get(1).getValue());
    assertEquals("oozie_database_type", oozieServer.get(2).getName());
    assertEquals("postgresql", oozieServer.get(2).getValue());
    assertEquals("oozie_database_user", oozieServer.get(3).getName());
    assertEquals("testuser", oozieServer.get(3).getValue());
    assertEquals("oozie_database_password", oozieServer.get(4).getName());
    assertEquals("testpassword", oozieServer.get(4).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArrayList(java.util.ArrayList) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 37 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class OozieRoleConfigProviderTest method testGetRoleConfigsWithNoOozie.

@Test
public void testGetRoleConfigsWithNoOozie() {
    String inputJson = getBlueprintText("input/clouderamanager.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(inputJson, cmTemplateProcessor, 1);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> oozieServer = roleConfigs.get("oozie-OOZIE_SERVER-BASE");
    assertNull(oozieServer);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArrayList(java.util.ArrayList) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 38 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class OozieRoleConfigProviderTest method testGetRoleConfigsWithOozieHA.

@Test
public void testGetRoleConfigsWithOozieHA() {
    String inputJson = getBlueprintText("input/de-ha.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = getTemplatePreparationObject(inputJson, cmTemplateProcessor, 2);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> oozieServer = roleConfigs.get("oozie-OOZIE_SERVER-BASE");
    assertEquals(5, oozieServer.size());
    assertEquals("oozie_database_host", oozieServer.get(0).getName());
    assertEquals("testhost", oozieServer.get(0).getValue());
    assertEquals("oozie_database_name", oozieServer.get(1).getName());
    assertEquals("ooziedb", oozieServer.get(1).getValue());
    assertEquals("oozie_database_type", oozieServer.get(2).getName());
    assertEquals("postgresql", oozieServer.get(2).getValue());
    assertEquals("oozie_database_user", oozieServer.get(3).getName());
    assertEquals("testuser", oozieServer.get(3).getValue());
    assertEquals("oozie_database_password", oozieServer.get(4).getName());
    assertEquals("testpassword", oozieServer.get(4).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArrayList(java.util.ArrayList) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 39 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class RangerRazBaseConfigProviderTest method getServiceTypesConfigWheAAWSAnd729ShouldNOTAddProperty.

@Test
public void getServiceTypesConfigWheAAWSAnd729ShouldNOTAddProperty() {
    BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
    when(blueprintTextProcessor.getVersion()).thenReturn(Optional.of("7.2.9"));
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withStackType(StackType.WORKLOAD).withBlueprintView(new BlueprintView("", "7.2.9", "CDH", blueprintTextProcessor)).withCloudPlatform(CloudPlatform.AWS).withGeneralClusterConfigs(new GeneralClusterConfigs()).withDataLakeView(new DatalakeView(false)).build();
    List<ApiClusterTemplateConfig> roleConfigs = underTest.getRoleConfigs("", preparationObject);
    assertEquals(0, roleConfigs.size());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) BlueprintTextProcessor(com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) DatalakeView(com.sequenceiq.cloudbreak.template.views.DatalakeView) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 40 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class RangerRazDatahubConfigProviderTest method getAdditionalServicesWhenRazIsEnabledWithCm721.

@ParameterizedTest(name = "{0}")
@MethodSource("razCloudPlatformDataProvider")
@DisplayName("CM 7.2.1 DH is used and Raz is requested, no additional service needs to be added to the template")
void getAdditionalServicesWhenRazIsEnabledWithCm721(String testCaseName, CloudPlatform cloudPlatform) {
    ClouderaManagerRepo cmRepo = new ClouderaManagerRepo();
    cmRepo.setVersion("7.2.1");
    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());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) DatalakeView(com.sequenceiq.cloudbreak.template.views.DatalakeView) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)266 Test (org.junit.Test)133 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)127 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)116 Test (org.junit.jupiter.api.Test)87 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)53 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)48 List (java.util.List)45 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)40 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)38 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)36 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)35 ArrayList (java.util.ArrayList)34 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)32 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)27 MethodSource (org.junit.jupiter.params.provider.MethodSource)23 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)20 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)17 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)16 DisplayName (org.junit.jupiter.api.DisplayName)16