FIX: deadlock in TestCommitAndContiune for sqlserver & hsqldb (#1098)

This commit is contained in:
Roland Praml authored and Rob Bygrave committed 2017-08-30 20:03:41 +12:00
1 parent 6f854da70b
commit 4c8e1113bf
2 files changed
+13 -6

No files matched your search

+4
View File
@@ -60,6 +60,10 @@ public class BaseTestCase {
return Platform.H2 == platform(); return Platform.H2 == platform();
} }
public boolean isHSqlDb() {
return Platform.HSQLDB == platform();
}
public boolean isOracle() { public boolean isOracle() {
return Platform.ORACLE == platform(); return Platform.ORACLE == platform();
} }
@@ -20,7 +20,8 @@ public class TestCommitAndContinue extends BaseTestCase {
@Test @Test
@Transactional @Transactional
public void transactional_partialSuccess() { public void transactional_partialSuccess() {
if (isHSqlDb()) return; // HSQL will lock up here
MnyB a = new MnyB("a100"); MnyB a = new MnyB("a100");
MnyB b = new MnyB("b200"); MnyB b = new MnyB("b200");
@@ -79,11 +80,11 @@ public class TestCommitAndContinue extends BaseTestCase {
txn.setRollbackOnly(); txn.setRollbackOnly();
// use a different transaction to assert // use a different transaction to assert
try (Transaction anotherTxn = server.createTransaction()) { if (!isSqlServer() && !isHSqlDb()) { // sqlServer & HSQL dead locks here...
// success prior to commitAndContinue try (Transaction anotherTxn = server.createTransaction()) {
assertNotNull(server.find(MnyB.class, a.getId(), anotherTxn)); // success prior to commitAndContinue
// insert failed after commitAndContinue assertNotNull(server.find(MnyB.class, a.getId(), anotherTxn));
if (!isSqlServer()) { // sqlServer dead locks here... // insert failed after commitAndContinue
assertNull(server.find(MnyB.class, b.getId(), anotherTxn)); assertNull(server.find(MnyB.class, b.getId(), anotherTxn));
} }
//anotherTxn.end(); //anotherTxn.end();
@@ -103,6 +104,8 @@ public class TestCommitAndContinue extends BaseTestCase {
@Transactional @Transactional
public void transactional_partialSuccess_secondTransactionInsert() { public void transactional_partialSuccess_secondTransactionInsert() {
if (isHSqlDb()) return; // HSQL will lock up here
MnyB a = new MnyB("a100"); MnyB a = new MnyB("a100");
MnyB b = new MnyB("b200"); MnyB b = new MnyB("b200");
MnyB c = new MnyB("c300"); MnyB c = new MnyB("c300");