@Test
public void testAddNewIncludePathToConfiguration() throws Exception {

  Configuration conf = new Configuration();
  rm = new MockRM(conf);
  rm.start();
  MockNM nm1 = rm.registerNode("host1:1234", 5120);
  MockNM nm2 = rm.registerNode("host2:5678", 10240);
  ClusterMetrics metrics = ClusterMetrics.getMetrics();
  assert(metrics != null);
  int initialMetricCount = metrics.getNumShutdownNMs();
  NodeHeartbeatResponse nodeHeartbeat = nm1.nodeHeartbeat(true);
  Assert.assertEquals(
      NodeAction.NORMAL,
      nodeHeartbeat.getNodeAction());
  nodeHeartbeat = nm2.nodeHeartbeat(true);
  Assert.assertEquals(
      NodeAction.NORMAL,
      nodeHeartbeat.getNodeAction());
  writeToHostsFile("host1");
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH, hostFile
      .getAbsolutePath());
  rm.getNodesListManager().refreshNodes(conf);
  checkShutdownNMCount(rm, ++initialMetricCount);
  nodeHeartbeat = nm1.nodeHeartbeat(true);
  Assert.assertEquals(
      "Node should not have been shutdown.",
      NodeAction.NORMAL,
      nodeHeartbeat.getNodeAction());
  NodeState nodeState =
      rm.getRMContext().getInactiveRMNodes().get(nm2.getNodeId()).getState();
  Assert.assertEquals("Node should have been shutdown but is in state" +
          nodeState, NodeState.SHUTDOWN, nodeState);
}