use of io.r2dbc.pool.ConnectionPool in project spring-boot by spring-projects.
the class R2dbcAutoConfigurationTests method configureWithUrlAndPoolPropertiesApplyProperties.
@Test
void configureWithUrlAndPoolPropertiesApplyProperties() {
this.contextRunner.withPropertyValues("spring.r2dbc.url:r2dbc:h2:mem:///" + randomDatabaseName(), "spring.r2dbc.pool.max-size=15", "spring.r2dbc.pool.max-acquire-time=3m").run((context) -> {
assertThat(context).hasSingleBean(ConnectionFactory.class).hasSingleBean(ConnectionPool.class).hasSingleBean(R2dbcProperties.class);
ConnectionPool connectionPool = context.getBean(ConnectionPool.class);
PoolMetrics poolMetrics = connectionPool.getMetrics().get();
assertThat(poolMetrics.getMaxAllocatedSize()).isEqualTo(15);
assertThat(connectionPool).hasFieldOrPropertyWithValue("maxAcquireTime", Duration.ofMinutes(3));
});
}
Aggregations