@BeforeClass
  public void beforeClass() {
    SingleConnectionDataSource dataSource = new SingleConnectionDataSource();
    dataSource.setUrl("jdbc:h2:mem:test;");

    DataSourceTransactionManager transactionManager = new DataSourceTransactionManager();
    transactionManager.setDataSource(dataSource);
    transactionManager.afterPropertiesSet();

    transactionTemplate = new TransactionTemplate(transactionManager);

    transactionalFileSystemOperations = new TransactionalFileSystemOperations();
  }
 @AfterClass
 public static void clearDataSource() throws Exception {
   dataSource.destroy();
   dataSource = null;
 }
 @BeforeClass
 public static void createDataSource() {
   dataSource = new SingleConnectionDataSource("jdbc:hsqldb:mem:tokenrepotest", "sa", "", true);
   dataSource.setDriverClassName("org.hsqldb.jdbc.JDBCDriver");
 }
Example #4
0
 public static JdbcTemplate getJdbcTemplate() {
   SingleConnectionDataSource ds = new SingleConnectionDataSource();
   ds.setDriverClassName("org.sqlite.JDBC");
   ds.setUrl("jdbc:sqlite:database.sqlite");
   return new JdbcTemplate(ds);
 }