use of cn.taketoday.jdbc.core.JdbcTemplate in project today-infrastructure by TAKETODAY.
the class RdbmsOperationTests method parameterPropagation.
@Test
public void parameterPropagation() {
SqlOperation operation = new SqlOperation() {
};
DataSource ds = new DriverManagerDataSource();
operation.setDataSource(ds);
operation.setFetchSize(10);
operation.setMaxRows(20);
JdbcTemplate jt = operation.getJdbcTemplate();
assertThat(jt.getDataSource()).isEqualTo(ds);
assertThat(jt.getFetchSize()).isEqualTo(10);
assertThat(jt.getMaxRows()).isEqualTo(20);
}
use of cn.taketoday.jdbc.core.JdbcTemplate in project today-infrastructure by TAKETODAY.
the class EmbeddedDatabaseFactoryBeanTests method testFactoryBeanLifecycle.
@Test
public void testFactoryBeanLifecycle() throws Exception {
EmbeddedDatabaseFactoryBean bean = new EmbeddedDatabaseFactoryBean();
ResourceDatabasePopulator populator = new ResourceDatabasePopulator(resource("db-schema.sql"), resource("db-test-data.sql"));
bean.setDatabasePopulator(populator);
bean.afterPropertiesSet();
DataSource ds = bean.getObject();
JdbcTemplate template = new JdbcTemplate(ds);
assertThat(template.queryForObject("select NAME from T_TEST", String.class)).isEqualTo("Keith");
bean.destroy();
}
Aggregations