RMAdminCLI extends HAAdmin { private int removeFromClusterNodeLabels(String args) throws IOException, YarnException { Set<String> labels = new HashSet<String>(); for (String p : args.split(",")) { labels.add(p); } if (directlyAccessNodeLabelStore) { getNodeLabelManagerInstance(getConf()).removeFromClusterNodeLabels( labels); } else { ResourceManagerAdministrationProtocol adminProtocol = createAdminProtocol(); RemoveFromClusterNodeLabelsRequest request = RemoveFromClusterNodeLabelsRequest.newInstance(labels); adminProtocol.removeFromClusterNodeLabels(request); } return 0; } RMAdminCLI();  RMAdminCLI(Configuration conf); @Override int run(String[] args); @Override void setConf(Configuration conf); static void main(String[] args);  }
@Test public void testRemoveFromClusterNodeLabels() throws Exception { dummyNodeLabelsManager.addToCluserNodeLabels(ImmutableSet.of("x")); String[] args = { "-removeFromClusterNodeLabels", "x", "-directlyAccessNodeLabelStore" }; assertEquals(0, rmAdminCLI.run(args)); assertTrue(dummyNodeLabelsManager.getClusterNodeLabels().isEmpty()); args = new String[] { "-removeFromClusterNodeLabels" }; assertTrue(0 != rmAdminCLI.run(args)); args = new String[] { "-removeFromClusterNodeLabels", "-directlyAccessNodeLabelStore" }; assertTrue(0 != rmAdminCLI.run(args)); }