org.springframework.jdbc.datasource.AbstractDriverBasedDataSource Java Examples
The following examples show how to use
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JdbcNamespaceIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
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(); } }
Example #2
Source File: JdbcNamespaceIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
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(); } }
Example #3
Source File: JdbcNamespaceIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
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(); } }
Example #4
Source File: JdbcNamespaceIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
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(); } }
Example #5
Source File: JdbcNamespaceIntegrationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
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(); } }
Example #6
Source File: JdbcNamespaceIntegrationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
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(); } }