fixing broken unit test related to SPR-5429

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@581 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Scott Andrews
2009-01-23 22:32:26 +00:00
parent ff095111b8
commit 4a9e3d4745
5 changed files with 39 additions and 8 deletions
@@ -62,6 +62,8 @@ public class DbcpDataSourceFactory implements FactoryBean<DataSource>, Disposabl
private Resource dataLocation;
private Resource dropLocation;
/**
* The object created by this factory.
*/
@@ -115,6 +117,14 @@ public class DbcpDataSourceFactory implements FactoryBean<DataSource>, Disposabl
this.dataLocation = testDataLocation;
}
/**
* Sets the location of the file containing the drop scripts for the database.
* @param testDataLocation the location of the data file
*/
public void setDropLocation(Resource testDropLocation) {
this.dropLocation = testDropLocation;
}
// implementing FactoryBean
// this method is called by Spring to expose the DataSource as a bean
@@ -163,6 +173,14 @@ public class DbcpDataSourceFactory implements FactoryBean<DataSource>, Disposabl
private void populateDataSource() {
DatabasePopulator populator = new DatabasePopulator(dataSource);
if (dropLocation != null) {
try {
populator.populate(this.dropLocation);
}
catch (Exception e) {
// ignore
}
}
populator.populate(this.schemaLocation);
populator.populate(this.dataLocation);
}