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