public static Path getStagingDir(Cluster cluster, Configuration conf)
      throws IOException, InterruptedException {
    UserGroupInformation user = UserGroupInformation.getLoginUser();
    return getStagingDir(cluster, conf, user);
  }
@Test
  public void testGetStagingDirWhenFullFileOwnerNameAndFullUserName()
      throws IOException, InterruptedException {
    Cluster cluster = mock(Cluster.class);
    Configuration conf = new Configuration();
    Path stagingPath = mock(Path.class);
    UserGroupInformation user = UserGroupInformation
        .createUserForTesting(USER_1, GROUP_NAMES);
    assertEquals(USER_1, user.getUserName());
    FileSystem fs = new FileSystemTestHelper.MockFileSystem();
    when(cluster.getStagingAreaDir()).thenReturn(stagingPath);
    when(stagingPath.getFileSystem(conf)).thenReturn(fs);

    //Staging directory owner full principal name is in lower case.
    String stagingDirOwner = USER_1.toLowerCase();
    FileStatus fileStatus = new FileStatus(1, true, 1, 1, 100L, 100L,
        FsPermission.getDefault(), stagingDirOwner, stagingDirOwner,
        stagingPath);
    when(fs.getFileStatus(stagingPath)).thenReturn(fileStatus);
    assertEquals(stagingPath,
        JobSubmissionFiles.getStagingDir(cluster, conf, user));

    //Staging directory owner full principal name in upper and lower case
    stagingDirOwner = USER_1;
    fileStatus = new FileStatus(1, true, 1, 1, 100L, 100L,
        FsPermission.getDefault(), stagingDirOwner, stagingDirOwner,
        stagingPath);
    when(fs.getFileStatus(stagingPath)).thenReturn(fileStatus);
    assertEquals(stagingPath,
        JobSubmissionFiles.getStagingDir(cluster, conf, user));
  }