use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method unmount.
@Test
public void unmount() throws Exception {
AlluxioURI uri = new AlluxioURI("/mount");
mFileSystemMaster.mount(uri, new AlluxioURI(mFolder.newFolder().getAbsolutePath()), alluxio.master.file.options.MountOptions.defaults());
new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.UNMOUNT, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(UnmountOptions.defaults())).run();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method free.
@Test
public void free() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
writeFile(uri, null);
new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.FREE, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(FreeOptions.defaults())).run();
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method upload.
@Test
public void upload() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
String message = "Greetings traveller!";
writeFile(uri, message.getBytes());
String result = new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.GET_STATUS, NO_PARAMS, HttpMethod.POST, null).call();
FileInfo fileInfo = new ObjectMapper().readValue(result, FileInfo.class);
Assert.assertEquals(message.length(), fileInfo.getLength());
}
use of alluxio.AlluxioURI in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method rename.
@Test
public void rename() throws Exception {
AlluxioURI uri1 = new AlluxioURI("/file1");
AlluxioURI uri2 = new AlluxioURI("/file2");
writeFile(uri1, null);
Map<String, String> params = new HashMap<>();
params.put("dst", uri2.toString());
new TestCase(mHostname, mPort, PATHS_PREFIX + uri1.toString() + "/" + PathsRestServiceHandler.RENAME, params, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(RenameOptions.defaults())).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 ClusterInitializationTest method startCluster.
/**
* When a user starts a new cluster, an empty root dir is created and owned by the user.
*/
@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.SECURITY_LOGIN_USERNAME, SUPER_USER })
public void startCluster() throws Exception {
FileSystem fs = mLocalAlluxioClusterResource.get().getClient();
URIStatus status = fs.getStatus(ROOT);
Assert.assertEquals(SUPER_USER, status.getOwner());
Assert.assertEquals(0755, status.getMode());
Assert.assertEquals(0, fs.listStatus(new AlluxioURI("/")).size());
}
Aggregations