private void init() { try { load = new Loader(pm.strictparsing); } catch (ParserConfigurationException e) { throw new RuntimeException("Can't build loader parser", e); } logger.debug(jrds.Util.delayedFormatString("Scanning %s for probes libraries", pm.libspath)); for(URI lib: pm.libspath) { logger.info(jrds.Util.delayedFormatString("Adding lib %s", lib)); load.importUrl(lib); } if(pm.configdir != null) load.importDir(pm.configdir); load.done(); }
@Test public void doLoadView() throws Exception { Loader l = new Loader(); l.importStream(getClass().getClassLoader().getResourceAsStream("view1.xml"), ""); l.done(); Map<String, JrdsDocument> rep = l.getRepository(ConfigType.FILTER); logger.trace(rep); Assert.assertTrue(rep.containsKey("Test view 1")); }
@Test public void doLoadProbeDesc() throws Exception { Loader l = new Loader(); l.importStream(getClass().getClassLoader().getResourceAsStream("fulldesc.xml"), ""); l.done(); Map<String, JrdsDocument> rep = l.getRepository(ConfigType.PROBEDESC); logger.trace(rep); Assert.assertTrue(rep.containsKey("name")); }
@Test public void doLoadTab() throws Exception { Loader l = new Loader(); l.importStream(getClass().getClassLoader().getResourceAsStream("goodtab.xml"), ""); l.done(); Map<String, JrdsDocument> rep = l.getRepository(ConfigType.TAB); logger.trace(rep); Assert.assertTrue(rep.containsKey("goodtab")); }
@Test public void doLoadGraph() throws Exception { Loader l = new Loader(); l.importStream(getClass().getClassLoader().getResourceAsStream("customgraph.xml"), ""); l.done(); Map<String, JrdsDocument> rep = l.getRepository(ConfigType.GRAPH); logger.trace(rep); Assert.assertTrue(rep.containsKey("name")); }
@Test public void scanPaths() throws Exception { Loader l = new Loader(); PropertiesManager pm = Tools.makePm(testFolder, "strict=true"); for(URI lib: pm.libspath) { logger.info("Adding lib " + lib); l.importUrl(lib); } }
@Test public void doLoadHost() throws Exception { Loader l = new Loader(); l.importStream(getClass().getClassLoader().getResourceAsStream("host1.xml"), ""); l.done(); Assert.assertTrue(l.getRepository(ConfigType.HOSTS).containsKey("name")); }
@Test public void doLoadJar() throws ParserConfigurationException, MalformedURLException, URISyntaxException { Loader l = new Loader(); l.importUrl(getClass().getClassLoader().getResource("desc").toURI()); l.done(); Assert.assertFalse("graph desc list is empty", l.getRepository(ConfigType.GRAPHDESC).isEmpty()); Assert.assertFalse("probe desc list is empty", l.getRepository(ConfigType.PROBEDESC).isEmpty()); }