use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method getStatus.
@Test
public void getStatus() 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());
String result = new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.GET_STATUS), params, HttpMethod.GET, null).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 FileSystemMasterClientRestApiTest method free.
@Test
public void free() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
// Mark the file as persisted so the "free" works.
mFileSystemMaster.createFile(uri, CreateFileOptions.defaults().setPersisted(true));
mFileSystemMaster.completeFile(uri, CompleteFileOptions.defaults());
Map<String, String> params = new HashMap<>();
params.put("path", uri.toString());
params.put("recursive", "false");
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.FREE), params, HttpMethod.POST, null).run();
}
use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method setAttribute.
@Test
public void setAttribute() 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());
params.put("pinned", "true");
params.put("ttl", "100000");
params.put("ttlAction", TtlAction.DELETE.toString());
params.put("persisted", "true");
params.put("recursive", "false");
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.SET_ATTRIBUTE), params, HttpMethod.POST, null).run();
FileInfo fileInfo = mFileSystemMaster.getFileInfo(uri);
Assert.assertEquals(uri.toString(), fileInfo.getPath());
Assert.assertTrue(fileInfo.isPinned());
Assert.assertEquals(100000, fileInfo.getTtl());
Assert.assertEquals(TtlAction.DELETE, fileInfo.getTtlAction());
Assert.assertTrue(fileInfo.isPersisted());
}
use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method completeFile.
@Test
public void completeFile() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
long id = mFileSystemMaster.createFile(uri, CreateFileOptions.defaults());
Map<String, String> params = new HashMap<>();
params.put("path", uri.toString());
params.put("ufsLength", "1");
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.COMPLETE_FILE), params, HttpMethod.POST, null).run();
Assert.assertTrue(mFileSystemMaster.getFileInfo(id).isCompleted());
}
use of alluxio.rest.TestCase in project alluxio by Alluxio.
the class FileSystemMasterClientRestApiTest method getNewBlockIdForFile.
@Test
public void getNewBlockIdForFile() throws Exception {
AlluxioURI uri = new AlluxioURI("/file");
mFileSystemMaster.createFile(uri, CreateFileOptions.defaults());
Map<String, String> params = new HashMap<>();
params.put("path", uri.toString());
new TestCase(mHostname, mPort, getEndpoint(FileSystemMasterClientRestServiceHandler.GET_NEW_BLOCK_ID_FOR_FILE), params, HttpMethod.POST, null).call();
}
Aggregations