Search in sources :

Example 1 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class FileSystemConfigurationProvider method fileSystemConfiguration.

public FileSystemConfiguration fileSystemConfiguration(FileSystem fs, Stack stack) throws IOException {
    FileSystemConfiguration fileSystemConfiguration = null;
    if (fs != null) {
        FileSystemType fileSystemType = FileSystemType.valueOf(fs.getType());
        String json = JsonUtil.writeValueAsString(fs.getProperties());
        fileSystemConfiguration = JsonUtil.readValue(json, fileSystemType.getClazz());
        if (stack != null) {
            fileSystemConfiguration = decorateFsConfigurationProperties(fileSystemConfiguration, stack);
        }
    }
    return fileSystemConfiguration;
}
Also used : FileSystemType(com.sequenceiq.cloudbreak.api.model.FileSystemType) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Example 2 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class BlueprintComponentProviderProcessor method extendBlueprintWithFsConfig.

private String extendBlueprintWithFsConfig(BlueprintTextProcessor blueprintProcessor, FileSystemConfiguration fsConfiguration, boolean defaultFs) {
    FileSystemType fileSystemType = FileSystemType.fromClass(fsConfiguration.getClass());
    FileSystemConfigurator<FileSystemConfiguration> fsConfigurator = fileSystemConfigurators.get(fileSystemType);
    Map<String, String> resourceProperties = fsConfigurator.createResources(fsConfiguration);
    List<BlueprintConfigurationEntry> bpConfigEntries = fsConfigurator.getFsProperties(fsConfiguration, resourceProperties);
    if (defaultFs) {
        bpConfigEntries.addAll(fsConfigurator.getDefaultFsProperties(fsConfiguration));
    }
    return blueprintProcessor.addConfigEntries(bpConfigEntries, true).asText();
}
Also used : FileSystemType(com.sequenceiq.cloudbreak.api.model.FileSystemType) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)

Example 3 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class AbstractFileSystemConfiguratorTest method testGetDefaultFsProperties.

@Test
public void testGetDefaultFsProperties() {
    FileSystemConfiguration fsConfig = new FileSystemConfiguration();
    List<BlueprintConfigurationEntry> actual = underTest.getDefaultFsProperties(fsConfig);
    List<BlueprintConfigurationEntry> expected = Arrays.asList(new BlueprintConfigurationEntry("core-site", "fs.defaultFS", "default-fs-value"), new BlueprintConfigurationEntry("hbase-site", "hbase.rootdir", "default-fs-value/apps/hbase/data"), new BlueprintConfigurationEntry("accumulo-site", "instance.volumes", "default-fs-value/apps/accumulo/data"), new BlueprintConfigurationEntry("webhcat-site", "templeton.hive.archive", "default-fs-value/hdp/apps/${hdp.version}/hive/hive.tar.gz"), new BlueprintConfigurationEntry("webhcat-site", "templeton.pig.archive", "default-fs-value/hdp/apps/${hdp.version}/pig/pig.tar.gz"), new BlueprintConfigurationEntry("webhcat-site", "templeton.sqoop.archive", "default-fs-value/hdp/apps/${hdp.version}/sqoop/sqoop.tar.gz"), new BlueprintConfigurationEntry("webhcat-site", "templeton.streaming.jar", "default-fs-value/hdp/apps/${hdp.version}/mapreduce/hadoop-streaming.jar"), new BlueprintConfigurationEntry("oozie-site", "oozie.service.HadoopAccessorService.supported.filesystems", "*"));
    Assert.assertEquals(expected, actual);
}
Also used : BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration) Test(org.junit.Test)

Example 4 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class AbstractFileSystemConfiguratorTest method testDelteResource.

@Test
public void testDelteResource() {
    FileSystemConfiguration fsConfig = new FileSystemConfiguration();
    Map<String, String> actual = underTest.deleteResources(fsConfig);
    Assert.assertEquals(emptyMap(), actual);
}
Also used : FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration) Test(org.junit.Test)

Example 5 with FileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration in project cloudbreak by hortonworks.

the class AbstractFileSystemConfiguratorTest method testGetScripts.

@Test
public void testGetScripts() {
    Credential credential = new Credential();
    credential.setId(0L);
    FileSystemConfiguration fsConfig = new FileSystemConfiguration();
    List<RecipeScript> actual = underTest.getScripts(credential, fsConfig);
    List<RecipeScript> expected = singletonList(new RecipeScript("echo 'newContent'", ExecutionType.ALL_NODES, RecipeType.POST_AMBARI_START));
    Assert.assertEquals(expected, actual);
}
Also used : Credential(com.sequenceiq.cloudbreak.domain.Credential) RecipeScript(com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration) Test(org.junit.Test)

Aggregations

FileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)15 Test (org.junit.Test)10 RecipeScript (com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript)3 Credential (com.sequenceiq.cloudbreak.domain.Credential)3 FileSystemType (com.sequenceiq.cloudbreak.api.model.FileSystemType)2 FileSystemConfigurator (com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemConfigurator)2 BlueprintConfigurationEntry (com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)1 FileSystemConfigurationView (com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)1 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)1 TerminationFailedException (com.sequenceiq.cloudbreak.service.stack.flow.TerminationFailedException)1 JsonUtil.writeValueAsString (com.sequenceiq.cloudbreak.util.JsonUtil.writeValueAsString)1 IOException (java.io.IOException)1