use of org.springframework.core.io.ClassRelativeResourceLoader in project spring-framework by spring-projects.
the class EmbeddedDatabaseBuilderTests method createSameSchemaTwiceWithoutUniqueDbNames.
@Test
public void createSameSchemaTwiceWithoutUniqueDbNames() throws Exception {
EmbeddedDatabase db1 = //
new EmbeddedDatabaseBuilder(new ClassRelativeResourceLoader(getClass())).addScripts("db-schema-without-dropping.sql").build();
try {
//
new EmbeddedDatabaseBuilder(new ClassRelativeResourceLoader(getClass())).addScripts("db-schema-without-dropping.sql").build();
fail("Should have thrown a ScriptStatementFailedException");
} catch (ScriptStatementFailedException e) {
// expected
} finally {
db1.shutdown();
}
}
use of org.springframework.core.io.ClassRelativeResourceLoader in project spring-framework by spring-projects.
the class EmbeddedDatabaseBuilderTests method createSameSchemaTwiceWithGeneratedUniqueDbNames.
@Test
public void createSameSchemaTwiceWithGeneratedUniqueDbNames() throws Exception {
EmbeddedDatabase db1 = //
new EmbeddedDatabaseBuilder(new ClassRelativeResourceLoader(getClass())).addScripts("db-schema-without-dropping.sql", //
"db-test-data.sql").generateUniqueName(//
true).build();
JdbcTemplate template1 = new JdbcTemplate(db1);
assertNumRowsInTestTable(template1, 1);
template1.update("insert into T_TEST (NAME) values ('Sam')");
assertNumRowsInTestTable(template1, 2);
EmbeddedDatabase db2 = //
new EmbeddedDatabaseBuilder(new ClassRelativeResourceLoader(getClass())).addScripts("db-schema-without-dropping.sql", //
"db-test-data.sql").generateUniqueName(//
true).build();
assertDatabaseCreated(db2);
db1.shutdown();
db2.shutdown();
}
use of org.springframework.core.io.ClassRelativeResourceLoader in project uPortal by Jasig.
the class PipelineStylesheetTest method setup.
@Before
public void setup() throws Exception {
this.resourceLoader = new ClassRelativeResourceLoader(getClass());
templatesBuilder = new TemplatesBuilder();
templatesBuilder.setResourceLoader(this.resourceLoader);
}
use of org.springframework.core.io.ClassRelativeResourceLoader 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"));
}
use of org.springframework.core.io.ClassRelativeResourceLoader 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"));
}
Aggregations