public List<HostPort> getGmondSendChannels(String fileName) { try { String conf = readFile(fileName); return getGmondSendChannelsFromConf(conf); } catch (IOException ioe) { log.error("Unable to read gmond config from:" + fileName, ioe); return null; } catch (Exception e) { log.error("Error searching for unicast udp_send_channels. It is possible none are defined in " + fileName, e); return null; } }
public List<HostPort> getGmondSendChannels(String fileName) { try { String conf = readFile(fileName); return getGmondSendChannelsFromConf(conf); } catch (IOException ioe) { log.error("Unable to read gmond config from:" + fileName, ioe); return null; } catch (Exception e) { log.error("Error searching for unicast udp_send_channels. It is possible none are defined in " + fileName, e); return null; } }
public void print() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/comments.conf"); System.out.println(conf); }
public void print() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/comments.conf"); System.out.println(conf); }
@Test public void emptyLines() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/empty-lines.conf"); String expt_conf = g.readFile("src/test/resources/gmond/empty-lines-expt.conf"); String clean = g.removeEmptyLines(conf); assertEquals(expt_conf, clean); }
@Test public void stripAllComments() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/ctest.conf"); String expt_conf = g.readFile("src/test/resources/gmond/ctest-expt.conf"); String clean = g.stripComments(conf); assertEquals(expt_conf, clean); }
@Test public void emptyLines() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/empty-lines.conf"); String expt_conf = g.readFile("src/test/resources/gmond/empty-lines-expt.conf"); String clean = g.removeEmptyLines(conf); assertEquals(expt_conf, clean); }
@Test public void stripAllComments() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/ctest.conf"); String expt_conf = g.readFile("src/test/resources/gmond/ctest-expt.conf"); String clean = g.stripComments(conf); assertEquals(expt_conf, clean); }
@Test public void extractChannel() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/udp-send.conf"); List<String> blobs = g.findSendChannels(conf); //System.out.println(blobs); // two channels, each with 4 config lines assertEquals(2, blobs.size()); assertEquals(4, blobs.get(0).split("\n").length); assertEquals(4, blobs.get(1).split("\n").length); }
@Test public void extractChannel() throws Exception { GmondConfigParser g = new GmondConfigParser(); String conf = g.readFile("src/test/resources/gmond/udp-send.conf"); List<String> blobs = g.findSendChannels(conf); //System.out.println(blobs); // two channels, each with 4 config lines assertEquals(2, blobs.size()); assertEquals(4, blobs.get(0).split("\n").length); assertEquals(4, blobs.get(1).split("\n").length); }