use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method listFiles.
@Test
public void listFiles() throws Exception {
CreateFileOptions options = CreateFileOptions.defaults().setBlockSizeBytes(64);
HashSet<Long> ids = new HashSet<>();
HashSet<Long> dirIds = new HashSet<>();
for (int i = 0; i < 10; i++) {
AlluxioURI dir = new AlluxioURI("/i" + i);
mFsMaster.createDirectory(dir, CreateDirectoryOptions.defaults());
dirIds.add(mFsMaster.getFileId(dir));
for (int j = 0; j < 10; j++) {
ids.add(mFsMaster.createFile(dir.join("j" + j), options));
}
}
HashSet<Long> listedIds = new HashSet<>();
HashSet<Long> listedDirIds = new HashSet<>();
List<FileInfo> infoList = mFsMaster.listStatus(new AlluxioURI("/"), ListStatusOptions.defaults());
for (FileInfo info : infoList) {
long id = info.getFileId();
listedDirIds.add(id);
for (FileInfo fileInfo : mFsMaster.listStatus(new AlluxioURI(info.getPath()), ListStatusOptions.defaults())) {
listedIds.add(fileInfo.getFileId());
}
}
Assert.assertEquals(ids, listedIds);
Assert.assertEquals(dirIds, listedDirIds);
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method lastModificationTimeCompleteFile.
@Test
public void lastModificationTimeCompleteFile() throws Exception {
long fileId = mFsMaster.createFile(new AlluxioURI("/testFile"), CreateFileOptions.defaults());
long opTimeMs = TEST_TIME_MS;
mFsMaster.completeFile(new AlluxioURI("/testFile"), CompleteFileOptions.defaults().setOperationTimeMs(opTimeMs).setUfsLength(0));
FileInfo fileInfo = mFsMaster.getFileInfo(fileId);
Assert.assertEquals(opTimeMs, fileInfo.getLastModificationTimeMs());
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method concurrentCreateJournal.
// TODO(calvin): This test currently relies on the fact the HDFS client is a cached instance to
// avoid invalid lease exception. This should be fixed.
@Ignore
@Test
public void concurrentCreateJournal() throws Exception {
// Makes sure the file id's are the same between a master info and the journal it creates
for (int i = 0; i < 5; i++) {
ConcurrentCreator concurrentCreator = new ConcurrentCreator(DEPTH, CONCURRENCY_DEPTH, ROOT_PATH);
concurrentCreator.call();
FileSystemMaster fsMaster = createFileSystemMasterFromJournal();
for (FileInfo info : mFsMaster.listStatus(new AlluxioURI("/"), ListStatusOptions.defaults())) {
AlluxioURI path = new AlluxioURI(info.getPath());
Assert.assertEquals(mFsMaster.getFileId(path), fsMaster.getFileId(path));
}
before();
}
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method ttlCreateFile.
@Test
public void ttlCreateFile() throws Exception {
mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
long ttl = 100;
CreateFileOptions options = CreateFileOptions.defaults().setTtl(ttl);
options.setTtlAction(TtlAction.FREE);
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/testFile")));
Assert.assertEquals(ttl, folderInfo.getTtl());
Assert.assertEquals(TtlAction.FREE, folderInfo.getTtlAction());
}
use of alluxio.wire.FileInfo in project alluxio by Alluxio.
the class FileSystemMasterIntegrationTest method ttlRename.
@Test
public void ttlRename() throws Exception {
AlluxioURI srcPath = new AlluxioURI("/testFolder/testFile1");
AlluxioURI dstPath = new AlluxioURI("/testFolder/testFile2");
mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
long ttl = 1;
CreateFileOptions createOptions = CreateFileOptions.defaults().setTtl(ttl);
mFsMaster.createFile(srcPath, createOptions);
RenameOptions renameOptions = RenameOptions.defaults().setOperationTimeMs(TEST_TIME_MS);
mFsMaster.rename(srcPath, dstPath, renameOptions);
FileInfo folderInfo = mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFolder/testFile2")));
Assert.assertEquals(ttl, folderInfo.getTtl());
}
Aggregations