public static String getPersistentTmpPath(AlluxioConfiguration ufsConfiguration,
      String path) {
    StringBuilder tempFilePath = new StringBuilder();
    StringBuilder tempFileName = new StringBuilder();
    String fileName = FilenameUtils.getName(path);
    String timeStamp = String.valueOf(System.currentTimeMillis());
    String uuid = UUID.randomUUID().toString();
    String tempDir = ufsConfiguration
          .getString(PropertyKey.UNDERFS_PERSISTENCE_ASYNC_TEMP_DIR);
    tempFilePath.append(tempDir);
    tempFilePath.append(AlluxioURI.SEPARATOR);
    tempFileName.append(fileName);
    tempFileName.append(".alluxio.");
    tempFileName.append(timeStamp);
    tempFileName.append(".");
    tempFileName.append(uuid);
    tempFileName.append(".tmp");
    tempFilePath.append(tempFileName);
    return tempFilePath.toString();
  }
@Test
  public void getPersistentTmpPath() {
    // Get temporary path
    Pattern pattern = Pattern.compile(
        "\\.alluxio_ufs_persistence\\/test\\.parquet\\.alluxio\\.\\d+\\.\\S+\\.tmp");
    AlluxioConfiguration alluxioConfiguration = UnderFileSystemConfiguration.emptyConfig();
    String tempPersistencePath = PathUtils.getPersistentTmpPath(alluxioConfiguration,
        "s3://test/test.parquet");
    assertEquals(pattern.matcher(tempPersistencePath).matches(), true);
    pattern = Pattern.compile(
        "\\.alluxio_ufs_persistence\\/test\\.parquet\\.alluxio\\.\\d+\\.\\S+\\.tmp");
    tempPersistencePath = PathUtils
        .getPersistentTmpPath(alluxioConfiguration, "hdfs://localhost:9010/test/test.parquet");
    assertEquals(pattern.matcher(tempPersistencePath).matches(), true);

    // Get temporary path with root path
    pattern = Pattern.compile(
        "\\.alluxio_ufs_persistence\\/test\\.parquet\\.alluxio\\.\\d+\\.\\S+\\.tmp");
    tempPersistencePath = PathUtils.getPersistentTmpPath(alluxioConfiguration,
        "s3://test.parquet");
    assertEquals(pattern.matcher(tempPersistencePath).matches(), true);
    pattern = Pattern.compile(
        "\\.alluxio_ufs_persistence\\/test\\.parquet\\.alluxio\\.\\d+\\.\\S+\\.tmp");
    tempPersistencePath = PathUtils
        .getPersistentTmpPath(alluxioConfiguration, "hdfs://localhost:9010/test.parquet");
    assertEquals(pattern.matcher(tempPersistencePath).matches(), true);
  }