Java 类org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void dataSourceHealthIndicatorWithCustomValidationQuery() {
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            ManagementServerProperties.class, DataSourceProperties.class,
            DataSourceConfig.class,
            DataSourcePoolMetadataProvidersConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.datasource.test.validation-query:SELECT from FOOBAR",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    HealthIndicator healthIndicator = beans.values().iterator().next();
    assertThat(healthIndicator.getClass()).isEqualTo(DataSourceHealthIndicator.class);
    DataSourceHealthIndicator dataSourceHealthIndicator = (DataSourceHealthIndicator) healthIndicator;
    assertThat(dataSourceHealthIndicator.getQuery()).isEqualTo("SELECT from FOOBAR");
}
项目:spring-boot-concourse    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void dataSourceHealthIndicatorWithCustomValidationQuery() {
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            ManagementServerProperties.class, DataSourceProperties.class,
            DataSourceConfig.class,
            DataSourcePoolMetadataProvidersConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.datasource.test.validation-query:SELECT from FOOBAR",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    HealthIndicator healthIndicator = beans.values().iterator().next();
    assertThat(healthIndicator.getClass()).isEqualTo(DataSourceHealthIndicator.class);
    DataSourceHealthIndicator dataSourceHealthIndicator = (DataSourceHealthIndicator) healthIndicator;
    assertThat(dataSourceHealthIndicator.getQuery()).isEqualTo("SELECT from FOOBAR");
}
项目:contestparser    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void dataSourceHealthIndicatorWithCustomValidationQuery() {
    this.context.register(PropertyPlaceholderAutoConfiguration.class,
            ManagementServerProperties.class, DataSourceProperties.class,
            DataSourceConfig.class,
            DataSourcePoolMetadataProvidersConfiguration.class,
            HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.datasource.validation-query:SELECT from FOOBAR",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertEquals(1, beans.size());
    HealthIndicator healthIndicator = beans.values().iterator().next();
    assertEquals(DataSourceHealthIndicator.class, healthIndicator.getClass());
    DataSourceHealthIndicator dataSourceHealthIndicator = (DataSourceHealthIndicator) healthIndicator;
    assertEquals("SELECT from FOOBAR", dataSourceHealthIndicator.getQuery());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PublicMetricsAutoConfigurationTests.java   
private void loadWeb(Class<?>... config) {
    AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext();
    if (config.length > 0) {
        context.register(config);
    }
    context.register(DataSourcePoolMetadataProvidersConfiguration.class,
            CacheStatisticsAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class,
            MockEmbeddedServletContainerFactory.class);
    context.refresh();
    this.context = context;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PublicMetricsAutoConfigurationTests.java   
private void load(Class<?>... config) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    if (config.length > 0) {
        context.register(config);
    }
    context.register(DataSourcePoolMetadataProvidersConfiguration.class,
            CacheStatisticsAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class);
    context.refresh();
    this.context = context;
}
项目:spring-boot-concourse    文件:PublicMetricsAutoConfigurationTests.java   
private void loadWeb(Class<?>... config) {
    AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext();
    if (config.length > 0) {
        context.register(config);
    }
    context.register(DataSourcePoolMetadataProvidersConfiguration.class,
            CacheStatisticsAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class,
            MockEmbeddedServletContainerFactory.class);
    context.refresh();
    this.context = context;
}
项目:spring-boot-concourse    文件:PublicMetricsAutoConfigurationTests.java   
private void load(Class<?>... config) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    if (config.length > 0) {
        context.register(config);
    }
    context.register(DataSourcePoolMetadataProvidersConfiguration.class,
            CacheStatisticsAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class);
    context.refresh();
    this.context = context;
}
项目:contestparser    文件:PublicMetricsAutoConfigurationTests.java   
private void loadWeb(Class<?>... config) {
    AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext();
    if (config.length > 0) {
        context.register(config);
    }
    context.register(DataSourcePoolMetadataProvidersConfiguration.class,
            CacheStatisticsAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class,
            MockEmbeddedServletContainerFactory.class);
    context.refresh();
    this.context = context;
}
项目:contestparser    文件:PublicMetricsAutoConfigurationTests.java   
private void load(Class<?>... config) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    if (config.length > 0) {
        context.register(config);
    }
    context.register(DataSourcePoolMetadataProvidersConfiguration.class,
            CacheStatisticsAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class);
    context.refresh();
    this.context = context;
}