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/src/test/org/apache/commons/jelly/test/impl TestEmbedded.java
Date Thu, 06 Jan 2005 09:00:36 GMT
dion        2005/01/06 01:00:36

  Modified:    jelly/src/test/org/apache/commons/jelly/test/impl
                        TestEmbedded.java
  Log:
  Handle systemId being null.
  PR: JELLY-189
  Obtained from:Jeff Gregory
  Submitted by:	Jeff Gregory
  Reviewed by:	dIon
  
  Revision  Changes    Path
  1.6       +26 -2     jakarta-commons/jelly/src/test/org/apache/commons/jelly/test/impl/TestEmbedded.java
  
  Index: TestEmbedded.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/test/org/apache/commons/jelly/test/impl/TestEmbedded.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestEmbedded.java	9 Sep 2004 12:31:57 -0000	1.5
  +++ TestEmbedded.java	6 Jan 2005 09:00:36 -0000	1.6
  @@ -17,8 +17,13 @@
   
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
  +import java.io.OutputStream;
  +import java.io.StringReader;
   
  +import org.apache.commons.jelly.JellyContext;
  +import org.apache.commons.jelly.XMLOutput;
   import org.apache.commons.jelly.impl.Embedded;
  +import org.xml.sax.InputSource;
   
   import junit.framework.Test;
   import junit.framework.TestCase;
  @@ -93,8 +98,27 @@
           boolean status = embedded.execute();
           //executed properly without script errors
           assertEquals(status, true);
  -        //check that the output  confirms the exepected
  +        //check that the output confirms the expected
           assertEquals("jelly-test-case", new String(baos.toByteArray()));
  -
  +    }
  +    
  +    /**
  +     * Test simple 'raw' execution of a string. See JELLY-189.
  +     */
  +    public void testRawExecuteAsString() throws Exception
  +    {
  +        String message =
  +            "<?xml version=\"1.0\"?>"
  +                + " <j:jelly xmlns:j=\"jelly:core\">"
  +                + "jelly-test-case"
  +                + " </j:jelly>";
  +       ByteArrayOutputStream output = new ByteArrayOutputStream();
  +       XMLOutput xmlOutput = XMLOutput.createXMLOutput(output);
  +       InputSource script = new InputSource( new StringReader(message.toString()) );
  +       JellyContext context = new JellyContext();
  +       context.runScript( script, xmlOutput);
  +       output.close();
  +       //check that the output confirms the expected
  +       assertEquals("jelly-test-case", new String(output.toByteArray()));
       }
   }
  
  
  

---------------------------------------------------------------------
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