static boolean unprotectedSetOwner(
      FSDirectory fsd, INodesInPath iip, String username, String groupname)
      throws FileNotFoundException, UnresolvedLinkException,
      QuotaExceededException, SnapshotAccessControlException {
    assert fsd.hasWriteLock();
    final INode inode = FSDirectory.resolveLastINode(iip);
    long oldPerm = inode.getPermissionLong();
    if (username != null) {
      inode.setUser(username, iip.getLatestSnapshotId());
    }
    if (groupname != null) {
      inode.setGroup(groupname, iip.getLatestSnapshotId());
    }
    return oldPerm != inode.getPermissionLong();
  }
@Test
  public void testUnprotectedSetOwner() throws Exception {
    assertTrue("SetOwner should return true for a new user",
        unprotectedSetAttributes((short) 0777, (short) 0777, "user1",
            "user2", true));
    assertFalse("SetOwner should return false for same user",
        unprotectedSetAttributes((short) 0777, (short) 0777, "user1",
            "user1", true));
  }