Search in sources :

Example 16 with StorageLocation

use of com.sequenceiq.cloudbreak.domain.StorageLocation in project cloudbreak by hortonworks.

the class HiveMetastoreCloudStorageServiceConfigProviderTest method getHiveWarehouseReplicaStorageLocation.

protected StorageLocation getHiveWarehouseReplicaStorageLocation() {
    StorageLocation hmsExternalWarehouseDir = new StorageLocation();
    hmsExternalWarehouseDir.setProperty("hive.repl.replica.functions.root.dir");
    hmsExternalWarehouseDir.setValue("s3a://bucket/hive/replica");
    return hmsExternalWarehouseDir;
}
Also used : StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation)

Example 17 with StorageLocation

use of com.sequenceiq.cloudbreak.domain.StorageLocation in project cloudbreak by hortonworks.

the class CoreConfigProviderTest method isConfigurationNeededWhenKafkaPresentedHdfsNotAndStorageConfiguredMustReturnTrue.

@Test
public void isConfigurationNeededWhenKafkaPresentedHdfsNotAndStorageConfiguredMustReturnTrue() {
    CmTemplateProcessor mockTemplateProcessor = mock(CmTemplateProcessor.class);
    TemplatePreparationObject templatePreparationObject = mock(TemplatePreparationObject.class);
    BaseFileSystemConfigurationsView fileSystemConfiguration = mock(BaseFileSystemConfigurationsView.class);
    List<StorageLocationView> storageLocationViews = new ArrayList<>();
    StorageLocation storageLocation = new StorageLocation();
    storageLocation.setConfigFile("core_defaultfs");
    storageLocation.setProperty("core_defaultfs");
    storageLocation.setValue("s3a://default-bucket/");
    storageLocationViews.add(new StorageLocationView(storageLocation));
    when(fileSystemConfiguration.getLocations()).thenReturn(storageLocationViews);
    Optional<BaseFileSystemConfigurationsView> fileSystemConfigurationView = Optional.of(fileSystemConfiguration);
    when(mockTemplateProcessor.isRoleTypePresentInService(KAFKA_SERVICE, List.of(KAFKA_BROKER))).thenReturn(true);
    when(mockTemplateProcessor.isRoleTypePresentInService(HDFS, List.of(NAMENODE))).thenReturn(false);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(fileSystemConfigurationView);
    Assert.assertTrue(underTest.isConfigurationNeeded(mockTemplateProcessor, templatePreparationObject));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) ArrayList(java.util.ArrayList) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) Test(org.junit.Test)

Example 18 with StorageLocation

use of com.sequenceiq.cloudbreak.domain.StorageLocation in project cloudbreak by hortonworks.

the class CentralCmTemplateUpdaterTest method getKafkaPropertiesWhenNoHdfsInClusterShouldPresentCoreSettings.

