You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2008/07/14 14:50:39 UTC
svn commit: r676575 - in /struts/struts2/trunk/core/src/test:
java/org/apache/struts2/views/xslt/XSLTResultTest.java
resources/XSLTResultTest4.badinclude.xsl
Author: mrdon
Date: Mon Jul 14 05:50:38 2008
New Revision: 676575
URL: http://svn.apache.org/viewvc?rev=676575&view=rev
Log:
Adding test for missing xslt include
WW-2561
Added:
struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.badinclude.xsl
- copied, changed from r676177, struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.xsl
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java?rev=676575&r1=676574&r2=676575&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java Mon Jul 14 05:50:38 2008
@@ -153,6 +153,28 @@
assertTrue(out.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
assertTrue(out.indexOf("<validators>") > -1);
}
+
+ public void testTransform4WithBadDocumentInclude() throws Exception {
+ result = new XSLTResult(){
+ protected URIResolver getURIResolver() {
+ return new URIResolver() {
+ public Source resolve(String href, String base) throws TransformerException {
+ return new StreamSource(ClassLoaderUtils.getResourceAsStream(href, this.getClass()));
+ }
+
+ };
+ }
+
+ };
+ result.setParse(false);
+ result.setLocation("XSLTResultTest4.badinclude.xsl");
+ try {
+ result.execute(mai);
+ fail("Should have thrown an exception");
+ } catch (Exception ex) {
+ assertEquals("Error transforming result", ex.getMessage());
+ }
+ }
public void testTransformWithError() throws Exception {
result = new XSLTResult(){
Copied: struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.badinclude.xsl (from r676177, struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.xsl)
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.badinclude.xsl?p2=struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.badinclude.xsl&p1=struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.xsl&r1=676177&r2=676575&rev=676575&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.xsl (original)
+++ struts/struts2/trunk/core/src/test/resources/XSLTResultTest4.badinclude.xsl Mon Jul 14 05:50:38 2008
@@ -25,7 +25,7 @@
xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:template match="result">
- <xsl:copy-of select="document('XSLTResultTest-val.xml')"/>
+ <xsl:copy-of select="document('XSLTResultTest-val.nothing.xml')"/>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file