@Test
public void testRefreshAdminAcls() throws Exception {

  // Setting current user to admin acl
  conf.set(JHAdminConfig.JHS_ADMIN_ACL, UserGroupInformation.getCurrentUser()
      .getUserName());
  String[] args = new String[1];
  args[0] = "-refreshAdminAcls";
  hsAdminClient.run(args);
  // Now I should be able to run any hsadmin command without any exception
  // being thrown
  args[0] = "-refreshSuperUserGroupsConfiguration";
  hsAdminClient.run(args);
  // Lets remove current user from admin acl
  conf.set(JHAdminConfig.JHS_ADMIN_ACL, "notCurrentUser");
  args[0] = "-refreshAdminAcls";
  hsAdminClient.run(args);
  // Now I should get an exception if i run any hsadmin command
  Throwable th = null;
  args[0] = "-refreshSuperUserGroupsConfiguration";
  try {
    hsAdminClient.run(args);
  } catch (Exception e) {
    th = e;
  }
  assertTrue(th instanceof RemoteException);
}