void executeNonTransactionTest() { TestHelper.assertNotInTransaction(); helper.execute("INSERT INTO Foo VALUES('g', 'G')"); assertData("g", "G"); TestHelper.assertNotInTransaction(); helper.execute("INSERT INTO Foo VALUES('h', 'H')"); assertData("h", "H"); TestHelper.assertNotInTransaction(); }
@Transactional private void executeTestNested(ConnectionInfo info) { helper.execute("INSERT INTO Foo VALUES('e', 'E')"); assertData("e", "E"); TestHelper.assertInTransaction(info); helper.execute("INSERT INTO Foo VALUES('f', 'F')"); assertData("f", "F"); TestHelper.assertInTransaction(info); executeNestedNonTransactionTest(info); }
@Transactional void executeTest() { TestHelper.assertInTransaction(); helper.execute("INSERT INTO Foo VALUES('c', 'C')"); assertData("c", "C"); ConnectionInfo info = TestHelper.getConnectionInfo(); helper.execute("INSERT INTO Foo VALUES('d', 'D')"); assertData("d", "D"); TestHelper.assertInTransaction(info); executeTestNested(info); }
@Transactional List<ConnectionInfo> executeExceptionalTest() { TestHelper.assertInTransaction(); helper.execute("INSERT INTO Foo VALUES('i', 'I')"); assertData("i", "I"); throw new RuntimeException("test"); }
private void executeNestedNonTransactionTest(ConnectionInfo info) { helper.execute("INSERT INTO Foo VALUES('z', 'Z')"); assertData("z", "Z"); TestHelper.assertInTransaction(info); }
void setup() { helper.execute("CREATE TABLE Foo( Bar VARCHAR(10), Baz VARCHAR(10))"); helper.execute("INSERT INTO Foo VALUES('a', 'A')"); helper.execute("INSERT INTO Foo VALUES('b', 'B')"); }