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

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:TransactionAutoConfigurationTests.java   
@Test
public void singleTransactionManager() {
    load(DataSourceAutoConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    TransactionTemplate transactionTemplate = this.context
            .getBean(TransactionTemplate.class);
    assertThat(transactionTemplate.getTransactionManager())
            .isSameAs(transactionManager);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SessionAutoConfigurationJdbcTests.java   
@Test
public void defaultConfig() {
    load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class),
            "spring.session.store-type=jdbc");
    JdbcOperationsSessionRepository repository = validateSessionRepository(
            JdbcOperationsSessionRepository.class);
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
            .isEqualTo("SPRING_SESSION");
    assertThat(this.context.getBean(JdbcOperations.class)
            .queryForList("select * from SPRING_SESSION")).isEmpty();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SessionAutoConfigurationJdbcTests.java   
@Test
public void disableDatabaseInitializer() {
    load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class),
            "spring.session.store-type=jdbc",
            "spring.session.jdbc.initializer.enabled=false");
    JdbcOperationsSessionRepository repository = validateSessionRepository(
            JdbcOperationsSessionRepository.class);
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
            .isEqualTo("SPRING_SESSION");
    this.thrown.expect(BadSqlGrammarException.class);
    assertThat(this.context.getBean(JdbcOperations.class)
            .queryForList("select * from SPRING_SESSION")).isEmpty();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SessionAutoConfigurationJdbcTests.java   
@Test
public void customTableName() {
    load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class),
            "spring.session.store-type=jdbc",
            "spring.session.jdbc.table-name=FOO_BAR",
            "spring.session.jdbc.schema=classpath:session/custom-schema-h2.sql");
    JdbcOperationsSessionRepository repository = validateSessionRepository(
            JdbcOperationsSessionRepository.class);
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
            .isEqualTo("FOO_BAR");
    assertThat(this.context.getBean(JdbcOperations.class)
            .queryForList("select * from FOO_BAR")).isEmpty();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:AbstractJpaAutoConfigurationTests.java   
@Test
public void testDataSourceTransactionManagerNotCreated() throws Exception {
    this.context.register(DataSourceTransactionManagerAutoConfiguration.class);
    setupTestConfiguration();
    this.context.refresh();
    assertThat(this.context.getBean(DataSource.class)).isNotNull();
    assertThat(this.context.getBean("transactionManager"))
            .isInstanceOf(JpaTransactionManager.class);
}
项目:spring-boot-concourse    文件:TransactionAutoConfigurationTests.java   
@Test
public void singleTransactionManager() {
    load(DataSourceAutoConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    TransactionTemplate transactionTemplate = this.context
            .getBean(TransactionTemplate.class);
    assertThat(transactionTemplate.getTransactionManager())
            .isSameAs(transactionManager);
}
项目:spring-boot-concourse    文件:SessionAutoConfigurationTests.java   
@Test
public void jdbcSessionStore() {
    load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class),
            "spring.session.store-type=jdbc");
    JdbcOperationsSessionRepository repository = validateSessionRepository(
            JdbcOperationsSessionRepository.class);
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
            .isEqualTo("SPRING_SESSION");
}
项目:spring-boot-concourse    文件:SessionAutoConfigurationTests.java   
@Test
public void jdbcSessionStoreCustomTableName() {
    load(Arrays.asList(EmbeddedDataSourceConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class),
            "spring.session.store-type=jdbc",
            "spring.session.jdbc.table-name=FOO_BAR");
    JdbcOperationsSessionRepository repository = validateSessionRepository(
            JdbcOperationsSessionRepository.class);
    assertThat(new DirectFieldAccessor(repository).getPropertyValue("tableName"))
            .isEqualTo("FOO_BAR");
}
项目:spring-boot-concourse    文件:AbstractJpaAutoConfigurationTests.java   
@Test
public void testDataSourceTransactionManagerNotCreated() throws Exception {
    this.context.register(DataSourceTransactionManagerAutoConfiguration.class);
    setupTestConfiguration();
    this.context.refresh();
    assertThat(this.context.getBean(DataSource.class)).isNotNull();
    assertThat(this.context.getBean("transactionManager"))
            .isInstanceOf(JpaTransactionManager.class);
}
项目:contestparser    文件:TransactionAutoConfigurationTests.java   
@Test
public void singleTransactionManager() {
    load(DataSourceAutoConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    TransactionTemplate transactionTemplate = this.context
            .getBean(TransactionTemplate.class);
    assertSame(transactionManager, transactionTemplate.getTransactionManager());
}
项目:contestparser    文件:AbstractJpaAutoConfigurationTests.java   
@Test
public void testDataSourceTransactionManagerNotCreated() throws Exception {
    this.context.register(DataSourceTransactionManagerAutoConfiguration.class);
    setupTestConfiguration();
    this.context.refresh();
    assertNotNull(this.context.getBean(DataSource.class));
    assertTrue(this.context
            .getBean("transactionManager") instanceof JpaTransactionManager);
}