@Test
public void getKafkaPropertiesWhenNoHdfsInClusterShouldPresentCoreSettings() {
    CoreConfigProvider coreConfigProvider = new CoreConfigProvider();
    ReflectionTestUtils.setField(coreConfigProvider, "s3ConfigProvider", s3ConfigProvider);
    List<CmTemplateComponentConfigProvider> cmTemplateComponentConfigProviders = List.of(coreConfigProvider);
    ReflectionTestUtils.setField(cmTemplateComponentConfigProviderProcessor, "providers", cmTemplateComponentConfigProviders);
    S3FileSystem s3FileSystem = new S3FileSystem();
    s3FileSystem.setInstanceProfile("profile");
    s3FileSystem.setS3GuardDynamoTableName("cb-table");
    s3FileSystem.setStorageContainer("cloudbreak-bucket");
    StorageLocation storageLocation = new StorageLocation();
    storageLocation.setProperty("core_defaultfs");
    storageLocation.setValue("s3a://cloudbreak-bucket/kafka");
    storageLocation.setConfigFile("core_settings");
    StorageLocationView storageLocationView = new StorageLocationView(storageLocation);
    BaseFileSystemConfigurationsView baseFileSystemConfigurationsView = new S3FileSystemConfigurationsView(s3FileSystem, Sets.newHashSet(storageLocationView), false);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(Optional.of(baseFileSystemConfigurationsView));
    when(templatePreparationObject.getGatewayView()).thenReturn(new GatewayView(new Gateway(), "signkey", new HashSet<>()));
    Set<HostgroupView> hostgroupViews = new HashSet<>();
    hostgroupViews.add(new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1));
    when(templatePreparationObject.getHostgroupViews()).thenReturn(hostgroupViews);
    when(templatePreparationObject.getGatewayView()).thenReturn(new GatewayView(new Gateway(), "signkey", new HashSet<>()));
    when(blueprintView.getBlueprintText()).thenReturn(getBlueprintText("input/kafka-without-hdfs.bp"));
    String generated = generator.getBlueprintText(templatePreparationObject);
    String expected = new CmTemplateProcessor(getBlueprintText("output/kafka-without-hdfs.bp")).getTemplate().toString();
    String output = new CmTemplateProcessor(generated).getTemplate().toString();
    Assert.assertEquals(expected, output);
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) CoreConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.configproviders.core.CoreConfigProvider) BaseFileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) GatewayView(com.sequenceiq.cloudbreak.template.views.GatewayView) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 19 with StorageLocation

use of com.sequenceiq.cloudbreak.domain.StorageLocation in project cloudbreak by hortonworks.

the class StackToTemplatePreparationObjectConverter method updateFileSystemViewWithBackupLocation.

private void updateFileSystemViewWithBackupLocation(DetailedEnvironmentResponse detailedEnvironmentResponse, BaseFileSystemConfigurationsView fileSystemConfigurationView) {
    if (fileSystemConfigurationView != null) {
        BackupResponse backupResponse = detailedEnvironmentResponse.getBackup();
        TelemetryResponse telemetryResponse = detailedEnvironmentResponse.getTelemetry();
        Optional<String> backupLocation = Optional.empty();
        if (backupResponse != null && backupResponse.getStorageLocation() != null) {
            backupLocation = Optional.of(backupResponse.getStorageLocation());
        } else if (telemetryResponse != null && telemetryResponse.getLogging() != null) {
            backupLocation = Optional.of(telemetryResponse.getLogging().getStorageLocation());
        }
        if (backupLocation.isPresent()) {
            StorageLocation storageLocation = new StorageLocation();
            storageLocation.setValue(backupLocation.get());
            storageLocation.setProperty(RangerCloudStorageServiceConfigProvider.DEFAULT_BACKUP_DIR);
            StorageLocationView backupLocationView = new StorageLocationView(storageLocation);
            fileSystemConfigurationView.getLocations().add(backupLocationView);
        }
    }
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) BackupResponse(com.sequenceiq.common.api.backup.response.BackupResponse) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation)

Example 20 with StorageLocation

use of com.sequenceiq.cloudbreak.domain.StorageLocation in project cloudbreak by hortonworks.

the class TestUtil method storageLocation.

public static StorageLocation storageLocation(int i) {
    StorageLocation storageLocation = new StorageLocation();
    storageLocation.setValue(i + "_test/test/end");
    storageLocation.setProperty(i + "_property");
    storageLocation.setConfigFile(i + "_file");
    return storageLocation;
}
Also used : StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation)

Aggregations

StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)40 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)16 ArrayList (java.util.ArrayList)13 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)11 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)11 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)7 Test (org.junit.Test)6 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)5 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)5 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)4 ApiClusterTemplate (com.cloudera.api.swagger.model.ApiClusterTemplate)2 BackupResponse (com.sequenceiq.common.api.backup.response.BackupResponse)2 HashSet (java.util.HashSet)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)1 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)1 CoreConfigProvider (com.sequenceiq.cloudbreak.cmtemplate.configproviders.core.CoreConfigProvider)1 HiveMetastoreConfigProvider (com.sequenceiq.cloudbreak.cmtemplate.configproviders.hive.HiveMetastoreConfigProvider)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1