/** * Create a new embedded database builder with the given {@link ResourceLoader}. * @param resourceLoader the {@code ResourceLoader} to delegate to */ public EmbeddedDatabaseBuilder(ResourceLoader resourceLoader) { this.databaseFactory = new EmbeddedDatabaseFactory(); this.databasePopulator = new ResourceDatabasePopulator(); this.databaseFactory.setDatabasePopulator(this.databasePopulator); this.resourceLoader = resourceLoader; }
@Test public void testGetDataSource() { StubDatabasePopulator populator = new StubDatabasePopulator(); factory.setDatabasePopulator(populator); EmbeddedDatabase db = factory.getDatabase(); assertTrue(populator.populateCalled); db.shutdown(); }
databasePopulator.addScript(defaultResourceLoader.getResource("classpath:org/springframework/batch/core/schema-drop-hsqldb.sql")); databasePopulator.addScript(defaultResourceLoader.getResource("classpath:org/springframework/batch/core/schema-hsqldb.sql")); embeddedDatabaseFactory.setDatabasePopulator(databasePopulator);
/** * Create a new embedded database builder with the given {@link ResourceLoader}. * @param resourceLoader the {@code ResourceLoader} to delegate to */ public EmbeddedDatabaseBuilder(ResourceLoader resourceLoader) { this.databaseFactory = new EmbeddedDatabaseFactory(); this.databasePopulator = new ResourceDatabasePopulator(); this.databaseFactory.setDatabasePopulator(this.databasePopulator); this.resourceLoader = resourceLoader; }
/** * Create a new embedded database builder with the given ResourceLoader. * @param resourceLoader the ResourceLoader to delegate to */ public EmbeddedDatabaseBuilder(ResourceLoader resourceLoader) { this.databaseFactory = new EmbeddedDatabaseFactory(); this.databasePopulator = new ResourceDatabasePopulator(); this.databaseFactory.setDatabasePopulator(this.databasePopulator); this.resourceLoader = resourceLoader; }