@Test public void testStringProperties () { String rawString = "--title='Current TCP Connections' --vertical-label='Current Connections ({ifSpeed})' DEF:currEstab={rrd1}:tcpCurrEstab:AVERAGE DEF:minCurrEstab={rrd1}:tcpCurrEstab:MIN DEF:maxCurrEstab={rrd1}:tcpCurrEstab:MAX LINE2:currEstab#00ff00:'Current ' GPRINT:currEstab:AVERAGE:'Avg \n: %8.2lf %s' GPRINT:currEstab:MIN:'Min \n: %8.2lf %s' GPRINT:currEstab:MAX:'Max \n: %8.2lf %s\n'"; final Map<String,String> properties = new HashMap<String,String>(); properties.put("ifSpeed", "monkey"); final PrefabGraph prefabGraph = new PrefabGraph("foo", "bar", new String[]{}, rawString, new String[]{}, new String[]{}, 0, null, null, null, null, new String[]{}); final String graphString = nrtHelper.cleanUpRrdGraphStringForWebUi(prefabGraph, m_emptyMap, properties); assertTrue(graphString.contains("(monkey)")); }
public String cleanUpRrdGraphStringForWebUi(final PrefabGraph prefabGraph, final Map<String,String> externalPropertyAttributes, final Map<String,String> stringPropertyAttributes) { String graphString = prefabGraph.getCommand(); graphString = "--height=400 " + graphString; graphString = "--width=960 " + graphString; if (!graphString.contains("--slope-mode")) { graphString = "--slope-mode " + graphString; } if (!graphString.contains("--watermark")) { graphString = "--watermark=\"NRTG Alpha 1.0\" " + graphString; } graphString = graphString.replace("\\:", "\\\\\\\\:"); graphString = graphString.replace("\\n", "\\\\\\\\n"); graphString = graphString.replace("\"", "\\\\\""); for (final String key : externalPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", externalPropertyAttributes.get(key)); } for (final String key : stringPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", stringPropertyAttributes.get(key)); } return graphString; }
NrtHelper { public String cleanUpRrdGraphStringForWebUi(final PrefabGraph prefabGraph, final Map<String,String> externalPropertyAttributes, final Map<String,String> stringPropertyAttributes) { String graphString = prefabGraph.getCommand(); graphString = "--height=400 " + graphString; graphString = "--width=960 " + graphString; if (!graphString.contains("--slope-mode")) { graphString = "--slope-mode " + graphString; } if (!graphString.contains("--watermark")) { graphString = "--watermark=\"NRTG Alpha 1.0\" " + graphString; } graphString = graphString.replace("\\:", "\\\\\\\\:"); graphString = graphString.replace("\\n", "\\\\\\\\n"); graphString = graphString.replace("\"", "\\\\\""); for (final String key : externalPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", externalPropertyAttributes.get(key)); } for (final String key : stringPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", stringPropertyAttributes.get(key)); } return graphString; } }
NrtHelper { public String cleanUpRrdGraphStringForWebUi(final PrefabGraph prefabGraph, final Map<String,String> externalPropertyAttributes, final Map<String,String> stringPropertyAttributes) { String graphString = prefabGraph.getCommand(); graphString = "--height=400 " + graphString; graphString = "--width=960 " + graphString; if (!graphString.contains("--slope-mode")) { graphString = "--slope-mode " + graphString; } if (!graphString.contains("--watermark")) { graphString = "--watermark=\"NRTG Alpha 1.0\" " + graphString; } graphString = graphString.replace("\\:", "\\\\\\\\:"); graphString = graphString.replace("\\n", "\\\\\\\\n"); graphString = graphString.replace("\"", "\\\\\""); for (final String key : externalPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", externalPropertyAttributes.get(key)); } for (final String key : stringPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", stringPropertyAttributes.get(key)); } return graphString; }  }
NrtHelper { public String cleanUpRrdGraphStringForWebUi(final PrefabGraph prefabGraph, final Map<String,String> externalPropertyAttributes, final Map<String,String> stringPropertyAttributes) { String graphString = prefabGraph.getCommand(); graphString = "--height=400 " + graphString; graphString = "--width=960 " + graphString; if (!graphString.contains("--slope-mode")) { graphString = "--slope-mode " + graphString; } if (!graphString.contains("--watermark")) { graphString = "--watermark=\"NRTG Alpha 1.0\" " + graphString; } graphString = graphString.replace("\\:", "\\\\\\\\:"); graphString = graphString.replace("\\n", "\\\\\\\\n"); graphString = graphString.replace("\"", "\\\\\""); for (final String key : externalPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", externalPropertyAttributes.get(key)); } for (final String key : stringPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", stringPropertyAttributes.get(key)); } return graphString; }  String cleanUpRrdGraphStringForWebUi(final PrefabGraph prefabGraph, final Map<String,String> externalPropertyAttributes, final Map<String,String> stringPropertyAttributes); String generateJsMappingObject(String rrdCommand, final Map<String, String> rrdGraphAttributesToMetricIds); }
NrtHelper { public String cleanUpRrdGraphStringForWebUi(final PrefabGraph prefabGraph, final Map<String,String> externalPropertyAttributes, final Map<String,String> stringPropertyAttributes) { String graphString = prefabGraph.getCommand(); graphString = "--height=400 " + graphString; graphString = "--width=960 " + graphString; if (!graphString.contains("--slope-mode")) { graphString = "--slope-mode " + graphString; } if (!graphString.contains("--watermark")) { graphString = "--watermark=\"NRTG Alpha 1.0\" " + graphString; } graphString = graphString.replace("\\:", "\\\\\\\\:"); graphString = graphString.replace("\\n", "\\\\\\\\n"); graphString = graphString.replace("\"", "\\\\\""); for (final String key : externalPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", externalPropertyAttributes.get(key)); } for (final String key : stringPropertyAttributes.keySet()) { graphString = graphString.replace("{" + key + "}", stringPropertyAttributes.get(key)); } return graphString; }  String cleanUpRrdGraphStringForWebUi(final PrefabGraph prefabGraph, final Map<String,String> externalPropertyAttributes, final Map<String,String> stringPropertyAttributes); String generateJsMappingObject(String rrdCommand, final Map<String, String> rrdGraphAttributesToMetricIds); final static List<String> RRD_KEYWORDS; }