use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class CpCommandIntegrationTest method copyDirectoryWithPreservedAttributes.
/**
* Tests copying a folder with attributes preserved.
*/
@Test
public void copyDirectoryWithPreservedAttributes() throws Exception {
InstancedConfiguration conf = new InstancedConfiguration(ServerConfiguration.global());
conf.set(PropertyKey.USER_FILE_WRITE_TYPE_DEFAULT, "MUST_CACHE");
try (FileSystemShell fsShell = new FileSystemShell(conf)) {
String testDir = FileSystemShellUtilsTest.resetFileHierarchy(sFileSystem);
String newDir = "/copy";
String subDir = "/foo";
String file = "/foobar4";
String owner = TEST_USER_1.getUser();
String group = "staff";
short mode = 0422;
List<AclEntry> entries = new ArrayList<>();
entries.add(new AclEntry.Builder().setType(AclEntryType.NAMED_USER).setSubject(TEST_USER_2.getUser()).addAction(AclAction.READ).addAction(AclAction.WRITE).addAction(AclAction.EXECUTE).build());
entries.add(new AclEntry.Builder().setType(AclEntryType.NAMED_GROUP).setSubject(group).addAction(AclAction.WRITE).addAction(AclAction.EXECUTE).build());
AlluxioURI srcDir = new AlluxioURI(testDir);
sFileSystem.setAttribute(srcDir, SetAttributePOptions.newBuilder().setRecursive(true).setOwner(owner).setGroup(group).setMode(new Mode(mode).toProto()).setPinned(true).setReplicationMin(2).setReplicationMax(4).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setTtl(12345)).build());
sFileSystem.setAcl(srcDir, SetAclAction.MODIFY, entries, SetAclPOptions.newBuilder().setRecursive(true).build());
int ret = fsShell.run("cp", "-R", "-p", testDir, newDir);
AlluxioURI dstDir = new AlluxioURI(newDir);
Assert.assertEquals(0, ret);
Assert.assertTrue(sFileSystem.exists(dstDir));
verifyPreservedAttributes(srcDir, dstDir);
verifyPreservedAttributes(srcDir.join(subDir), dstDir.join(subDir));
verifyPreservedAttributes(srcDir.join(file), dstDir.join(file));
}
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class TableShell method main.
/**
* Manage Alluxio extensions.
*
* @param args array of arguments given by the user's input from the terminal
*/
public static void main(String[] args) {
TableShell tableShell = new TableShell(new InstancedConfiguration(ConfigurationUtils.defaults()));
System.exit(tableShell.run(args));
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class TransformTableCommandTest method transformInternal.
private void transformInternal(String definition, String expected) throws Exception {
TableMasterClient client = mock(TableMasterClient.class);
when(client.transformTable(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(0L);
TransformTableCommand command = new TransformTableCommand(new InstancedConfiguration(ConfigurationUtils.defaults()), client, null);
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);
if (definition != null) {
command.run(command.parseAndValidateArgs("db", "table", definition));
} else {
command.run(command.parseAndValidateArgs("db", "table"));
}
verify(client).transformTable(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), argumentCaptor.capture());
assertEquals(expected, argumentCaptor.getValue());
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class LocalUnderFileSystemTest method testBrokenSymlinkSkip.
@Test
public void testBrokenSymlinkSkip() throws IOException {
InstancedConfiguration c = new InstancedConfiguration(sConf.copyProperties());
c.set(PropertyKey.UNDERFS_LOCAL_SKIP_BROKEN_SYMLINKS, true);
mLocalUfs = UnderFileSystem.Factory.create(mLocalUfsRoot, UnderFileSystemConfiguration.defaults(c));
Path linkPath = createNonExistentSymlink();
assertTrue(Files.exists(linkPath, LinkOption.NOFOLLOW_LINKS));
assertFalse(Files.exists(linkPath));
UfsStatus[] statuses = mLocalUfs.listStatus(mLocalUfsRoot);
assertNotNull(statuses);
assertEquals(0, statuses.length);
}
use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.
the class LocalUnderFileSystemTest method testSymlinkNonSkip.
@Test
public void testSymlinkNonSkip() throws IOException {
InstancedConfiguration c = new InstancedConfiguration(sConf.copyProperties());
c.set(PropertyKey.UNDERFS_LOCAL_SKIP_BROKEN_SYMLINKS, false);
mLocalUfs = UnderFileSystem.Factory.create(mLocalUfsRoot, UnderFileSystemConfiguration.defaults(c));
Path linkPath = createNonExistentSymlink();
assertTrue(Files.exists(linkPath, LinkOption.NOFOLLOW_LINKS));
assertFalse(Files.exists(linkPath));
assertThrows(NoSuchFileException.class, () -> mLocalUfs.listStatus(mLocalUfsRoot));
}
Aggregations