use of alluxio.underfs.UnderFileSystemConfiguration 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());
}
use of alluxio.underfs.UnderFileSystemConfiguration in project alluxio by Alluxio.
the class UfsIOBench method cleanUp.
private void cleanUp() throws IOException {
UnderFileSystemConfiguration ufsConf = UnderFileSystemConfiguration.defaults(mConf).createMountSpecificConf(mParameters.mConf);
UnderFileSystem ufs = UnderFileSystem.Factory.create(mDataDir, ufsConf);
for (int i = 0; i < mParameters.mThreads; i++) {
ufs.deleteFile(getFilePath(i));
}
}
use of alluxio.underfs.UnderFileSystemConfiguration 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);
}
}
use of alluxio.underfs.UnderFileSystemConfiguration 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);
}
}
use of alluxio.underfs.UnderFileSystemConfiguration in project alluxio by Alluxio.
the class S3AUnderFileSystemTest method getPermissionsWithMapping.
@Test
public void getPermissionsWithMapping() throws Exception {
Map<PropertyKey, Object> conf = new HashMap<>();
conf.put(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING, "111=altname");
try (Closeable c = new ConfigurationRule(conf, sConf).toResource()) {
UnderFileSystemConfiguration ufsConf = UnderFileSystemConfiguration.defaults(sConf);
mS3UnderFileSystem = new S3AUnderFileSystem(new AlluxioURI("s3a://" + BUCKET_NAME), mClient, BUCKET_NAME, mExecutor, mManager, UnderFileSystemConfiguration.defaults(sConf), false);
}
Mockito.when(mClient.getS3AccountOwner()).thenReturn(new Owner("111", "test"));
Mockito.when(mClient.getBucketAcl(Mockito.anyString())).thenReturn(new AccessControlList());
ObjectUnderFileSystem.ObjectPermissions permissions = mS3UnderFileSystem.getPermissions();
Assert.assertEquals("altname", permissions.getOwner());
Assert.assertEquals("altname", permissions.getGroup());
Assert.assertEquals(0, permissions.getMode());
}
Aggregations