IDEMPIERE-87 AdempiereTestCase must not close the transaction when committing/rolling back

http://jira.idempiere.com/browse/IDEMPIERE-87
This commit is contained in:
Carlos Ruiz 2011-10-23 09:48:44 -05:00
parent 29ed9dd002
commit 694aa1242b
1 changed files with 16 additions and 12 deletions

View File

@ -171,14 +171,9 @@ public class AdempiereTestCase extends TestCase
if (trxName != null) if (trxName != null)
trx = Trx.get(trxName, false); trx = Trx.get(trxName, false);
if (trx != null && trx.isActive()) { if (trx != null && trx.isActive()) {
try {
trx.commit(true); trx.commit(true);
} finally {
trx.close();
} }
} }
trx = null;
}
/** /**
* Rollback active transaction * Rollback active transaction
@ -188,14 +183,21 @@ public class AdempiereTestCase extends TestCase
if (trxName != null) if (trxName != null)
trx = Trx.get(trxName, false); trx = Trx.get(trxName, false);
if (trx != null && trx.isActive()) { if (trx != null && trx.isActive()) {
try {
trx.rollback(); trx.rollback();
} finally { }
}
/**
* Close active transaction
*/
protected void close() {
Trx trx = null;
if (trxName != null)
trx = Trx.get(trxName, false);
if (trx != null) {
trx.close(); trx.close();
} }
} }
trx = null;
}
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
@ -207,6 +209,8 @@ public class AdempiereTestCase extends TestCase
trx = Trx.get(trxName, false); trx = Trx.get(trxName, false);
if (trx != null && trx.isActive()) { if (trx != null && trx.isActive()) {
trx.rollback(); trx.rollback();
}
if (trx != null) {
trx.close(); trx.close();
} }
trx = null; trx = null;