Spring Framework ClassRelativeResourceLoader - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ClassRelativeResourceLoader class.

This code example shows how to use the following methods:
/** 
 * @author Keith Donald 
 */ 
public class EmbeddedDatabaseFactoryBeanTests { 
 
	private final ClassRelativeResourceLoader resourceLoader = new ClassRelativeResourceLoader(getClass()); 
 
 
	Resource resource(String path) { 
		return resourceLoader.getResource(path); 
	} 
 
	@Test 
	public void testFactoryBeanLifecycle() throws Exception { 
		EmbeddedDatabaseFactoryBean bean = new EmbeddedDatabaseFactoryBean(); 
		ResourceDatabasePopulator populator = new ResourceDatabasePopulator(resource("db-schema.sql"), 
			resource("db-test-data.sql")); 
		bean.setDatabasePopulator(populator); 
		bean.afterPropertiesSet(); 
		DataSource ds = bean.getObject(); 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 * @author Sam Brannen 
 * @since 4.0.3 
 */ 
public abstract class AbstractDatabaseInitializationTests { 
 
	private final ClassRelativeResourceLoader resourceLoader = new ClassRelativeResourceLoader(getClass()); 
 
	EmbeddedDatabase db; 
 
	JdbcTemplate jdbcTemplate; 
 
 
	@Before 
	public void setUp() { 
		db = new EmbeddedDatabaseBuilder().setType(getEmbeddedDatabaseType()).build(); 
		jdbcTemplate = new JdbcTemplate(db); 
	} 
 
	@After 
	public void shutDown() { 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private TransformerFactory tFactory;
    private StreamSource xmlSource;
     
    @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"));
    } 
 
    @Test
    public void testIsUserDeepMemberOf() throws Exception {
        final IXalanAuthorizationHelper helperBean = createMock(IXalanAuthorizationHelper.class);
         
        expect(helperBean.canRender("testUser", "portlet-admin")).andReturn(true);
         
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private TransformerFactory tFactory;
    private StreamSource xmlSource;
     
    @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"));
    } 
 
    @Test
    public void testIsUserDeepMemberOf() throws Exception {
        final IXalanMessageHelper helperBean = createMock(IXalanMessageHelper.class);
         
        expect(helperBean.getMessage("im.done", "en_us")).andReturn("I'm Done!");
         
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private TransformerFactory tFactory;
    private StreamSource xmlSource;
     
    @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"));
    } 
 
    @Test
    public void testIsUserDeepMemberOf() throws Exception {
        final IXalanGroupMembershipHelper helperBean = createMock(IXalanGroupMembershipHelper.class);
         
        expect(helperBean.isChannelDeepMemberOf("fnameValue", "local.1")).andReturn(true);
        expect(helperBean.isChannelDeepMemberOf("fnameValue", "local.2")).andReturn(false);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private Templates xslTemplate;
    private String expected;
     
    @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"));
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    private ResourceLoader resourceLoader;
    private TemplatesBuilder templatesBuilder;
     
    @Before 
    public void setup() throws Exception {
        this.resourceLoader = new ClassRelativeResourceLoader(getClass());
         
        templatesBuilder = new TemplatesBuilder();
        templatesBuilder.setResourceLoader(this.resourceLoader);
 
    } 
     
    @Test
    public void testStructureColumnsCompile() throws Exception {
        this.testXslCompile("/layout/structure/columns/columns.xsl");
    } 
     
    @Test
    public void testStructureMobileColumnCompile() throws Exception {
        this.testXslCompile("/layout/structure/mobile-column/mobile-column.xsl");
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
	private final EmbeddedDatabase db = builder.build(); 
 
	private final SingleTableDatabaseInitializer databaseInitializer = new SingleTableDatabaseInitializer(); 
 
	private final ClassRelativeResourceLoader resourceLoader = new ClassRelativeResourceLoader(getClass()); 
 
	private final JdbcTemplate jdbcTemplate = new JdbcTemplate(db); 
 
	@After 
	public void shutDown() { 
		if (TransactionSynchronizationManager.isSynchronizationActive()) { 
			TransactionSynchronizationManager.clear(); 
			TransactionSynchronizationManager.unbindResource(db); 
		} 
		db.shutdown(); 
	} 
 
	@Test 
	public void testBuildWithPlaceholders() throws Exception { 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 * 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 
	 */ 
	protected ResourceLoader getResourceLoader(Class<?> testClass) {
		return new ClassRelativeResourceLoader(testClass);
	} 
 
	/** 
	 * Get the resource locations that should be considered when attempting to load a dataset from the specified 
	 * location. 
	 * @param testClass The class under test 
	 * @param location The source location 
	 * @return an array of potential resource locations 
	 */ 
	protected String[] getResourceLocations(Class<?> testClass, String location) {
		return new String[] { location };
	} 
 
	/** 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java