public List<HostPort> getGmondSendChannelsFromConf(String conf) { String cleanConf = removeEmptyLines(stripComments(conf)); List<String> blobs = findSendChannels(cleanConf); log.debug("Found {} channels", blobs.size()); List<HostPort> hosts = new ArrayList<HostPort>(); for (String blob : blobs) { Map<String,String> chanMap = mapifyChannelString(blob); log.debug("Parsed channel from config {}", chanMap); HostPort hp = makeHostPort(chanMap); if (hp != null) { hosts.add(hp); } else { log.warn("Failure to create HostPort from {}", blob); } } return hosts; }
public List<HostPort> getGmondSendChannelsFromConf(String conf) { String cleanConf = removeEmptyLines(stripComments(conf)); List<String> blobs = findSendChannels(cleanConf); log.debug("Found {} channels", blobs.size()); List<HostPort> hosts = new ArrayList<HostPort>(); for (String blob : blobs) { Map<String,String> chanMap = mapifyChannelString(blob); log.debug("Parsed channel from config {}", chanMap); HostPort hp = makeHostPort(chanMap); if (hp != null) { hosts.add(hp); } else { log.warn("Failure to create HostPort from {}", blob); } } return hosts; }
@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); }