test datasource factory initial commit; needs review from Juergen on how to best make DataSource available as a Spring bean when desired

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1042 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Keith Donald
2009-04-21 21:31:16 +00:00
parent 79cf4ce20a
commit 0898f09f97
10 changed files with 436 additions and 2 deletions
@@ -0,0 +1,30 @@
package org.springframework.test.jdbc;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
public class TestDataSourceFactoryTests {
TestDataSourceFactory factory = new TestDataSourceFactory();
@Test
public void testGetDataSource() {
StubTestDataSourcePopulator populator = new StubTestDataSourcePopulator();
factory.setDatabasePopulator(populator);
factory.getDataSource();
assertTrue(populator.populateCalled);
factory.destroyDataSource();
}
private static class StubTestDataSourcePopulator implements TestDatabasePopulator {
private boolean populateCalled;
public void populate(JdbcTemplate template) throws DataAccessException {
this.populateCalled = true;
}
}
}