public SourceFactory createSourceFactory(String name, String variant) throws Exception { String path = buildPath(name, variant); return SourceFactory.create(XMLReaderFactory.createXMLReader(), getStreamSource(path), 8192); }
public void load(String path, int expected) { Storage.openStage(nodeRepository, nodeService, config, nodeHandler, null, result); try { Object object = marshaller.stage(SourceFactory.create(XMLReaderFactory.createXMLReader(), getStreamSource(path), 8192), null, false); nodes.keySet().stream().forEach(node -> LOG.info("stored: {}", node)); result.log(); assertNotNull(object); assertTrue("object should be of type NodeList", object instanceof NodeList); NodeList<NodeData> list = (NodeList<NodeData>) object; list.getNodes().stream().forEach(node -> LOG.debug("seen: {}", node)); assertEquals("wrong number of seen nodes", expected, list.getNodes().size()); } catch (IOException | XmlMappingException | SAXException e) { throw new RuntimeException(e); } finally { Storage.closeStage(); } }
public void load(String path) { Storage.openStage(nodeRepository, nodeService, config, nodeHandler, null, result); try { Object object = marshaller.stage(SourceFactory.create(XMLReaderFactory.createXMLReader(), getStreamSource(path), 8192), null, false); nodes.keySet().stream().forEach(node -> LOG.info("stored: {}", node)); result.log(); assertNotNull(object); assertNotNull("result should not be empty", object); assertTrue("object should be of type NodeData", object instanceof NodeData); } catch (IOException | XmlMappingException | SAXException e) { throw new RuntimeException(e); } finally { Storage.closeStage(); } }