public GraphTree getGraphTree() { GraphTree gt = GraphTree.makeGraph(name); for(Map.Entry<String, List<String>> e: paths.entrySet()) { String id = e.getKey(); List<String> path = e.getValue(); GraphNode gn = hostlist.getGraphById(id.hashCode()); if(gn == null) { logger.warn(jrds.Util.delayedFormatString("Graph not found for %s: %s", name, id)); continue; } gt.addGraphByPath(path, gn); } return gt; } }
public void addGraphs(Collection<GraphNode> graphs) { for(GraphNode currGraph: graphs) { LinkedList<String> path; path = currGraph.getTreePathByHost(); getGraphTreeByHost().addGraphByPath(path, currGraph); path = currGraph.getTreePathByView(); getGraphTreeByView().addGraphByPath(path, currGraph); graphMap.put(currGraph.hashCode(), currGraph); } }
@Test public void test1() { GraphTree gt1 = GraphTree.makeGraph("root"); GraphNode gn = new MockGraph(); gt1.addGraphByPath(doList("a", "b", gn.getName()), gn); Assert.assertNotNull("Graph node not found", gt1.getByPath("root", "a", "b")); }