Search in sources :

Example 21 with Credential

use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.

the class AbstractFileSystemConfiguratorTest method testGetScriptsWhenNoReplace.

@Test
public void testGetScriptsWhenNoReplace() {
    Credential credential = new Credential();
    credential.setId(1L);
    FileSystemConfiguration fsConfig = new FileSystemConfiguration();
    List<RecipeScript> actual = underTest.getScripts(credential, fsConfig);
    List<RecipeScript> expected = singletonList(new RecipeScript("echo '$replace'", ExecutionType.ALL_NODES, RecipeType.POST_AMBARI_START));
    Assert.assertEquals(expected, actual);
}
Also used : Credential(com.sequenceiq.cloudbreak.domain.Credential) RecipeScript(com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration) Test(org.junit.Test)

Example 22 with Credential

use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.

the class AbstractFileSystemConfiguratorTest method testGetScriptsWhenFileNotFound.

@Test
public void testGetScriptsWhenFileNotFound() {
    Credential credential = new Credential();
    credential.setId(2L);
    FileSystemConfiguration fsConfig = new FileSystemConfiguration();
    thrown.expectMessage("Filesystem configuration scripts cannot be read.");
    thrown.expect(FileSystemConfigException.class);
    underTest.getScripts(credential, fsConfig);
}
Also used : Credential(com.sequenceiq.cloudbreak.domain.Credential) FileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration) Test(org.junit.Test)

Example 23 with Credential

use of com.sequenceiq.cloudbreak.domain.Credential 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 24 with Credential

use of com.sequenceiq.cloudbreak.domain.Credential 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 25 with Credential

use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.

the class WasbFileSystemConfiguratorTest method testGetScriptConfigs.

@Test
public void testGetScriptConfigs() {
    List<FileSystemScriptConfig> actual = underTest.getScriptConfigs(new Credential(), new WasbFileSystemConfiguration());
    Assert.assertEquals(emptyList(), actual);
}
Also used : FileSystemScriptConfig(com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemScriptConfig) Credential(com.sequenceiq.cloudbreak.domain.Credential) WasbFileSystemConfiguration(com.sequenceiq.cloudbreak.api.model.WasbFileSystemConfiguration) Test(org.junit.Test)

Aggregations

Credential (com.sequenceiq.cloudbreak.domain.Credential)44 Test (org.junit.Test)14 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)8 AccessDeniedException (org.springframework.security.access.AccessDeniedException)8 Json (com.sequenceiq.cloudbreak.domain.json.Json)7 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)6 Template (com.sequenceiq.cloudbreak.domain.Template)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 FileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.FileSystemConfiguration)3 FileSystemScriptConfig (com.sequenceiq.cloudbreak.blueprint.filesystem.FileSystemScriptConfig)3 CloudVmTypes (com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes)3 Transactional (javax.transaction.Transactional)3 Maps.newHashMap (com.google.common.collect.Maps.newHashMap)2 GcsFileSystemConfiguration (com.sequenceiq.cloudbreak.api.model.GcsFileSystemConfiguration)2 ExtendedCloudCredential (com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential)2 Platform (com.sequenceiq.cloudbreak.cloud.model.Platform)2 PlatformDisks (com.sequenceiq.cloudbreak.cloud.model.PlatformDisks)2 VmTypeMeta (com.sequenceiq.cloudbreak.cloud.model.VmTypeMeta)2 VolumeParameterConfig (com.sequenceiq.cloudbreak.cloud.model.VolumeParameterConfig)2 RecipeScript (com.sequenceiq.cloudbreak.common.model.recipe.RecipeScript)2