public Map<String, GraphDesc> setGraphDescMap() { Map<String, JrdsDocument> nodemap = load.getRepository(ConfigType.GRAPHDESC); GraphDescBuilder ob = new GraphDescBuilder(); ob.setPm(pm); graphDescMap = getObjectMap(ob, nodemap); logger.debug(jrds.Util.delayedFormatString("Graph description configured: %s", graphDescMap.keySet())); return graphDescMap; }
public Map<String, GraphDesc> setGrapMap() { Map<String, JrdsDocument> nodemap = load.getRepository(ConfigType.GRAPH); GraphDescBuilder ob = new GraphDescBuilder(); ob.setPm(pm); Map<String, GraphDesc> graphsMap = getObjectMap(ob, nodemap); logger.debug(jrds.Util.delayedFormatString("Graphs configured: %s", graphsMap.keySet())); return graphsMap; }
@Test public void testGraphDescBuilderParse() throws Exception { JrdsDocument d = Tools.parseRessource("graphdesc.xml"); GraphDescBuilder gdbuild = new GraphDescBuilder(); gdbuild.setPm(Tools.makePm(testFolder)); @SuppressWarnings("unused") GraphDesc gd = gdbuild.build(d); }
@Test(expected = NoSuchMethodException.class) public void testBadGraphDescClass() throws Exception { JrdsDocument d = Tools.parseRessource("graphdesc.xml"); d.getRootElement().getElementbyName("graphClass").setTextContent(String.class.getName()); GraphDescBuilder gdbuild = new GraphDescBuilder(); gdbuild.setPm(Tools.makePm(testFolder)); @SuppressWarnings("unused") GraphDesc gd = gdbuild.makeGraphDesc(d); }
@Test(expected = IllegalArgumentException.class) public void testEmptyGraphDescClass() throws Exception { JrdsDocument d = Tools.parseRessource("graphdesc.xml"); d.getRootElement().getElementbyName("graphClass").setTextContent(""); GraphDescBuilder gdbuild = new GraphDescBuilder(); gdbuild.setPm(Tools.makePm(testFolder)); @SuppressWarnings("unused") GraphDesc gd = gdbuild.makeGraphDesc(d); }
@Test public void loadGraph() throws Exception { JrdsDocument d = Tools.parseRessource("customgraph.xml"); GraphDescBuilder builder = new GraphDescBuilder(); builder.setPm(new PropertiesManager()); GraphDesc gd = (GraphDesc) builder.build(d); Assert.assertEquals("name", gd.getName()); Assert.assertEquals("graphName", gd.getGraphName()); Assert.assertEquals("", gd.getGraphTitle()); Assert.assertTrue(gd.isSiUnit()); Assert.assertEquals("verticalLabel", gd.getVerticalLabel()); GraphNode gn = new GraphNode(GetMoke.getProbe(), gd); logger.debug(gd.getHostTree(gn)); logger.debug(gd.getViewTree(gn)); }
PropertiesManager pm = Tools.makePm(testFolder); JrdsDocument d = Tools.parseRessource("graphdesc.xml"); GraphDescBuilder gdbuild = new GraphDescBuilder(); gdbuild.setPm(pm); GraphDesc gd = gdbuild.build(d);
@Test public void loadGraphDesc() throws Exception { JrdsDocument d = Tools.parseRessource("graphdesc2.xml"); GraphDescBuilder builder = new GraphDescBuilder(); builder.setPm(new PropertiesManager()); GraphDesc gd = (GraphDesc) builder.build(d); Assert.assertEquals("mokegraph", gd.getName()); Assert.assertEquals("mokegraphname", gd.getGraphName()); Assert.assertEquals("mokegraphtitle", gd.getGraphTitle()); Assert.assertTrue(gd.isSiUnit()); Assert.assertEquals("verticallabel", gd.getVerticalLabel()); GraphNode gn = new GraphNode(GetMoke.getProbe(), gd); logger.debug(gd.getHostTree(gn)); logger.debug(gd.getViewTree(gn)); }
@Test public void testCustomGraph() throws Exception { JrdsDocument d = Tools.parseRessource("customgraph.xml"); GraphDescBuilder gdbuild = new GraphDescBuilder(); gdbuild.setPm(Tools.makePm(testFolder)); GraphDesc gd = gdbuild.makeGraphDesc(d); Assert.assertEquals("graph name failed", "graphName", gd.getGraphName()); Assert.assertEquals("graph title failed", "", gd.getGraphTitle()); Assert.assertEquals("graph name failed", "name", gd.getName()); Assert.assertEquals("graph height invalid", 800, gd.getHeight()); Assert.assertEquals("graph width invalid", 600, gd.getWidth()); Assert.assertTrue("Lower limit is a number (not a NaN)" + gd.getUpperLimit(), Double.isNaN(gd.getUpperLimit())); Assert.assertEquals("graph lower limit is invalid", 1000, gd.getLowerLimit(), 0.1); Assert.assertFalse("graph is with legend", gd.withLegend()); Assert.assertFalse("graph is with summary", gd.withSummary()); Assert.assertEquals("legend count failed", 0, gd.getLegendLines()); }