Skip to content

Commit bdd6316

Browse files
committed
Fixed a missing rollback in testCommit
1 parent 4ed9e54 commit bdd6316

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

test-complete/src/test/java/com/marklogic/client/functionaltest/TestBiTemporal.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ public void testTransactionCommit() throws Exception {
18601860
Transaction transaction = writerClient
18611861
.openTransaction("Transaction for BiTemporal");
18621862
try {
1863-
insertJSONSingleDocument(temporalCollectionName, docId, null,
1863+
insertJSONSingleDocument(temporalCollectionName, docId, null,
18641864
transaction, null);
18651865

18661866
// Verify that the document was inserted
@@ -1891,9 +1891,14 @@ public void testTransactionCommit() throws Exception {
18911891
} catch (Exception ex) {
18921892
exceptionThrown = true;
18931893
}
1894-
assertTrue(
1895-
"Exception not thrown during read using no transaction handle",
1896-
exceptionThrown);
1894+
1895+
if (!exceptionThrown) {
1896+
transaction.rollback();
1897+
1898+
assertTrue(
1899+
"Exception not thrown during read using no transaction handle",
1900+
exceptionThrown);
1901+
}
18971902

18981903
updateJSONSingleDocument(temporalCollectionName, docId, transaction, null);
18991904

@@ -2069,8 +2074,12 @@ public void testTransactionRollback() throws Exception {
20692074
exceptionThrown = true;
20702075
}
20712076

2072-
assertTrue("Exception not thrown during read on non-existing uri",
2073-
exceptionThrown);
2077+
if (!exceptionThrown) {
2078+
transaction.rollback();
2079+
2080+
assertTrue("Exception not thrown during read on non-existing uri",
2081+
exceptionThrown);
2082+
}
20742083

20752084
// =======================================================================
20762085
// Now try rollback with delete

0 commit comments

Comments
 (0)