Java Code Examples for org.springframework.boot.jdbc.XADataSourceWrapper

The following examples show how to use org.springframework.boot.jdbc.XADataSourceWrapper. These examples are extracted from open source projects. 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
@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
@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
@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
@Bean
@ConditionalOnMissingBean(XADataSourceWrapper.class)
public XADataSourceWrapper xaDataSourceWrapper(NarayanaProperties narayanaProperties,
        XARecoveryModule xaRecoveryModule) {
    return new GenericXADataSourceWrapper(narayanaProperties, xaRecoveryModule);
}
 
Example 5
@Bean
@ConditionalOnMissingBean(XADataSourceWrapper.class)
public XADataSourceWrapper xaDataSourceWrapper(NarayanaProperties narayanaProperties,
        XARecoveryModule xaRecoveryModule, TransactionManager transactionManager) {
    return new PooledXADataSourceWrapper(narayanaProperties, xaRecoveryModule, transactionManager);
}