@Test public void lastModificationTimeCompleteFileTest() throws Exception { long fileId = mFsMaster.createFile(new AlluxioURI("/testFile"), CreateFileOptions.defaults()); long opTimeMs = TEST_CURRENT_TIME; try (LockedInodePath inodePath = mInodeTree.lockFullInodePath(new AlluxioURI("/testFile"), InodeTree.LockMode.WRITE)) { mFsMaster.completeFileInternal(new ArrayList<Long>(), inodePath, 0, opTimeMs); } FileInfo fileInfo = mFsMaster.getFileInfo(fileId); Assert.assertEquals(opTimeMs, fileInfo.getLastModificationTimeMs()); }
@Test public void lastModificationTimeCreateFileTest() throws Exception { mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults()); long opTimeMs = TEST_CURRENT_TIME; 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()); }
@Test public void lastModificationTimeRenameTest() throws Exception { mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults()); long fileId = mFsMaster.createFile(new AlluxioURI("/testFolder/testFile1"), CreateFileOptions.defaults()); long opTimeMs = TEST_CURRENT_TIME; try (InodePathPair inodePathPair = mInodeTree.lockInodePathPair( new AlluxioURI("/testFolder/testFile1"), InodeTree.LockMode.WRITE_PARENT, new AlluxioURI("/testFolder/testFile2"), InodeTree.LockMode.WRITE)) { LockedInodePath srcPath = inodePathPair.getFirst(); LockedInodePath dstPath = inodePathPair.getSecond(); mFsMaster.renameInternal(srcPath, dstPath, true, opTimeMs); } FileInfo folderInfo = mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFolder"))); Assert.assertEquals(opTimeMs, folderInfo.getLastModificationTimeMs()); }