FIX: possible resource leaking in testcases (all created transactions are closed by followed try statement) (#1273)

This commit is contained in:
Roland Praml
2018-02-26 08:40:53 +13:00
committed by Rob Bygrave
parent 8e9843ab8a
commit e3425a8850
23 changed files with 278 additions and 265 deletions
@@ -96,18 +96,20 @@ public class TestSqlUpdateInTxn extends BaseTestCase {
Ebean.beginTransaction();
try {
SqlUpdate update = Ebean.createSqlUpdate(updateDml);
update.setParameter("desc", "foo4");
update.setParameter("id", id);
update.execute();
SqlUpdate update = Ebean.createSqlUpdate(updateDml);
update.setParameter("desc", "foo4");
update.setParameter("id", id);
update.execute();
updateMod = Ebean.createSqlUpdate(updateModDml);
updateMod.setParameter("desc", "mod2");
updateMod.execute();
Ebean.commitTransaction();
updateMod = Ebean.createSqlUpdate(updateModDml);
updateMod.setParameter("desc", "mod2");
updateMod.execute();
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
AuditLog log5 = Ebean.find(AuditLog.class, log.getId());
Assert.assertEquals("foo4", log5.getDescription());
Assert.assertEquals("mod2", log5.getModifiedDescription());