@Test
public void testParseNodesFromNodeFile() throws Exception {

  String nodeFile = "src/test/resources/nodes.json";
  Set<NodeDetails> nodeDetails = SLSUtils.parseNodesFromNodeFile(
      nodeFile, Resources.createResource(1024, 2));
  Assert.assertEquals(20, nodeDetails.size());
  nodeFile = "src/test/resources/nodes-with-resources.json";
  nodeDetails = SLSUtils.parseNodesFromNodeFile(
      nodeFile, Resources.createResource(1024, 2));
  Assert.assertEquals(4, nodeDetails.size());
  for (NodeDetails nodeDetail : nodeDetails) {
    if (nodeDetail.getHostname().equals("/rack1/node1")) {
      Assert.assertEquals(2048,
          nodeDetail.getNodeResource().getMemorySize());
      Assert.assertEquals(6,
          nodeDetail.getNodeResource().getVirtualCores());
    } else if (nodeDetail.getHostname().equals("/rack1/node2")) {
      Assert.assertEquals(1024,
          nodeDetail.getNodeResource().getMemorySize());
      Assert.assertEquals(2,
          nodeDetail.getNodeResource().getVirtualCores());
      Assert.assertNull(nodeDetail.getLabels());
    } else if (nodeDetail.getHostname().equals("/rack1/node3")) {
      Assert.assertEquals(1024,
          nodeDetail.getNodeResource().getMemorySize());
      Assert.assertEquals(2,
          nodeDetail.getNodeResource().getVirtualCores());
      Assert.assertEquals(2, nodeDetail.getLabels().size());
      for (NodeLabel nodeLabel : nodeDetail.getLabels()) {
        if (nodeLabel.getName().equals("label1")) {
          Assert.assertTrue(nodeLabel.isExclusive());
        } else if(nodeLabel.getName().equals("label2")) {
          Assert.assertFalse(nodeLabel.isExclusive());
        } else {
          Assert.assertTrue("Unexepected label", false);
        }
      }
    } else if (nodeDetail.getHostname().equals("/rack1/node4")) {
      Assert.assertEquals(6144,
          nodeDetail.getNodeResource().getMemorySize());
      Assert.assertEquals(12,
          nodeDetail.getNodeResource().getVirtualCores());
      Assert.assertEquals(2, nodeDetail.getLabels().size());
    }
  }
}