@Test
public void testReplaceLabelsOnNode() throws Exception {

  // Successfully replace labels
  dummyNodeLabelsManager.addToCluserNodeLabels(ImmutableSet.of("x", "y"));
  String[] args =
      { "-replaceLabelsOnNode", "node1,x node2,y",
          "-directlyAccessNodeLabelStore" };
  assertEquals(0, rmAdminCLI.run(args));
  assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
      NodeId.newInstance("node1", 0)));
  assertTrue(dummyNodeLabelsManager.getNodeLabels().containsKey(
      NodeId.newInstance("node2", 0)));
  
  // no labels, should fail
  args = new String[] { "-replaceLabelsOnNode" };
  assertTrue(0 != rmAdminCLI.run(args));
  
  // no labels, should fail
  args =
      new String[] { "-replaceLabelsOnNode",
          "-directlyAccessNodeLabelStore" };
  assertTrue(0 != rmAdminCLI.run(args));
}