@Override
  public void setConf(Configuration conf) {
    this.conf = conf;
    uid = conf.getInt(UID, 0);
    user = conf.get(USER);
    if (null == user) {
      try {
        user = UserGroupInformation.getCurrentUser().getShortUserName();
      } catch (IOException e) {
        user = "hadoop";
      }
    }
    gid = conf.getInt(GID, 1);
    group = conf.get(GROUP);
    if (null == group) {
      group = user;
    }

    resetUGInfo();
    addUser(user, uid);
    addGroup(group, gid);
  }
@Test
  public void testDefault() {
    String user;
    try {
      user = UserGroupInformation.getCurrentUser().getShortUserName();
    } catch (IOException e) {
      user = "hadoop";
    }
    Configuration conf = new Configuration(false);
    ugi.setConf(conf);
    Map<Integer, String> ids = ugi.ugiMap();
    assertEquals(2, ids.size());
    assertEquals(user, ids.get(0));
    assertEquals(user, ids.get(1));
  }