use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method createDirectory.
@Test
public void createDirectory() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
Map<String, String> params = new HashMap<>();
params.put("path", uri.toString());
params.put("persisted", "false");
params.put("recursive", "false");
params.put("allowExists", "false");
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.CREATE_DIRECTORY), params, HttpMethod.POST, null).run();
Assert.assertTrue(mFileSystemMaster.listStatus(uri, ListStatusOptions.defaults()).isEmpty());
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method unmount.
@Test
public void unmount() throws Exception {
AlluxioURI uri = new AlluxioURI("/mount");
mFileSystemMaster.mount(uri, new AlluxioURI(mFolder.newFolder().getAbsolutePath()), MountOptions.defaults());
Map<String, String> params = new HashMap<>();
params.put("path", uri.toString());
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.UNMOUNT), params, HttpMethod.POST, null).run();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method scheduleAsyncPersist.
@Test
public void scheduleAsyncPersist() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
mFileSystemMaster.createFile(uri, CreateFileOptions.defaults());
mFileSystemMaster.completeFile(uri, CompleteFileOptions.defaults());
Map<String, String> params = new HashMap<>();
params.put("path", uri.toString());
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.SCHEDULE_ASYNC_PERSIST), params, HttpMethod.POST, null).run();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method rename.
@Test
public void rename() throws Exception {
AlluxioURI uri1 = new AlluxioURI("/file1");
AlluxioURI uri2 = new AlluxioURI("/file2");
mFileSystemMaster.createFile(uri1, CreateFileOptions.defaults());
mFileSystemMaster.completeFile(uri1, CompleteFileOptions.defaults());
Map<String, String> params = new HashMap<>();
params.put("srcPath", uri1.toString());
params.put("dstPath", uri2.toString());
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.RENAME), params, HttpMethod.POST, null).run();
try {
mFileSystemMaster.getFileInfo(uri1);
Assert.fail("file should have been removed");
} catch (FileDoesNotExistException e) {
// Expected
}
mFileSystemMaster.getFileInfo(uri2);
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method ttlCreateFile.
@Test
public void ttlCreateFile() throws Exception {
mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
long ttl = 100;
CreateFileOptions options = CreateFileOptions.defaults().setTtl(ttl);
options.setTtlAction(TtlAction.FREE);
try (LockedInodePath inodePath = mInodeTree.lockInodePath(new AlluxioURI("/testFolder/testFile"), InodeTree.LockMode.WRITE)) {
mFsMaster.createFileInternal(inodePath, options);
}
FileInfo folderInfo = mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFolder/testFile")));
Assert.assertEquals(ttl, folderInfo.getTtl());
Assert.assertEquals(TtlAction.FREE, folderInfo.getTtlAction());
}
Aggregations