SchedConfCLI extends Configured implements Tool { @VisibleForTesting void globalUpdates(String args, SchedConfUpdateInfo updateInfo) { if (args == null) { return; } HashMap<String, String> globalUpdates = new HashMap<>(); for (String globalUpdate : args.split(SPLIT_BY_SLASH_COMMA)) { globalUpdate = globalUpdate.replace("\\", ""); putKeyValuePair(globalUpdates, globalUpdate); } updateInfo.setGlobalParams(globalUpdates); } SchedConfCLI(); static void main(String[] args); @Override int run(String[] args);  }
@Test(timeout = 10000) public void testGlobalUpdate() { SchedConfUpdateInfo schedUpdateInfo = new SchedConfUpdateInfo(); cli.globalUpdates("schedKey1=schedVal1,schedKey2=schedVal2", schedUpdateInfo); Map<String, String> paramValues = new HashMap<>(); paramValues.put("schedKey1", "schedVal1"); paramValues.put("schedKey2", "schedVal2"); validateGlobalParams(schedUpdateInfo, paramValues); }
@Test(timeout = 10000) public void testGlobalUpdateWithCommaInValue() { SchedConfUpdateInfo schedUpdateInfo = new SchedConfUpdateInfo(); cli.globalUpdates( "schedKey1=schedVal1.1\\,schedVal1.2 schedVal1.3,schedKey2=schedVal2", schedUpdateInfo); Map<String, String> paramValues = new HashMap<>(); paramValues.put("schedKey1", "schedVal1.1,schedVal1.2 schedVal1.3"); paramValues.put("schedKey2", "schedVal2"); validateGlobalParams(schedUpdateInfo, paramValues); }