Search in sources :

Example 46 with TemplatePreparationObject

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

the class RangerRazDatahubConfigProviderTest method getAdditionalServicesWhenProductDetailsIsMissing.

@ParameterizedTest(name = "{0}")
@MethodSource("razCloudPlatformDataProvider")
@DisplayName("CM 7.2.2 DH is used and product details is missing at template generation before datahub cluster creations")
void getAdditionalServicesWhenProductDetailsIsMissing(String testCaseName, CloudPlatform cloudPlatform) {
    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).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) 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)

Example 47 with TemplatePreparationObject

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

the class RangerRazDatalakeConfigProviderTest method getAdditionalServicesWhenRazIsEnabledWithCm721AndAws.

@Test
@DisplayName("CM 7.2.1 DL is used and Raz is requested, AWS, no additional service needs to be added to the template")
void getAdditionalServicesWhenRazIsEnabledWithCm721AndAws() {
    ClouderaManagerRepo cmRepo = new ClouderaManagerRepo();
    cmRepo.setVersion("7.2.1");
    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.AWS).withProductDetails(cmRepo, List.of()).withGeneralClusterConfigs(generalClusterConfigs).withHostgroupViews(Set.of(master, idbroker)).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) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 48 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject 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());
}
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) 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)

Example 49 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject 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());
}
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)

Example 50 with TemplatePreparationObject

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

the class SchemaRegistryJarStorageConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(Integer... instanceCountsForSchemaRegistryHostGroups) {
    List<HostgroupView> srHostGroups = Arrays.stream(instanceCountsForSchemaRegistryHostGroups).map(nodeCnt -> new HostgroupView(null, 0, InstanceGroupType.CORE, nodeCnt)).collect(toList());
    TemplatePreparationObject tpo = mock(TemplatePreparationObject.class, withSettings().lenient());
    when(tpo.getHostGroupsWithComponent(SCHEMA_REGISTRY_SERVER)).thenAnswer(__ -> srHostGroups.stream());
    when(tpo.getBlueprintView()).thenReturn(blueprintView);
    return tpo;
}
Also used : VolumeConfigProviderTestHelper.hostGroupWithVolumeCount(com.sequenceiq.cloudbreak.cmtemplate.configproviders.VolumeConfigProviderTestHelper.hostGroupWithVolumeCount) Arrays(java.util.Arrays) ConfigUtils.config(com.sequenceiq.cloudbreak.cmtemplate.configproviders.ConfigUtils.config) Mock(org.mockito.Mock) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) CONFIG_JAR_STORAGE_DIRECTORY_PATH(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryJarStorageConfigProvider.CONFIG_JAR_STORAGE_DIRECTORY_PATH) FileReaderUtils(com.sequenceiq.cloudbreak.util.FileReaderUtils) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) Set(java.util.Set) CONFIG_JAR_STORAGE_TYPE(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryJarStorageConfigProvider.CONFIG_JAR_STORAGE_TYPE) SCHEMA_REGISTRY_SERVER(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryRoles.SCHEMA_REGISTRY_SERVER) Mockito.when(org.mockito.Mockito.when) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) Test(org.junit.jupiter.api.Test) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) Optional(java.util.Optional) Mockito.withSettings(org.mockito.Mockito.withSettings) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) SchemaRegistryJarStorageConfigProvider.getSchemaRegistryInstanceCount(com.sequenceiq.cloudbreak.cmtemplate.configproviders.schemaregistry.SchemaRegistryJarStorageConfigProvider.getSchemaRegistryInstanceCount) Mockito.mock(org.mockito.Mockito.mock) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView)

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