org.springframework.boot.jdbc.XADataSourceWrapper Java Examples

The following examples show how to use org.springframework.boot.jdbc.XADataSourceWrapper. 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: NarayanaConfigurationIT.java    From narayana-spring-boot with Apache License 2.0 5 votes vote down vote up
@Test
public void allDefaultBeansShouldBeLoaded() {
    this.context = new AnnotationConfigApplicationContext(NarayanaConfiguration.class);
    this.context.getBean(NarayanaBeanFactoryPostProcessor.class);
    this.context.getBean(XADataSourceWrapper.class);
    this.context.getBean(XAConnectionFactoryWrapper.class);
    this.context.getBean(NarayanaPropertiesInitializer.class);
    this.context.getBean(UserTransaction.class);
    this.context.getBean(TransactionManager.class);
    this.context.getBean(JtaTransactionManager.class);
    this.context.getBean(RecoveryManagerService.class);
    this.context.getBean(XARecoveryModule.class);
}
 
Example #2
Source File: NarayanaConfigurationIT.java    From narayana-spring-boot with Apache License 2.0 5 votes vote down vote up
@Test
public void genericXaDataSourceWrapperShouldBeLoaded() {
    Properties properties = new Properties();
    properties.put("narayana.dbcp.enabled", "false");
    PropertiesPropertySource propertySource = new PropertiesPropertySource("test", properties);

    this.context = new AnnotationConfigApplicationContext();
    this.context.register(NarayanaConfiguration.class);
    this.context.getEnvironment().getPropertySources().addFirst(propertySource);
    this.context.refresh();

    XADataSourceWrapper xaDataSourceWrapper = this.context.getBean(XADataSourceWrapper.class);
    assertThat(xaDataSourceWrapper).isInstanceOf(GenericXADataSourceWrapper.class);
}
 
Example #3
Source File: NarayanaConfigurationIT.java    From narayana-spring-boot with Apache License 2.0 5 votes vote down vote up
@Test
public void pooledXaDataSourceWrapperShouldBeLoaded() {
    Properties properties = new Properties();
    properties.put("narayana.dbcp.enabled", "true");
    PropertiesPropertySource propertySource = new PropertiesPropertySource("test", properties);

    this.context = new AnnotationConfigApplicationContext();
    this.context.register(NarayanaConfiguration.class);
    this.context.getEnvironment().getPropertySources().addFirst(propertySource);
    this.context.refresh();

    XADataSourceWrapper xaDataSourceWrapper = this.context.getBean(XADataSourceWrapper.class);
    assertThat(xaDataSourceWrapper).isInstanceOf(PooledXADataSourceWrapper.class);
}
 
Example #4
Source File: NarayanaConfiguration.java    From narayana-spring-boot with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(XADataSourceWrapper.class)
public XADataSourceWrapper xaDataSourceWrapper(NarayanaProperties narayanaProperties,
        XARecoveryModule xaRecoveryModule) {
    return new GenericXADataSourceWrapper(narayanaProperties, xaRecoveryModule);
}
 
Example #5
Source File: NarayanaConfiguration.java    From narayana-spring-boot with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(XADataSourceWrapper.class)
public XADataSourceWrapper xaDataSourceWrapper(NarayanaProperties narayanaProperties,
        XARecoveryModule xaRecoveryModule, TransactionManager transactionManager) {
    return new PooledXADataSourceWrapper(narayanaProperties, xaRecoveryModule, transactionManager);
}