commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml TestImport.java
Date Thu, 16 Sep 2004 01:13:13 GMT
dion        2004/09/15 18:13:13

  Modified:    jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml
                        TestImport.java
  Log:
  Add tests for script relative resources being accessed via script.run and context.run
  
  Revision  Changes    Path
  1.2       +14 -6     jakarta-commons/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/TestImport.java
  
  Index: TestImport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/TestImport.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestImport.java	13 Sep 2004 03:09:29 -0000	1.1
  +++ TestImport.java	16 Sep 2004 01:13:13 -0000	1.2
  @@ -23,6 +23,8 @@
   import org.apache.commons.jelly.JellyException;
   import org.apache.commons.jelly.Script;
   import org.apache.commons.jelly.XMLOutput;
  +import org.apache.commons.jelly.parser.XMLParser;
  +import org.xml.sax.SAXException;
   
   import junit.framework.TestCase;
   
  @@ -49,12 +51,18 @@
           JellyContext context = new JellyContext();
           URL url = TestImport.class.getResource("/resources/import.jelly");
           XMLOutput out = XMLOutput.createXMLOutput(System.out);
  -//      This does not work because context has no currentURL set
  -//      This results in a NullPointerException when resolving the
  -//      stylesheet
  -//        Script script = context.compileScript(url);
  -//        script.run(context, out);
  -//        out.close();
  +        Script script = context.compileScript(url);
  +        script.run(context, out);
  +        out.close();
  +    }
  +
  +    public void testImportResourcesFromUncompiledScript() throws JellyException, UnsupportedEncodingException,
IOException, SAXException {
  +        JellyContext context = new JellyContext();
  +        URL url = TestImport.class.getResource("/resources/import.jelly");
  +        XMLOutput out = XMLOutput.createXMLOutput(System.out);
  +        Script script = new XMLParser().parse(url);
  +        script.run(context, out);
  +        out.close();
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message