ShellBasedIdMapping implements IdMappingServiceProvider { @VisibleForTesting public long getTimeout() { return timeout; } @VisibleForTesting  ShellBasedIdMapping(Configuration conf,
      boolean constructFullMapAtInit);  ShellBasedIdMapping(Configuration conf); @VisibleForTesting long getTimeout(); @VisibleForTesting BiMap<Integer, String> getUidNameMap(); @VisibleForTesting BiMap<Integer, String> getGidNameMap(); @VisibleForTesting synchronized void clearNameMaps(); @VisibleForTesting static boolean updateMapInternal(BiMap<Integer, String> map,
      String mapName, String command, String regex,
      Map<Integer, Integer> staticMapping); synchronized void updateMaps(); synchronized int getUid(String user); synchronized int getGid(String group); synchronized String getUserName(int uid, String unknown); synchronized String getGroupName(int gid, String unknown); int getUidAllowingUnknown(String user); int getGidAllowingUnknown(String group);  }
@Test public void testUserUpdateSetting() throws IOException { ShellBasedIdMapping iug = new ShellBasedIdMapping(new Configuration()); assertThat(iug.getTimeout()).isEqualTo( IdMappingConstant.USERGROUPID_UPDATE_MILLIS_DEFAULT); Configuration conf = new Configuration(); conf.setLong(IdMappingConstant.USERGROUPID_UPDATE_MILLIS_KEY, 0); iug = new ShellBasedIdMapping(conf); assertThat(iug.getTimeout()).isEqualTo( IdMappingConstant.USERGROUPID_UPDATE_MILLIS_MIN); conf.setLong(IdMappingConstant.USERGROUPID_UPDATE_MILLIS_KEY, IdMappingConstant.USERGROUPID_UPDATE_MILLIS_DEFAULT * 2); iug = new ShellBasedIdMapping(conf); assertThat(iug.getTimeout()).isEqualTo( IdMappingConstant.USERGROUPID_UPDATE_MILLIS_DEFAULT * 2); }