SLSUtils { public static Set<NodeDetails> generateNodes(int numNodes, int numRacks){ Set<NodeDetails> nodeSet = new HashSet<>(); if (numRacks < 1) { numRacks = 1; } if (numRacks > numNodes) { numRacks = numNodes; } for (int i = 0; i < numNodes; i++) { nodeSet.add(new NodeDetails( "/rack" + i % numRacks + "/node" + i)); } return nodeSet; }  static String[] getRackHostName(String hostname); static Set<NodeDetails> parseNodesFromRumenTrace(
      String jobTrace); static Set<NodeDetails> parseNodesFromSLSTrace(
      String jobTrace); static Set<NodeDetails> parseNodesFromNodeFile(
      String nodeFile, Resource nmDefaultResource); static Set<NodeDetails> generateNodes(int numNodes,
      int numRacks); final static String DEFAULT_JOB_TYPE; }
@Test public void testGenerateNodes() { Set<NodeDetails> nodes = SLSUtils.generateNodes(3, 3); Assert.assertEquals("Number of nodes is wrong.", 3, nodes.size()); Assert.assertEquals("Number of racks is wrong.", 3, getNumRack(nodes)); nodes = SLSUtils.generateNodes(3, 1); Assert.assertEquals("Number of nodes is wrong.", 3, nodes.size()); Assert.assertEquals("Number of racks is wrong.", 1, getNumRack(nodes)); nodes = SLSUtils.generateNodes(3, 4); Assert.assertEquals("Number of nodes is wrong.", 3, nodes.size()); Assert.assertEquals("Number of racks is wrong.", 3, getNumRack(nodes)); nodes = SLSUtils.generateNodes(3, 0); Assert.assertEquals("Number of nodes is wrong.", 3, nodes.size()); Assert.assertEquals("Number of racks is wrong.", 1, getNumRack(nodes)); }