Search in sources :

Example 31 with PropertyKey

use of alluxio.conf.PropertyKey in project alluxio by Alluxio.

the class ConfigurationRule method before.

@Override
public void before() {
    for (Map.Entry<PropertyKey, Object> entry : mKeyValuePairs.entrySet()) {
        PropertyKey key = entry.getKey();
        Object value = entry.getValue();
        if (mConfiguration.isSet(key)) {
            mStashedProperties.put(key, mConfiguration.get(key));
        } else {
            mStashedProperties.put(key, null);
        }
        if (value != null) {
            mConfiguration.set(key, value);
        } else {
            mConfiguration.unset(key);
        }
    }
}
Also used : Map(java.util.Map) HashMap(java.util.HashMap) PropertyKey(alluxio.conf.PropertyKey)

Example 32 with PropertyKey

use of alluxio.conf.PropertyKey in project alluxio by Alluxio.

the class UfsJournalConfTest method nonEmptyConfiguration.

@Test
public void nonEmptyConfiguration() throws Exception {
    PropertyKey key = PropertyKey.Template.MASTER_JOURNAL_UFS_OPTION_PROPERTY.format(PropertyKey.UNDERFS_LISTING_LENGTH.toString());
    String value = "10000";
    ServerConfiguration.set(key, value);
    UnderFileSystemConfiguration conf = UfsJournal.getJournalUfsConf();
    Assert.assertEquals(value, conf.get(PropertyKey.UNDERFS_LISTING_LENGTH));
    Assert.assertEquals(1, conf.getMountSpecificConf().size());
}
Also used : UnderFileSystemConfiguration(alluxio.underfs.UnderFileSystemConfiguration) PropertyKey(alluxio.conf.PropertyKey) Test(org.junit.Test)

Example 33 with PropertyKey

use of alluxio.conf.PropertyKey in project alluxio by Alluxio.

the class AddCommandIntegrationTest method nonClientScopeKey.

@Test
public void nonClientScopeKey() throws Exception {
    try (FileSystemAdminShell shell = new FileSystemAdminShell(ServerConfiguration.global())) {
        PropertyKey key = PropertyKey.NETWORK_CONNECTION_SERVER_SHUTDOWN_TIMEOUT;
        int ret = shell.run("pathConf", "add", "--property", format(key, "10ms"), "/");
        Assert.assertEquals(-1, ret);
        String output = mOutput.toString();
        Assert.assertEquals(AddCommand.nonClientScopePropertyException(key) + "\n", output);
    }
}
Also used : FileSystemAdminShell(alluxio.cli.fsadmin.FileSystemAdminShell) PropertyKey(alluxio.conf.PropertyKey) Test(org.junit.Test) AbstractShellIntegrationTest(alluxio.client.cli.fs.AbstractShellIntegrationTest)

Example 34 with PropertyKey

use of alluxio.conf.PropertyKey in project alluxio by Alluxio.

the class S3AUnderFileSystemTest method createCredentialsFromConf.

@Test
public void createCredentialsFromConf() throws Exception {
    Map<PropertyKey, Object> conf = new HashMap<>();
    conf.put(PropertyKey.S3A_ACCESS_KEY, "key1");
    conf.put(PropertyKey.S3A_SECRET_KEY, "key2");
    try (Closeable c = new ConfigurationRule(conf, sConf).toResource()) {
        UnderFileSystemConfiguration ufsConf = UnderFileSystemConfiguration.defaults(sConf);
        AWSCredentialsProvider credentialsProvider = S3AUnderFileSystem.createAwsCredentialsProvider(ufsConf);
        Assert.assertEquals("key1", credentialsProvider.getCredentials().getAWSAccessKeyId());
        Assert.assertEquals("key2", credentialsProvider.getCredentials().getAWSSecretKey());
        Assert.assertTrue(credentialsProvider instanceof AWSStaticCredentialsProvider);
    }
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) HashMap(java.util.HashMap) UnderFileSystemConfiguration(alluxio.underfs.UnderFileSystemConfiguration) Closeable(java.io.Closeable) ConfigurationRule(alluxio.ConfigurationRule) PropertyKey(alluxio.conf.PropertyKey) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 35 with PropertyKey

use of alluxio.conf.PropertyKey in project alluxio by Alluxio.

the class S3AUnderFileSystemTest method createCredentialsFromDefault.

@Test
public void createCredentialsFromDefault() throws Exception {
    // Unset AWS properties if present
    Map<PropertyKey, Object> conf = new HashMap<>();
    conf.put(PropertyKey.S3A_ACCESS_KEY, null);
    conf.put(PropertyKey.S3A_SECRET_KEY, null);
    try (Closeable c = new ConfigurationRule(conf, sConf).toResource()) {
        UnderFileSystemConfiguration ufsConf = UnderFileSystemConfiguration.defaults(sConf);
        AWSCredentialsProvider credentialsProvider = S3AUnderFileSystem.createAwsCredentialsProvider(ufsConf);
        Assert.assertTrue(credentialsProvider instanceof DefaultAWSCredentialsProviderChain);
    }
}
Also used : DefaultAWSCredentialsProviderChain(com.amazonaws.auth.DefaultAWSCredentialsProviderChain) HashMap(java.util.HashMap) UnderFileSystemConfiguration(alluxio.underfs.UnderFileSystemConfiguration) Closeable(java.io.Closeable) ConfigurationRule(alluxio.ConfigurationRule) PropertyKey(alluxio.conf.PropertyKey) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Aggregations

PropertyKey (alluxio.conf.PropertyKey)49 HashMap (java.util.HashMap)28 Test (org.junit.Test)16 Map (java.util.Map)15 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)10 AlluxioURI (alluxio.AlluxioURI)7 ConfigCheckReport (alluxio.wire.ConfigCheckReport)6 File (java.io.File)6 List (java.util.List)6 ConfigurationRule (alluxio.ConfigurationRule)5 Scope (alluxio.grpc.Scope)5 UnderFileSystemConfiguration (alluxio.underfs.UnderFileSystemConfiguration)5 Address (alluxio.wire.Address)5 ConfigProperty (alluxio.grpc.ConfigProperty)4 Closeable (java.io.Closeable)4 Optional (java.util.Optional)4 Constants (alluxio.Constants)3 AlluxioProperties (alluxio.conf.AlluxioProperties)3 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)3