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;
}
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();
}
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);
}
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);
}
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);
}
Aggregations