Search in sources :

Example 6 with BlueprintConfigurationEntry

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

the class BlueprintTextProcessorTest method testAddConfigEntriesAddsConfigEntriesToExistingConfigBlockAndKeepsExistingEntries.

@Test
public void testAddConfigEntriesAddsConfigEntriesToExistingConfigBlockAndKeepsExistingEntries() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-with-core-site.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("fs.AbstractFileSystem.wasb.impl").textValue();
    Assert.assertEquals("org.apache.hadoop.fs.azure.Wasb", configValue1);
    String configValue2 = JsonUtil.readTree(result).findPath("core-site").path("io.serializations").textValue();
    Assert.assertEquals("org.apache.hadoop.io.serializer.WritableSerialization", configValue2);
    String configValue3 = JsonUtil.readTree(result).findPath("core-site").path("fs.trash.interval").textValue();
    Assert.assertEquals("360", configValue3);
    String configValue4 = JsonUtil.readTree(result).findPath("core-site").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 7 with BlueprintConfigurationEntry

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

the class BlueprintTextProcessorTest method testAddConfigEntriesAddsConfigEntriesToCorrectConfigBlockWithCorrectValues.

@Test
public void testAddConfigEntriesAddsConfigEntriesToCorrectConfigBlockWithCorrectValues() 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"));
    configurationEntries.add(new BlueprintConfigurationEntry("hdfs-site", "dfs.blocksize", "134217728"));
    String result = underTest.get(testBlueprint).addConfigEntries(configurationEntries, true).asText();
    String configValue1 = JsonUtil.readTree(result).findPath("core-site").findPath("fs.AbstractFileSystem.wasb.impl").textValue();
    Assert.assertEquals("org.apache.hadoop.fs.azure.Wasb", configValue1);
    String configValue2 = JsonUtil.readTree(result).findPath("hdfs-site").findPath("dfs.blocksize").textValue();
    Assert.assertEquals("134217728", configValue2);
}
Also used : ArrayList(java.util.ArrayList) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 8 with BlueprintConfigurationEntry

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

the class BlueprintTextProcessorTest method addSettingsToBlueprintWhenNoSettingsBlock.

@Test
public void addSettingsToBlueprintWhenNoSettingsBlock() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-without-settings-array.bp");
    String res = FileReaderUtils.readFileFromClasspath("blueprints-jackson/settings-bp-result.bp");
    List<BlueprintConfigurationEntry> configs = new ArrayList<>();
    configs.add(new BlueprintConfigurationEntry("recovery_settings", "recovery_enabled", "true"));
    configs.add(new BlueprintConfigurationEntry("cluster-env", "recovery_enabled", "true"));
    configs.add(new BlueprintConfigurationEntry("cluster-env", "recovery_type", "AUTO_START"));
    String result = underTest.get(testBlueprint).addSettingsEntries(configs, false).asText();
    Assert.assertEquals(res.replaceAll("\\s", ""), result.replaceAll("\\s", ""));
}
Also used : ArrayList(java.util.ArrayList) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 9 with BlueprintConfigurationEntry

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

the class BlueprintTextProcessorTest method testAddConfigEntriesAddsConfigEntriesToExistingConfigPropertiesBlockAndDoesNotUpdateExistingEntriesWhenOverrideIsFalse.

@Test
public void testAddConfigEntriesAddsConfigEntriesToExistingConfigPropertiesBlockAndDoesNotUpdateExistingEntriesWhenOverrideIsFalse() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-with-core-site-properties-defaultfs.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("properties").path("fs.defaultFS").textValue();
    Assert.assertEquals("hdfs://%HOSTGROUP::host_group_master_1%:8020", 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 10 with BlueprintConfigurationEntry

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

the class BlueprintTextProcessorTest method testAddConfigEntriesAddsConfigEntriesToExistingConfigPropertiesBlockAndUpdatesExistingEntries.

@Test
public void testAddConfigEntriesAddsConfigEntriesToExistingConfigPropertiesBlockAndUpdatesExistingEntries() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-with-core-site-properties-defaultfs.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, true).asText();
    String configValue1 = JsonUtil.readTree(result).findPath("core-site").path("properties").path("fs.defaultFS").textValue();
    Assert.assertEquals("wasb://cloudbreak@dduihoab6jt1jl.cloudapp.net", 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)

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