Search in sources :

Example 1 with GcsFileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration in project cloudbreak by hortonworks.

the class GcsFileSystemConfiguratorTest method testGetScriptConfigs.

@Test
public void testGetScriptConfigs() throws JsonProcessingException {
    Credential credential = new Credential();
    credential.setAttributes(new Json(singletonMap("serviceAccountPrivateKey", "private-key")));
    GcsFileSystemConfiguration notProcessed = null;
    List<FileSystemScriptConfig> actual = underTest.getScriptConfigs(credential, notProcessed);
    List<FileSystemScriptConfig> expected = Arrays.asList(new FileSystemScriptConfig("scripts/gcs-p12.sh", POST_AMBARI_START, ALL_NODES, singletonMap("P12KEY", "private-key")), new FileSystemScriptConfig("scripts/gcs-connector-local.sh", POST_AMBARI_START, ALL_NODES), new FileSystemScriptConfig("scripts/gcs-connector-hdfs.sh", POST_CLUSTER_INSTALL, ONE_NODE));
    Assert.assertEquals(expected, actual);
}
Also used : Credential(com.sequenceiq.cloudbreak.domain.Credential) FileSystemScriptConfig(com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemScriptConfig) GcsFileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration) Json(com.sequenceiq.cloudbreak.domain.json.Json) Test(org.junit.Test)

Example 2 with GcsFileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration in project cloudbreak by hortonworks.

the class GcsFileSystemConfiguratorTest method testGetDefaultFsValue.

@Test
public void testGetDefaultFsValue() {
    GcsFileSystemConfiguration fsConfig = new GcsFileSystemConfiguration();
    fsConfig.setDefaultBucketName("bucket-name");
    String actual = underTest.getDefaultFsValue(fsConfig);
    Assert.assertEquals("gs://bucket-name/", actual);
}
Also used : GcsFileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration) Test(org.junit.Test)

Example 3 with GcsFileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration 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 4 with GcsFileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration in project cloudbreak by hortonworks.

the class GcsFileSystemConfiguratorTest method testGetScriptConfigsWhenPrivateKeyNotSet.

@Test
public void testGetScriptConfigsWhenPrivateKeyNotSet() throws JsonProcessingException {
    Credential credential = new Credential();
    credential.setAttributes(new Json(emptyMap()));
    GcsFileSystemConfiguration notProcessed = null;
    List<FileSystemScriptConfig> actual = underTest.getScriptConfigs(credential, notProcessed);
    List<FileSystemScriptConfig> expected = Arrays.asList(new FileSystemScriptConfig("scripts/gcs-p12.sh", POST_AMBARI_START, ALL_NODES, singletonMap("P12KEY", "")), new FileSystemScriptConfig("scripts/gcs-connector-local.sh", POST_AMBARI_START, ALL_NODES), new FileSystemScriptConfig("scripts/gcs-connector-hdfs.sh", POST_CLUSTER_INSTALL, ONE_NODE));
    Assert.assertEquals(expected, actual);
}
Also used : Credential(com.sequenceiq.cloudbreak.domain.Credential) FileSystemScriptConfig(com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemScriptConfig) GcsFileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration) Json(com.sequenceiq.cloudbreak.domain.json.Json) Test(org.junit.Test)

Example 5 with GcsFileSystemConfiguration

use of com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration in project cloudbreak by hortonworks.

the class TestUtil method gcsFileSystemConfiguration.

public static FileSystemConfiguration gcsFileSystemConfiguration() {
    GcsFileSystemConfiguration gcsFileSystemConfiguration = new GcsFileSystemConfiguration();
    gcsFileSystemConfiguration.setDefaultBucketName("hortonworks");
    gcsFileSystemConfiguration.setProjectId("test-id");
    gcsFileSystemConfiguration.setServiceAccountEmail("serviceaccountemail");
    return gcsFileSystemConfiguration;
}
Also used : GcsFileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration)

Aggregations

GcsFileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration)5 Test (org.junit.Test)4 FileSystemScriptConfig (com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemScriptConfig)2 Credential (com.sequenceiq.cloudbreak.domain.Credential)2 Json (com.sequenceiq.cloudbreak.domain.json.Json)2 BlueprintConfigurationEntry (com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)1