Search in sources :

Example 16 with BlueprintConfigurationEntry

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

the class BlueprintTextProcessorTest method addToBlueprint.

@Test
public void addToBlueprint() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/test-bp-zeppelin-shiro.bp");
    List<BlueprintConfigurationEntry> configs = new ArrayList<>();
    configs.add(new BlueprintConfigurationEntry("zeppelin-env", "shiro_ini_content", "changed"));
    String result = underTest.get(testBlueprint).addConfigEntries(configs, false).asText();
    Assert.assertEquals(testBlueprint.replaceAll("\\s", ""), result);
}
Also used : ArrayList(java.util.ArrayList) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 17 with BlueprintConfigurationEntry

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

the class BlueprintTextProcessorTest method addSettingsToBlueprintWhenSettingsBlockExists.

@Test
public void addSettingsToBlueprintWhenSettingsBlockExists() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-with-settings-array.bp");
    String res = FileReaderUtils.readFileFromClasspath("blueprints-jackson/with-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 18 with BlueprintConfigurationEntry

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

the class GcsFileSystemConfiguratorTest method testGetFsProperties.

@Test
public void testGetFsProperties() {
    GcsFileSystemConfiguration fsConfig = new GcsFileSystemConfiguration();
    List<BlueprintConfigurationEntry> actual = underTest.getFsProperties(fsConfig, emptyMap());
    List<BlueprintConfigurationEntry> expected = Arrays.asList(new BlueprintConfigurationEntry("core-site", "fs.gs.impl", "com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem"), new BlueprintConfigurationEntry("core-site", "fs.AbstractFileSystem.gs.impl", "com.google.cloud.hadoop.fs.gcs.GoogleHadoopFS"), new BlueprintConfigurationEntry("core-site", "fs.gs.working.dir", "/"), new BlueprintConfigurationEntry("core-site", "fs.gs.system.bucket", fsConfig.getDefaultBucketName()), new BlueprintConfigurationEntry("core-site", "fs.gs.auth.service.account.enable", "true"), new BlueprintConfigurationEntry("core-site", "fs.gs.auth.service.account.keyfile", "/usr/lib/hadoop/lib/gcp.p12"), new BlueprintConfigurationEntry("core-site", "fs.gs.auth.service.account.email", fsConfig.getServiceAccountEmail()), new BlueprintConfigurationEntry("core-site", "fs.gs.project.id", fsConfig.getProjectId()));
    Assert.assertEquals(expected, actual);
}
Also used : GcsFileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 19 with BlueprintConfigurationEntry

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

the class WasbFileSystemConfiguratorTest method testGetFsProperties.

@Test
public void testGetFsProperties() {
    WasbFileSystemConfiguration config = new WasbFileSystemConfiguration();
    config.setAccountName("accountName");
    config.setAccountKey("accountKey");
    List<BlueprintConfigurationEntry> actual = underTest.getFsProperties(config, null);
    List<BlueprintConfigurationEntry> expected = Arrays.asList(new BlueprintConfigurationEntry("core-site", "fs.AbstractFileSystem.wasbs.impl", "org.apache.hadoop.fs.azure.Wasbs"), new BlueprintConfigurationEntry("core-site", "fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"), new BlueprintConfigurationEntry("core-site", "fs.azure.account.key.accountName.blob.core.windows.net", "accountKey"), new BlueprintConfigurationEntry("core-site", "fs.azure.selfthrottling.read.factor", "1.0"), new BlueprintConfigurationEntry("core-site", "fs.azure.selfthrottling.write.factor", "1.0"));
    Assert.assertEquals(expected, actual);
}
Also used : WasbFileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.WasbFileSystemConfiguration) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry) Test(org.junit.Test)

Example 20 with BlueprintConfigurationEntry

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

the class WasbFileSystemConfigurator method getFsProperties.

@Override
public List<BlueprintConfigurationEntry> getFsProperties(WasbFileSystemConfiguration fsConfig, Map<String, String> resourceProperties) {
    List<BlueprintConfigurationEntry> bpConfigs = new ArrayList<>();
    String accountName = fsConfig.getAccountName();
    String accountKey = fsConfig.getAccountKey();
    bpConfigs.add(new BlueprintConfigurationEntry("core-site", "fs.AbstractFileSystem.wasbs.impl", "org.apache.hadoop.fs.azure.Wasbs"));
    bpConfigs.add(new BlueprintConfigurationEntry("core-site", "fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"));
    bpConfigs.add(new BlueprintConfigurationEntry("core-site", "fs.azure.account.key." + accountName + ".blob.core.windows.net", accountKey));
    bpConfigs.add(new BlueprintConfigurationEntry("core-site", "fs.azure.selfthrottling.read.factor", "1.0"));
    bpConfigs.add(new BlueprintConfigurationEntry("core-site", "fs.azure.selfthrottling.write.factor", "1.0"));
    return bpConfigs;
}
Also used : ArrayList(java.util.ArrayList) BlueprintConfigurationEntry(com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)

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