use of org.springframework.jdbc.datasource.AbstractDriverBasedDataSource in project spring-framework by spring-projects.
the class JdbcNamespaceIntegrationTests method assertCorrectSetupAndCloseContext.
private void assertCorrectSetupAndCloseContext(String file, int count, String... dataSources) {
ConfigurableApplicationContext context = context(file);
try {
for (String dataSourceName : dataSources) {
DataSource dataSource = context.getBean(dataSourceName, DataSource.class);
assertNumRowsInTestTable(new JdbcTemplate(dataSource), count);
assertTrue(dataSource instanceof AbstractDriverBasedDataSource);
AbstractDriverBasedDataSource adbDataSource = (AbstractDriverBasedDataSource) dataSource;
assertThat(adbDataSource.getUrl(), containsString(dataSourceName));
}
} finally {
context.close();
}
}
use of org.springframework.jdbc.datasource.AbstractDriverBasedDataSource in project spring-framework by spring-projects.
the class JdbcNamespaceIntegrationTests method assertCorrectSetupForSingleDataSource.
private void assertCorrectSetupForSingleDataSource(String file, Predicate<String> urlPredicate) {
ConfigurableApplicationContext context = context(file);
try {
DataSource dataSource = context.getBean(DataSource.class);
assertNumRowsInTestTable(new JdbcTemplate(dataSource), 1);
assertTrue(dataSource instanceof AbstractDriverBasedDataSource);
AbstractDriverBasedDataSource adbDataSource = (AbstractDriverBasedDataSource) dataSource;
assertTrue(urlPredicate.test(adbDataSource.getUrl()));
} finally {
context.close();
}
}
Aggregations