Search in sources :

Example 11 with BlueprintConfigurationEntry

use of com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry 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 12 with BlueprintConfigurationEntry

use of com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry in project cloudbreak by hortonworks.

the class BlueprintTextProcessorTest method testAddConfigEntriesAddsConfigEntriesToExistingConfigPropertiesBlockAndKeepsExistingEntries.

@Test
public void testAddConfigEntriesAddsConfigEntriesToExistingConfigPropertiesBlockAndKeepsExistingEntries() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-with-core-site-properties.bp");
    List<BlueprintConfigurationEntry> configurationEntries = new ArrayList<>();
    configurationEntries.add(new BlueprintConfigurationEntry("core-site", "fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"));
    configurationEntries.add(new BlueprintConfigurationEntry("core-site", "io.serializations", "org.apache.hadoop.io.serializer.WritableSerialization"));
    String result = underTest.get(testBlueprint).addConfigEntries(configurationEntries, true).asText();
    String configValue1 = JsonUtil.readTree(result).findPath("core-site").path("properties").path("fs.AbstractFileSystem.wasb.impl").textValue();
    Assert.assertEquals("org.apache.hadoop.fs.azure.Wasb", configValue1);
    String configValue2 = JsonUtil.readTree(result).findPath("core-site").path("properties").path("io.serializations").textValue();
    Assert.assertEquals("org.apache.hadoop.io.serializer.WritableSerialization", configValue2);
    String configValue3 = JsonUtil.readTree(result).findPath("core-site").path("properties").path("fs.trash.interval").textValue();
    Assert.assertEquals("360", configValue3);
    String configValue4 = JsonUtil.readTree(result).findPath("core-site").path("properties").path("io.file.buffer.size").textValue();
    Assert.assertEquals("131072", configValue4);
}
Also used : ArrayList(java.util.ArrayList) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 13 with BlueprintConfigurationEntry

use of com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry in project cloudbreak by hortonworks.

the class BlueprintTextProcessorTest method testAddConfigEntriesAddsRootConfigurationsNodeIfMissing.

@Test
public void testAddConfigEntriesAddsRootConfigurationsNodeIfMissing() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-without-config-block.bp");
    List<BlueprintConfigurationEntry> configurationEntries = new ArrayList<>();
    String result = underTest.get(testBlueprint).addConfigEntries(configurationEntries, true).asText();
    JsonNode configNode = JsonUtil.readTree(result).path("configurations");
    Assert.assertFalse(configNode.isMissingNode());
}
Also used : ArrayList(java.util.ArrayList) JsonNode(com.fasterxml.jackson.databind.JsonNode) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 14 with BlueprintConfigurationEntry

use of com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry in project cloudbreak by hortonworks.

the class BlueprintTextProcessorTest method testAddConfigEntriesAddsConfigFileEntryIfMissing.

@Test
public void testAddConfigEntriesAddsConfigFileEntryIfMissing() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-with-empty-config-block.bp");
    List<BlueprintConfigurationEntry> configurationEntries = new ArrayList<>();
    configurationEntries.add(new BlueprintConfigurationEntry("core-site", "fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"));
    String result = underTest.get(testBlueprint).addConfigEntries(configurationEntries, true).asText();
    JsonNode coreSiteNode = JsonUtil.readTree(result).findPath("core-site");
    Assert.assertFalse(coreSiteNode.isMissingNode());
}
Also used : ArrayList(java.util.ArrayList) JsonNode(com.fasterxml.jackson.databind.JsonNode) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 15 with BlueprintConfigurationEntry

use of com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry in project cloudbreak by hortonworks.

the class BlueprintTextProcessorTest method testAddConfigEntriesBehavesCorrectlyWhenThereIsNoConfigurationsNode.

@Test
public void testAddConfigEntriesBehavesCorrectlyWhenThereIsNoConfigurationsNode() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-without-config-block.bp");
    List<BlueprintConfigurationEntry> configurationEntries = new ArrayList<>();
    configurationEntries.add(new BlueprintConfigurationEntry("core-site", "fs.defaultFS", "wasb://cloudbreak@dduihoab6jt1jl.cloudapp.net"));
    configurationEntries.add(new BlueprintConfigurationEntry("core-site", "io.serializations", "org.apache.hadoop.io.serializer.WritableSerialization"));
    String result = underTest.get(testBlueprint).addConfigEntries(configurationEntries, false).asText();
    String configValue1 = JsonUtil.readTree(result).findPath("core-site").path("fs.defaultFS").textValue();
    Assert.assertEquals("wasb://cloudbreak@dduihoab6jt1jl.cloudapp.net", configValue1);
    String configValue2 = JsonUtil.readTree(result).findPath("core-site").path("io.serializations").textValue();
    Assert.assertEquals("org.apache.hadoop.io.serializer.WritableSerialization", configValue2);
}
Also used : ArrayList(java.util.ArrayList) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Aggregations

BlueprintConfigurationEntry (com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)20 ArrayList (java.util.ArrayList)16 Test (org.junit.Test)14 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 FileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)1 GcsFileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration)1 WasbFileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.WasbFileSystemConfiguration)1 HostgroupEntry (com.sequenceiq.cloudbreak.blueprint.HostgroupEntry)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1