diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-03-05 23:24:08 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-03-05 23:24:08 +0000 |
| commit | 5198e3474da92d82799446a4ccd183aa83d9a839 (patch) | |
| tree | e1180e6e0657c75ca4b3967a611c93787fa42c35 /java/systests/src | |
| parent | 60d8d546a05412990fa77ed1e4d724ef0a8a88dd (diff) | |
| download | qpid-python-5198e3474da92d82799446a4ccd183aa83d9a839.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/qpid@919666 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java index 1e5932b6db..47705f8105 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/xa/FaultTest.java +++ b/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()); + } } |
