BATCH-970: made the transaction participation configurable

This commit is contained in:
trisberg
2008-12-15 17:30:34 +00:00
parent 6d6f54beea
commit 2a1305358e
2 changed files with 30 additions and 1 deletions

View File

@@ -26,6 +26,14 @@ public class JdbcCursorItemReaderConfigTests {
*/
@Test
public void testUsesCurrentTransaction() throws Exception {
}
/*
* Should fail if trying to call getConnection() twice
*/
@Test
public void testUsesItsOwnTransaction() throws Exception {
DataSource ds = createMock(DataSource.class);
Connection con = createMock(Connection.class);
@@ -34,6 +42,7 @@ public class JdbcCursorItemReaderConfigTests {
expect(con.prepareStatement("select foo from bar", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
ResultSet.HOLD_CURSORS_OVER_COMMIT)).andReturn(ps);
expect(ds.getConnection()).andReturn(con);
expect(ds.getConnection()).andReturn(con);
con.commit();
replay(con);
replay(ds);