XADataSourceFactory { public static XADataSource build(final DatabaseType databaseType, final DataSource dataSource) { return new DataSourceSwapper(XADataSourceDefinitionFactory.getXADataSourceDefinition(databaseType)).swap(dataSource); }  static XADataSource build(final DatabaseType databaseType, final DataSource dataSource);  }
@Test public void assertCreateH2XADataSource() { XADataSource xaDataSource = XADataSourceFactory.build(DatabaseTypes.getActualDatabaseType("H2"), dataSource); assertThat(xaDataSource, instanceOf(JdbcDataSource.class)); }
@Test public void assertCreateMariaDBXADataSource() { XADataSource xaDataSource = XADataSourceFactory.build(DatabaseTypes.getActualDatabaseType("MariaDB"), dataSource); assertThat(xaDataSource, instanceOf(MariaDbDataSource.class)); }
@Test public void assertCreatePGXADataSource() { when(dataSource.getJdbcUrl()).thenReturn("jdbc:postgresql: XADataSource xaDataSource = XADataSourceFactory.build(DatabaseTypes.getActualDatabaseType("PostgreSQL"), dataSource); assertThat(xaDataSource, instanceOf(PGXADataSource.class)); }
@Test public void assertCreateMSXADataSource() { XADataSource xaDataSource = XADataSourceFactory.build(DatabaseTypes.getActualDatabaseType("SQLServer"), dataSource); assertThat(xaDataSource, instanceOf(SQLServerXADataSource.class)); }