summaryrefslogtreecommitdiff
path: root/qpid/java/systests/src
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-03-05 23:24:08 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-03-05 23:24:08 +0000
commit5aa51bf2404940eb62d0365468e0b7d4c5c6adf2 (patch)
treecf67d00c94d9f98bb71f527467f2545a836ba8b1 /qpid/java/systests/src
parent5a92018f672c52d0deb014c1f1a147d66ba1a4bc (diff)
downloadqpid-python-5aa51bf2404940eb62d0365468e0b7d4c5c6adf2.tar.gz
This is a fix for QPID-2432
Modified the XAResourceImpl to maintain the timeout value and set it to any XID in the start method if the time value > 0 Also the XID nulled after commit, rollback and forget, to prevent a timeout being set on an invalid xid. The setTimeout method will only set the timeout if xid is not null and if the timeout value is different from the previous value. Modified the test cases in FaulTest to adhere to the correct behaviour and also added a new test case to cover the issue mentioned in the JIRA. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@919666 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/systests/src')
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java
index 1e5932b6db..47705f8105 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java
@@ -339,7 +339,7 @@ public class FaultTest extends AbstractXATestCase
{
assertEquals("Wrong error code: ", XAException.XAER_PROTO, e.errorCode);
}
- }
+ }
/**
* Strategy:
@@ -355,7 +355,7 @@ public class FaultTest extends AbstractXATestCase
_xaResource.end(xid, XAResource.TMSUCCESS);
xid = getNewXid();
_xaResource.start(xid, XAResource.TMNOFLAGS);
- assertEquals("Wrong timeout", _xaResource.getTransactionTimeout(), 0);
+ assertEquals("Wrong timeout", _xaResource.getTransactionTimeout(), 1000);
}
/**
@@ -381,5 +381,29 @@ public class FaultTest extends AbstractXATestCase
assertEquals("Wrong error code: ", XAException.XA_RBTIMEOUT, e.errorCode);
}
}
+
+ /**
+ * Strategy:
+ * Set the transaction timeout to 1000
+ */
+ public void testTransactionTimeoutAfterCommit() throws Exception
+ {
+ Xid xid = getNewXid();
+
+ _xaResource.start(xid, XAResource.TMNOFLAGS);
+ _xaResource.setTransactionTimeout(1000);
+ assertEquals("Wrong timeout", 1000,_xaResource.getTransactionTimeout());
+
+ //_xaResource.prepare(xid);
+ _xaResource.end(xid, XAResource.TMSUCCESS);
+ _xaResource.commit(xid, true);
+
+ _xaResource.setTransactionTimeout(2000);
+ assertEquals("Wrong timeout", 2000,_xaResource.getTransactionTimeout());
+
+ xid = getNewXid();
+ _xaResource.start(xid, XAResource.TMNOFLAGS);
+ assertEquals("Wrong timeout", 2000, _xaResource.getTransactionTimeout());
+ }
}