Search in sources :

Example 1 with SimpleTransformErrorListener

use of org.springframework.util.xml.SimpleTransformErrorListener in project uPortal by Jasig.

the class XsltPortalUrlProviderTest method setup.

@Before
public void setup() throws Exception {
    final ResourceLoaderURIResolver resolver = new ResourceLoaderURIResolver(new ClassRelativeResourceLoader(getClass()));
    this.tFactory = TransformerFactory.newInstance();
    this.tFactory.setURIResolver(resolver);
    this.tFactory.setErrorListener(new SimpleTransformErrorListener(LogFactory.getLog(getClass())));
    //Load the XML document so it reads the same way the rendering pipeline reads XML
    final XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
    final XMLEventReader eventReader = xmlInputFactory.createXMLEventReader(this.getClass().getResourceAsStream("test.xml"));
    final XMLStreamReader streamReader = new FixedXMLEventStreamReader(eventReader);
    xmlSource = new StAXSource(streamReader);
    xslTemplate = tFactory.newTemplates(new StreamSource(this.getClass().getResourceAsStream("test.xsl")));
    expected = IOUtils.toString(this.getClass().getResourceAsStream("result.xml"));
}
Also used : ResourceLoaderURIResolver(org.apereo.portal.xml.ResourceLoaderURIResolver) ClassRelativeResourceLoader(org.springframework.core.io.ClassRelativeResourceLoader) XMLStreamReader(javax.xml.stream.XMLStreamReader) SimpleTransformErrorListener(org.springframework.util.xml.SimpleTransformErrorListener) FixedXMLEventStreamReader(org.springframework.util.xml.FixedXMLEventStreamReader) StreamSource(javax.xml.transform.stream.StreamSource) XMLEventReader(javax.xml.stream.XMLEventReader) StAXSource(javax.xml.transform.stax.StAXSource) XMLInputFactory(javax.xml.stream.XMLInputFactory) Before(org.junit.Before)

Example 2 with SimpleTransformErrorListener

use of org.springframework.util.xml.SimpleTransformErrorListener in project uPortal by Jasig.

the class XalanMessageHelperTest method setup.

@Before
public void setup() throws Exception {
    final ResourceLoaderURIResolver resolver = new ResourceLoaderURIResolver(new ClassRelativeResourceLoader(getClass()));
    this.tFactory = TransformerFactory.newInstance();
    this.tFactory.setURIResolver(resolver);
    this.tFactory.setErrorListener(new SimpleTransformErrorListener(LogFactory.getLog(getClass())));
    this.xmlSource = new StreamSource(this.getClass().getResourceAsStream("test.xml"));
}
Also used : ResourceLoaderURIResolver(org.apereo.portal.xml.ResourceLoaderURIResolver) ClassRelativeResourceLoader(org.springframework.core.io.ClassRelativeResourceLoader) SimpleTransformErrorListener(org.springframework.util.xml.SimpleTransformErrorListener) StreamSource(javax.xml.transform.stream.StreamSource) Before(org.junit.Before)

Example 3 with SimpleTransformErrorListener

use of org.springframework.util.xml.SimpleTransformErrorListener in project uPortal by Jasig.

the class XalanGroupMembershipHelperTest method setup.

@Before
public void setup() throws Exception {
    final ResourceLoaderURIResolver resolver = new ResourceLoaderURIResolver(new ClassRelativeResourceLoader(getClass()));
    this.tFactory = TransformerFactory.newInstance();
    this.tFactory.setURIResolver(resolver);
    this.tFactory.setErrorListener(new SimpleTransformErrorListener(LogFactory.getLog(getClass())));
    this.xmlSource = new StreamSource(this.getClass().getResourceAsStream("test.xml"));
}
Also used : ResourceLoaderURIResolver(org.apereo.portal.xml.ResourceLoaderURIResolver) ClassRelativeResourceLoader(org.springframework.core.io.ClassRelativeResourceLoader) SimpleTransformErrorListener(org.springframework.util.xml.SimpleTransformErrorListener) StreamSource(javax.xml.transform.stream.StreamSource) Before(org.junit.Before)

Example 4 with SimpleTransformErrorListener

use of org.springframework.util.xml.SimpleTransformErrorListener in project uPortal by Jasig.

the class XalanAuthorizationHelperTest method setup.

@Before
public void setup() throws Exception {
    final ResourceLoaderURIResolver resolver = new ResourceLoaderURIResolver(new ClassRelativeResourceLoader(getClass()));
    this.tFactory = TransformerFactory.newInstance();
    this.tFactory.setURIResolver(resolver);
    this.tFactory.setErrorListener(new SimpleTransformErrorListener(LogFactory.getLog(getClass())));
    this.xmlSource = new StreamSource(this.getClass().getResourceAsStream("test.xml"));
}
Also used : ResourceLoaderURIResolver(org.apereo.portal.xml.ResourceLoaderURIResolver) ClassRelativeResourceLoader(org.springframework.core.io.ClassRelativeResourceLoader) SimpleTransformErrorListener(org.springframework.util.xml.SimpleTransformErrorListener) StreamSource(javax.xml.transform.stream.StreamSource) Before(org.junit.Before)

Aggregations

StreamSource (javax.xml.transform.stream.StreamSource)4 ResourceLoaderURIResolver (org.apereo.portal.xml.ResourceLoaderURIResolver)4 Before (org.junit.Before)4 ClassRelativeResourceLoader (org.springframework.core.io.ClassRelativeResourceLoader)4 SimpleTransformErrorListener (org.springframework.util.xml.SimpleTransformErrorListener)4 XMLEventReader (javax.xml.stream.XMLEventReader)1 XMLInputFactory (javax.xml.stream.XMLInputFactory)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 StAXSource (javax.xml.transform.stax.StAXSource)1 FixedXMLEventStreamReader (org.springframework.util.xml.FixedXMLEventStreamReader)1