use of com.zaxxer.hikari.HikariDataSource in project pinpoint by naver.
the class HikariCpIT method setup.
@BeforeClass
public static void setup() {
final HikariConfig config = new HikariConfig();
config.setDataSourceClassName("org.h2.jdbcx.JdbcDataSource");
config.addDataSourceProperty("url", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");
dataSource = new HikariDataSource(config);
}
use of com.zaxxer.hikari.HikariDataSource in project spring-boot by spring-projects.
the class SimpleDataSourceExampleTests method validateConfiguration.
@Test
public void validateConfiguration() throws SQLException {
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(1);
HikariDataSource dataSource = this.context.getBean(HikariDataSource.class);
assertThat(dataSource.getConnection().getMetaData().getURL()).isEqualTo("jdbc:h2:mem:simple");
assertThat(dataSource.getMaximumPoolSize()).isEqualTo(42);
}
use of com.zaxxer.hikari.HikariDataSource in project spring-boot by spring-projects.
the class ConfigurableDataSourceExampleTests method validateConfiguration.
@Test
public void validateConfiguration() throws SQLException {
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(1);
HikariDataSource dataSource = this.context.getBean(HikariDataSource.class);
assertThat(dataSource.getConnection().getMetaData().getURL()).isEqualTo("jdbc:h2:mem:configurable");
assertThat(dataSource.getMaximumPoolSize()).isEqualTo(42);
}
use of com.zaxxer.hikari.HikariDataSource in project spring-cloud-connectors by spring-cloud.
the class HikariCpPooledDataSourceCreator method create.
@Override
public DataSource create(RelationalServiceInfo serviceInfo, ServiceConnectorConfig serviceConnectorConfig, String driverClassName, String validationQuery) {
if (hasClass(HIKARI_DATASOURCE)) {
logger.info("Found HikariCP on the classpath. Using it for DataSource connection pooling.");
HikariDataSource ds = new HikariDataSource();
setBasicDataSourceProperties(ds, serviceInfo, serviceConnectorConfig, driverClassName, validationQuery);
return ds;
} else {
return null;
}
}
use of com.zaxxer.hikari.HikariDataSource in project spring-boot by spring-projects.
the class DataSourceAutoConfigurationTests method hikariValidatesConnectionByDefault.
@Test
public void hikariValidatesConnectionByDefault() throws Exception {
HikariDataSource dataSource = autoConfigureDataSource(HikariDataSource.class, "org.apache.tomcat");
assertThat(dataSource.getConnectionTestQuery()).isNull();
// Use Connection#isValid()
}
Aggregations