This commit is contained in:
Keith Donald
2009-05-06 09:14:25 +00:00
parent 0320445316
commit 4bfcd16130
2 changed files with 16 additions and 4 deletions

View File

@@ -6,16 +6,19 @@ import javax.sql.DataSource;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
public class EmbeddedDatabaseFactoryBeanTests {
@Test
public void testFactoryBeanLifecycle() throws Exception {
EmbeddedDatabaseFactoryBean bean = new EmbeddedDatabaseFactoryBean();
ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
populator.addScript(new ClassPathResource("db-schema.sql", getClass()));
populator.addScript(new ClassPathResource("db-test-data.sql", getClass()));
populator.setScripts(new Resource[] {
new ClassPathResource("db-schema.sql", getClass()),
new ClassPathResource("db-test-data.sql", getClass())
});
bean.setDatabasePopulator(populator);
bean.afterPropertiesSet();
DataSource ds = bean.getObject();