@After public void closeTransaction() throws DataAccessException, SQLException { try { if (connectionToKeepInMemoryDatabaseAlive != null) { connectionToKeepInMemoryDatabaseAlive.close(); } } finally { CurrentTransaction.close(false); } }
@Before public void createInMemoryDatabase() throws DataAccessException, SQLException { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL("jdbc:h2:mem:" + getClass().getSimpleName() + "_" + uniqueId + ";MVCC=TRUE"); uniqueId++; CompositeDatasourceTransaction.registerDataSource("test", dataSource); connectionToKeepInMemoryDatabaseAlive = dataSource.getConnection(); CurrentTransaction.create(); }