@Test public void givenAnExistingDashboardWhenParseMethodIsCalledThenTheDashboardIsImported() { assertDoesNotThrow(() -> { JGrafana dash = JGrafana.parse(readStandardDashboard()); }); }
public static JGrafana parse(String dashboard) throws IOException { ObjectMapper mapper = new ObjectMapper(); GrafanaDashboard dash = mapper.readValue(dashboard, GrafanaDashboard.class); for (int i = 0; i < dash.panels.size(); i++) { GrafanaPanel p = dash.panels.get(i); p.id = i + 1; p.gridPos = GridPosFactory.calculateGridPosById(i + 1); } return new JGrafana(dash); }
JGrafana { public static JGrafana parse(String dashboard) throws IOException { ObjectMapper mapper = new ObjectMapper(); GrafanaDashboard dash = mapper.readValue(dashboard, GrafanaDashboard.class); for (int i = 0; i < dash.panels.size(); i++) { GrafanaPanel p = dash.panels.get(i); p.id = i + 1; p.gridPos = GridPosFactory.calculateGridPosById(i + 1); } return new JGrafana(dash); } }
JGrafana { public static JGrafana parse(String dashboard) throws IOException { ObjectMapper mapper = new ObjectMapper(); GrafanaDashboard dash = mapper.readValue(dashboard, GrafanaDashboard.class); for (int i = 0; i < dash.panels.size(); i++) { GrafanaPanel p = dash.panels.get(i); p.id = i + 1; p.gridPos = GridPosFactory.calculateGridPosById(i + 1); } return new JGrafana(dash); } JGrafana(String title);  JGrafana(String title, String uuid);  JGrafana(GrafanaDashboard dashboard); }
JGrafana { public static JGrafana parse(String dashboard) throws IOException { ObjectMapper mapper = new ObjectMapper(); GrafanaDashboard dash = mapper.readValue(dashboard, GrafanaDashboard.class); for (int i = 0; i < dash.panels.size(); i++) { GrafanaPanel p = dash.panels.get(i); p.id = i + 1; p.gridPos = GridPosFactory.calculateGridPosById(i + 1); } return new JGrafana(dash); } JGrafana(String title);  JGrafana(String title, String uuid);  JGrafana(GrafanaDashboard dashboard); static JGrafana parse(String dashboard); GrafanaDashboard getDashboard(); GrafanaPanel addPanel(PanelType type, String title, String expr); boolean removePanelByTitle(String title); GrafanaPanel addPanel(PanelType type, String title, String expr, SortedMap<Integer, GrafanaFunction> functions, List<YAxis> yaxes); GrafanaPanel getPanelByTitle(String title); JGrafana setTitle(String title); JGrafana addLink(String title, String url); void writeToFile(File file); String serialize(); }
JGrafana { public static JGrafana parse(String dashboard) throws IOException { ObjectMapper mapper = new ObjectMapper(); GrafanaDashboard dash = mapper.readValue(dashboard, GrafanaDashboard.class); for (int i = 0; i < dash.panels.size(); i++) { GrafanaPanel p = dash.panels.get(i); p.id = i + 1; p.gridPos = GridPosFactory.calculateGridPosById(i + 1); } return new JGrafana(dash); } JGrafana(String title);  JGrafana(String title, String uuid);  JGrafana(GrafanaDashboard dashboard); static JGrafana parse(String dashboard); GrafanaDashboard getDashboard(); GrafanaPanel addPanel(PanelType type, String title, String expr); boolean removePanelByTitle(String title); GrafanaPanel addPanel(PanelType type, String title, String expr, SortedMap<Integer, GrafanaFunction> functions, List<YAxis> yaxes); GrafanaPanel getPanelByTitle(String title); JGrafana setTitle(String title); JGrafana addLink(String title, String url); void writeToFile(File file); String serialize();  }