public void testImportResourcesFromUncompiledScript() throws JellyException, UnsupportedEncodingException, IOException, SAXException { JellyContext context = new JellyContext(); URL url = TestImport.class.getResource("/resources/import.jelly"); StringWriter writer = new StringWriter(); XMLOutput out = XMLOutput.createXMLOutput(writer); Script script = new XMLParser().parse(url); script.run(context, out); out.close(); assertEquals(expected, writer.toString()); }
public void testImportResources() throws JellyException, UnsupportedEncodingException, IOException { JellyContext context = new JellyContext(); URL url = TestImport.class.getResource("/resources/import.jelly"); StringWriter writer = new StringWriter(); XMLOutput out = XMLOutput.createXMLOutput(writer); // this works because of the created child context that has knowledge // of the URL context.runScript(url, out); out.close(); assertEquals(expected, writer.toString()); }