@Override String toString(Object o) { GraphDesc gd = (GraphDesc) o; return gd.getGraphTitle(); } },
public String getGraphTitle() { if(graphTitle == null) { graphTitle = parseTemplate(gd.getGraphTitle()); } return graphTitle; }
@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 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)); }
Assert.assertEquals("graph title failed", "graphTitle", gd.getGraphTitle()); Assert.assertEquals("graph name failed", "graphdesctest", gd.getName()); Assert.assertEquals("legend count failed", 5, gd.getLegendLines());
@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()); }