SchedConfCLI extends Configured implements Tool { @VisibleForTesting void addQueues(String args, SchedConfUpdateInfo updateInfo) { if (args == null) { return; } ArrayList<QueueConfigInfo> queueConfigInfos = new ArrayList<>(); for (String arg : args.split(";")) { queueConfigInfos.add(getQueueConfigInfo(arg)); } updateInfo.setAddQueueInfo(queueConfigInfos); } SchedConfCLI(); static void main(String[] args); @Override int run(String[] args);  }
@Test(timeout = 10000) public void testAddQueues() { SchedConfUpdateInfo schedUpdateInfo = new SchedConfUpdateInfo(); cli.addQueues("root.a:a1=aVal1,a2=aVal2,a3=", schedUpdateInfo); QueueConfigInfo addInfo = schedUpdateInfo.getAddQueueInfo().get(0); assertEquals("root.a", addInfo.getQueue()); Map<String, String> params = addInfo.getParams(); assertEquals(3, params.size()); assertEquals("aVal1", params.get("a1")); assertEquals("aVal2", params.get("a2")); assertNull(params.get("a3")); schedUpdateInfo = new SchedConfUpdateInfo(); cli.addQueues("root.b:b1=bVal1;root.c:c1=cVal1", schedUpdateInfo); assertEquals(2, schedUpdateInfo.getAddQueueInfo().size()); QueueConfigInfo bAddInfo = schedUpdateInfo.getAddQueueInfo().get(0); assertEquals("root.b", bAddInfo.getQueue()); Map<String, String> bParams = bAddInfo.getParams(); assertEquals(1, bParams.size()); assertEquals("bVal1", bParams.get("b1")); QueueConfigInfo cAddInfo = schedUpdateInfo.getAddQueueInfo().get(1); assertEquals("root.c", cAddInfo.getQueue()); Map<String, String> cParams = cAddInfo.getParams(); assertEquals(1, cParams.size()); assertEquals("cVal1", cParams.get("c1")); }