You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2018/01/25 18:18:55 UTC
[aries-tx-control] branch master updated: Tx Control spec
compliance - re-fix the setRollbackOnly issue in pre completion and add a
unit test
This is an automated email from the ASF dual-hosted git repository.
timothyjward pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-tx-control.git
The following commit(s) were added to refs/heads/master by this push:
new 1272046 Tx Control spec compliance - re-fix the setRollbackOnly issue in pre completion and add a unit test
1272046 is described below
commit 127204681ca6f18882145c3250f471d24710f62f
Author: Tim Ward <ti...@apache.org>
AuthorDate: Thu Jan 25 13:17:29 2018 -0500
Tx Control spec compliance - re-fix the setRollbackOnly issue in pre completion and add a unit test
---
.../service/xa/impl/TransactionContextImpl.java | 7 ++++---
.../service/xa/impl/TransactionControlRunningTest.java | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java b/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java
index 678f416..109ff85 100644
--- a/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java
+++ b/tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/TransactionContextImpl.java
@@ -315,10 +315,11 @@ public class TransactionContextImpl extends AbstractTransactionContextImpl imple
if (re.getCause() instanceof SetRollbackOnlyException) {
// This means that a pre-completion callback called setRollbackOnly
// which can be safely ignored (i.e. it's not really an exception)
- }
- TransactionRolledBackException tre =
+ } else {
+ TransactionRolledBackException tre =
new TransactionRolledBackException(re.getMessage(), re);
- throw tre;
+ throw tre;
+ }
}
}
} catch (Exception e) {
diff --git a/tx-control-services/tx-control-service-xa/src/test/java/org/apache/aries/tx/control/service/xa/impl/TransactionControlRunningTest.java b/tx-control-services/tx-control-service-xa/src/test/java/org/apache/aries/tx/control/service/xa/impl/TransactionControlRunningTest.java
index aa5c0a0..d528fbe 100644
--- a/tx-control-services/tx-control-service-xa/src/test/java/org/apache/aries/tx/control/service/xa/impl/TransactionControlRunningTest.java
+++ b/tx-control-services/tx-control-service-xa/src/test/java/org/apache/aries/tx/control/service/xa/impl/TransactionControlRunningTest.java
@@ -94,6 +94,24 @@ public class TransactionControlRunningTest {
}
@Test
+ public void testRequiredMarkedRollbackInPrecompletion() {
+
+ AtomicReference<TransactionStatus> finalStatus = new AtomicReference<>();
+
+ txControl.required(() -> {
+
+ assertTrue(txControl.activeTransaction());
+
+ txControl.getCurrentContext().postCompletion(finalStatus::set);
+
+ txControl.getCurrentContext().preCompletion(txControl::setRollbackOnly);
+ return null;
+ });
+
+ assertEquals(ROLLED_BACK, finalStatus.get());
+ }
+
+ @Test
public void testRequiredUserException() {
AtomicReference<TransactionStatus> finalStatus = new AtomicReference<>();
--
To stop receiving notification emails like this one, please contact
timothyjward@apache.org.