Search in sources :

Example 26 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class S3ConfigProviderTest method getTemplatePreparationObject.

private TemplatePreparationObject getTemplatePreparationObject(boolean useS3FileSystem, boolean fillDynamoTableName, boolean includeLocations) {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    List<StorageLocationView> locations = new ArrayList<>();
    if (includeLocations) {
        locations.add(new StorageLocationView(getStorageLocation("hive.metastore.warehouse.dir", "s3a://bucket-first/warehouse/managed")));
        locations.add(new StorageLocationView(getStorageLocation("hive.metastore.warehouse.external.dir", "s3a://bucket-first/warehouse/external")));
        locations.add(new StorageLocationView(getStorageLocation("ranger_plugin_hdfs_audit_url", "s3a://bucket-second/ranger/audit")));
    }
    BaseFileSystemConfigurationsView fileSystemConfigurationsView;
    if (useS3FileSystem) {
        S3FileSystem s3FileSystem = new S3FileSystem();
        if (fillDynamoTableName) {
            s3FileSystem.setS3GuardDynamoTableName("dynamoTable");
        }
        fileSystemConfigurationsView = new S3FileSystemConfigurationsView(s3FileSystem, locations, false);
    } else {
        fileSystemConfigurationsView = new AdlsFileSystemConfigurationsView(new AdlsFileSystem(), locations, false);
    }
    Gateway gateway = TestUtil.gatewayEnabledWithExposedKnoxServices("NAMENODE");
    PlacementView placementView = new PlacementView("region", "az");
    return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).withGateway(gateway, "/cb/secret/signkey", new HashSet<>()).withPlacementView(placementView).withDefaultTags(Map.of("apple", "apple1")).build();
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) ArrayList(java.util.ArrayList) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) AdlsFileSystem(com.sequenceiq.common.api.filesystem.AdlsFileSystem) PlacementView(com.sequenceiq.cloudbreak.template.views.PlacementView) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem) AdlsFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.adls.AdlsFileSystemConfigurationsView) HashSet(java.util.HashSet)

Example 27 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView 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)

Example 28 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class SchemaRegistryJarStorageConfigProviderTest method testRoleConfigsWithSingleVolume.

@Test
void testRoleConfigsWithSingleVolume() {
    HostgroupView hostGroup = hostGroupWithVolumeCount(1);
    assertEquals(List.of(config("schema.registry.jar.storage.directory.path", "/hadoopfs/fs1/schema_registry")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, getTemplatePreparationObject(hostGroup)));
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 29 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class SchemaRegistryJarStorageConfigProviderTest method testLocalStorageIsChosenWhenSingleSchemaRegistryInstance.

@Test
void testLocalStorageIsChosenWhenSingleSchemaRegistryInstance() {
    cdhMainVersionIs("7.1.0");
    TemplatePreparationObject tpo = getTemplatePreparationObject(1);
    HostgroupView hostGroup = tpo.getHostGroupsWithComponent(SCHEMA_REGISTRY_SERVER).findFirst().get();
    assertEquals(List.of(config(CONFIG_JAR_STORAGE_DIRECTORY_PATH, "/hadoopfs/root1/schema_registry")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, tpo));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 30 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class SchemaRegistryJarStorageConfigProviderTest method testRoleConfigsWithoutVolumes.

@Test
void testRoleConfigsWithoutVolumes() {
    HostgroupView hostGroup = hostGroupWithVolumeCount(0);
    assertEquals(List.of(config("schema.registry.jar.storage.directory.path", "/hadoopfs/root1/schema_registry")), subject.getRoleConfigs(SCHEMA_REGISTRY_SERVER, hostGroup, getTemplatePreparationObject(hostGroup)));
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Aggregations

HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)122 Test (org.junit.jupiter.api.Test)63 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)39 ArrayList (java.util.ArrayList)34 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)26 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)25 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)23 List (java.util.List)23 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)23 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)19 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)19 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)18 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)18 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)16 DisplayName (org.junit.jupiter.api.DisplayName)16 MethodSource (org.junit.jupiter.params.provider.MethodSource)16 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)15 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)8 Map (java.util.Map)8 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)7