List of usage examples for org.springframework.core.io ClassRelativeResourceLoader ClassRelativeResourceLoader
public ClassRelativeResourceLoader(Class<?> clazz)
From source file:com.github.springtestdbunit.dataset.AbstractDataSetLoader.java
/** * Gets the {@link ResourceLoader} that will be used to load the dataset {@link Resource}s. * @param testClass The class under test * @return a resource loader//from w w w .ja va2 s . c o m */ protected ResourceLoader getResourceLoader(Class<?> testClass) { return new ClassRelativeResourceLoader(testClass); }
From source file:com.yeahmobi.yunit.dataset.AbstractDataSetLoader.java
/** * Gets the {@link ResourceLoader} that will be used to load the dataset {@link Resource}s. * @param testClass The class under test * @return resource loader list/*from ww w.j av a2 s. co m*/ */ protected ResourceLoader[] getResourceLoader(Class<?> testClass) { return new ResourceLoader[] { new ClassRelativeResourceLoader(testClass), new DefaultResourceLoader() }; }
From source file:org.apereo.portal.security.xslt.XalanAuthorizationHelperTest.java
@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")); }
From source file:org.apereo.portal.url.xml.XsltPortalUrlProviderTest.java
@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")); }
From source file:org.jasig.resourceserver.utils.aggr.ResourcesElementsProviderImpl.java
@Override public void afterPropertiesSet() throws Exception { if (this.registerWithServletContext && this.servletContext != null) { this.servletContext.setAttribute(RESOURCES_ELEMENTS_PROVIDER, this); }/*from w w w .ja v a 2 s . c o m*/ if (this.resourcesDao == null) { this.resourcesDao = new ResourcesDaoImpl(); } if (this.resourceLoader == null) { if (this.servletContext != null) { this.resourceLoader = new ServletContextResourceLoader(this.servletContext); } else { this.resourceLoader = new ClassRelativeResourceLoader(getClass()); } } }