use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method setAttribute.
@Test
public void setAttribute() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
writeFile(uri, null);
new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.SET_ATTRIBUTE, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(SetAttributeOptions.defaults().setMode(Mode.defaults()))).run();
FileInfo fileInfo = mFileSystemMaster.getFileInfo(uri);
Assert.assertEquals(uri.toString(), fileInfo.getPath());
}
use of alluxio.rest.TestCase 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.rest.TestCase 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.rest.TestCase 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.rest.TestCase 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);
}
Aggregations