INT-812: patch that catches IOException when determining wether the Resource can resolve to a systemId

This commit is contained in:
Iwein Fuld
2009-09-30 19:23:13 +00:00
parent d8bda324fb
commit a65d9c3ed2
4 changed files with 136 additions and 102 deletions

View File

@@ -26,13 +26,16 @@ import javax.xml.transform.dom.DOMResult;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertThat;
import org.w3c.dom.Document;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.integration.core.MessagingException;
import org.springframework.integration.xml.util.XmlTestUtil;
import org.springframework.xml.transform.StringSource;
import static org.hamcrest.CoreMatchers.is;
/**
* @author Jonas Partner
@@ -113,6 +116,13 @@ public class XsltPayloadTransformerTests {
transformer.transformPayload(new Long(12));
}
@Test
public void testXsltWithImports() throws Exception {
Resource resource = new ClassPathResource("transform-with-import.xsl", this.getClass());
transformer = new XsltPayloadTransformer(resource);
assertThat(transformer.transformString(docAsString), is(outputAsString));
}
private Resource getXslResource() throws Exception {
String xsl = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:template match=\"order\"><bob>test</bob></xsl:template></xsl:stylesheet>";

View File

@@ -0,0 +1,5 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="transform.xsl"/>
</xsl:stylesheet>

View File

@@ -0,0 +1,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="order">
<bob>test</bob>
</xsl:template>
</xsl:stylesheet>