use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method lastModificationTimeCreateFile.
@Test
public void lastModificationTimeCreateFile() throws Exception {
mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
long opTimeMs = TEST_TIME_MS;
CreateFileOptions options = CreateFileOptions.defaults().setOperationTimeMs(opTimeMs);
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")));
Assert.assertEquals(opTimeMs, folderInfo.getLastModificationTimeMs());
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method ttlExpiredCreateFileWithFreeActionTest.
@Test
public void ttlExpiredCreateFileWithFreeActionTest() throws Exception {
mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
long ttl = 1;
CreateFileOptions options = CreateFileOptions.defaults().setPersisted(true).setTtl(ttl).setTtlAction(TtlAction.FREE);
long fileId = mFsMaster.createFile(new AlluxioURI("/testFolder/testFile1"), options);
FileInfo folderInfo = mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFolder/testFile1")));
Assert.assertEquals(fileId, folderInfo.getFileId());
Assert.assertEquals(ttl, folderInfo.getTtl());
Assert.assertEquals(TtlAction.FREE, folderInfo.getTtlAction());
// Sleep for the ttl expiration.
CommonUtils.sleepMs(2 * TTL_CHECKER_INTERVAL_MS);
HeartbeatScheduler.await(HeartbeatContext.MASTER_TTL_CHECK, 10, TimeUnit.SECONDS);
HeartbeatScheduler.schedule(HeartbeatContext.MASTER_TTL_CHECK);
HeartbeatScheduler.await(HeartbeatContext.MASTER_TTL_CHECK, 10, TimeUnit.SECONDS);
FileInfo fileInfo = mFsMaster.getFileInfo(fileId);
Assert.assertEquals(Constants.NO_TTL, fileInfo.getTtl());
Assert.assertEquals(TtlAction.DELETE, fileInfo.getTtlAction());
}
use of alluxio.wire.FileInfo 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.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method clientFileInfoDirectory.
@Test
public void clientFileInfoDirectory() throws Exception {
AlluxioURI path = new AlluxioURI("/testFolder");
mFsMaster.createDirectory(path, CreateDirectoryOptions.defaults());
long fileId = mFsMaster.getFileId(path);
FileInfo fileInfo = mFsMaster.getFileInfo(fileId);
Assert.assertEquals("testFolder", fileInfo.getName());
Assert.assertEquals(1, fileInfo.getFileId());
Assert.assertEquals(0, fileInfo.getLength());
Assert.assertFalse(fileInfo.isCacheable());
Assert.assertTrue(fileInfo.isCompleted());
Assert.assertTrue(fileInfo.isFolder());
Assert.assertFalse(fileInfo.isPersisted());
Assert.assertFalse(fileInfo.isPinned());
Assert.assertEquals("", fileInfo.getOwner());
Assert.assertEquals(0755, (short) fileInfo.getMode());
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method createDirectory.
@Test
public void createDirectory() throws Exception {
mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
FileInfo fileInfo = mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFolder")));
Assert.assertTrue(fileInfo.isFolder());
Assert.assertEquals("", fileInfo.getOwner());
Assert.assertEquals(0755, (short) fileInfo.getMode());
}
Aggregations