@Override
  public FileInfo getFileInfo(String ufsFullPath, GetStatusPOptions options)
      throws IOException, AccessControlException {
    long syncIntervalMs = options.hasCommonOptions()
        ? (options.getCommonOptions().hasSyncIntervalMs()
        ? options.getCommonOptions().getSyncIntervalMs() : -1) :
        -1;
    alluxio.grpc.FileInfo fi = getGrpcFileInfo(ufsFullPath, syncIntervalMs);
    int cachedPercentage = getCachedPercentage(fi, ufsFullPath);

    return GrpcUtils.fromProto(fi)
        .setInAlluxioPercentage(cachedPercentage)
        .setInMemoryPercentage(cachedPercentage);
  }
@Test
  public void testGetFileInfo()
      throws AccessControlException, IOException, ExecutionException, InterruptedException,
      TimeoutException {
    String fileContent = "foobar";
    String updatedFileContent = "foobarbaz";
    File f = mTestFolder.newFile();
    Files.write(f.toPath(), fileContent.getBytes());

    alluxio.wire.FileInfo result =
        mWorker.getFileInfo(f.getPath(), GetStatusPOptions.getDefaultInstance());
    List<PageId> cachedPages =
        mCacheManager.getCachedPageIdsByFileId(
            new AlluxioURI(f.getPath()).hash(), fileContent.length());
    assertEquals(fileContent.length(), result.getLength());
    assertEquals(0, cachedPages.size());
    assertFalse(Strings.isNullOrEmpty(result.getContentHash()));

    loadFileData(f.getPath());

    cachedPages =
        mCacheManager.getCachedPageIdsByFileId(
            new AlluxioURI(f.getPath()).hash(), fileContent.length());
    assertEquals(1, cachedPages.size());
    byte[] buff = new byte[fileContent.length()];
    mCacheManager.get(cachedPages.get(0), fileContent.length(), buff, 0);
    assertEquals(fileContent, new String(buff));

    result = mWorker.getFileInfo(f.getPath(), GET_STATUS_OPTIONS_MUST_SYNC);
    cachedPages =
        mCacheManager.getCachedPageIdsByFileId(
            new AlluxioURI(f.getPath()).hash(), fileContent.length());
    assertEquals(1, cachedPages.size());
    assertEquals(fileContent.length(), result.getLength());

    assertTrue(f.delete());
    assertTrue(f.createNewFile());
    Files.write(f.toPath(), updatedFileContent.getBytes());

    result = mWorker.getFileInfo(f.getPath(), GET_STATUS_OPTIONS_MUST_SYNC);
    cachedPages =
        mCacheManager.getCachedPageIdsByFileId(
            new AlluxioURI(f.getPath()).hash(), updatedFileContent.length());
    assertEquals(0, cachedPages.size());
    assertEquals(updatedFileContent.length(), result.getLength());
    assertFalse(Strings.isNullOrEmpty(result.getContentHash()));

    assertTrue(f.delete());
    result = mWorker.getFileInfo(f.getPath(), GetStatusPOptions.getDefaultInstance());
    assertEquals(0, cachedPages.size());
    assertEquals(updatedFileContent.length(), result.getLength());

    assertThrows(FileNotFoundException.class, () ->
        mWorker.getFileInfo(f.getPath(), GetStatusPOptions.newBuilder().setCommonOptions(
            FileSystemMasterCommonPOptions.newBuilder().setSyncIntervalMs(0)).build()));
  }