コード例 #1
0
  @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());
  }
コード例 #2
0
  @Test
  public void ttlRenameTest() throws Exception {
    mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
    long ttl = 1;
    CreateFileOptions options = CreateFileOptions.defaults().setTtl(ttl);
    long fileId = mFsMaster.createFile(new AlluxioURI("/testFolder/testFile1"), options);

    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, TEST_CURRENT_TIME);
    }
    FileInfo folderInfo =
        mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFolder/testFile2")));
    Assert.assertEquals(ttl, folderInfo.getTtl());
  }