use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method mount.
@Test
public void mount() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
Map<String, String> params = new HashMap<>();
params.put("src", mFolder.newFolder().getAbsolutePath());
new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.MOUNT, params, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(MountOptions.defaults())).run();
}
use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method readFile.
private byte[] readFile(AlluxioURI path) throws Exception {
String result = new TestCase(mHostname, mPort, PATHS_PREFIX + path.toString() + "/" + PathsRestServiceHandler.OPEN_FILE, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(OpenFileOptions.defaults())).call();
Integer id = new ObjectMapper().readValue(result, Integer.TYPE);
result = new TestCase(mHostname, mPort, STREAMS_PREFIX + id.toString() + "/" + StreamsRestServiceHandler.READ, NO_PARAMS, HttpMethod.POST, null).call();
new TestCase(mHostname, mPort, STREAMS_PREFIX + id.toString() + "/" + StreamsRestServiceHandler.CLOSE, NO_PARAMS, HttpMethod.POST, null).run();
return result.getBytes();
}
use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method getStatus.
@Test
public void getStatus() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
writeFile(uri, null);
String result = new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.GET_STATUS, NO_PARAMS, HttpMethod.POST, TestCaseOptions.defaults().setBody(GetStatusOptions.defaults())).call();
FileInfo fileInfo = new ObjectMapper().readValue(result, FileInfo.class);
Assert.assertEquals(uri.getPath(), fileInfo.getPath());
Assert.assertEquals(0, fileInfo.getLength());
}
use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemClientRestApiTest method createDirectory.
@Test
public void createDirectory() throws Exception {
AlluxioURI uri = new AlluxioURI("/dir");
new TestCase(mHostname, mPort, PATHS_PREFIX + uri.toString() + "/" + PathsRestServiceHandler.CREATE_DIRECTORY, NO_PARAMS, HttpMethod.POST, null, TestCaseOptions.defaults().setBody(CreateDirectoryOptions.defaults())).run();
Assert.assertTrue(mFileSystemMaster.listStatus(uri, alluxio.master.file.options.ListStatusOptions.defaults()).isEmpty());
}
Aggregations