summaryrefslogtreecommitdiff
path: root/python/tests_0-10
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-11-06 17:27:27 +0000
committerGordon Sim <gsim@apache.org>2007-11-06 17:27:27 +0000
commita2ded139f371d273afa858f49a5b7f6e0efc2394 (patch)
tree8fc04da8ffe3aa819843a101a75d98429f27eaa5 /python/tests_0-10
parenta1a0ecfbf02293cf917db5e56d65d367be5ad5a7 (diff)
downloadqpid-python-a2ded139f371d273afa858f49a5b7f6e0efc2394.tar.gz
Add support for array type to c++ (and python, decode only for now)
Change the type of the in-doubt field in dtx-coordination.recover to an array (to bring in line with amqp spec) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@592494 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests_0-10')
-rw-r--r--python/tests_0-10/dtx.py55
1 files changed, 43 insertions, 12 deletions
diff --git a/python/tests_0-10/dtx.py b/python/tests_0-10/dtx.py
index 8fdd32c2f5..5ee4dd4c16 100644
--- a/python/tests_0-10/dtx.py
+++ b/python/tests_0-10/dtx.py
@@ -304,6 +304,38 @@ class DtxTests(TestBase):
self.assertMessageId("a", "two")
self.assertMessageId("b", "one")
+ def test_suspend_start_end_resume(self):
+ """
+ Test suspension and resumption of an association with work
+ done on another transaction when the first transaction is
+ suspended
+ """
+ channel = self.channel
+ channel.dtx_demarcation_select()
+
+ #setup
+ channel.queue_declare(queue="one", exclusive=True, auto_delete=True)
+ channel.queue_declare(queue="two", exclusive=True, auto_delete=True)
+ channel.message_transfer(content=Content(properties={'routing_key':"one", 'message_id':"a"}, body="DtxMessage"))
+ channel.message_transfer(content=Content(properties={'routing_key':"two", 'message_id':"b"}, body="DtxMessage"))
+
+ tx = self.xid("dummy")
+
+ channel.dtx_demarcation_start(xid=tx)
+ self.swap(channel, "one", "two")#swap 'a' from 'one' to 'two'
+ channel.dtx_demarcation_end(xid=tx, suspend=True)
+
+ channel.dtx_demarcation_start(xid=tx, resume=True)
+ self.swap(channel, "two", "one")#swap 'b' from 'two' to 'one'
+ channel.dtx_demarcation_end(xid=tx)
+
+ #commit and check
+ channel.dtx_coordination_commit(xid=tx, one_phase=True)
+ self.assertMessageCount(1, "one")
+ self.assertMessageCount(1, "two")
+ self.assertMessageId("a", "two")
+ self.assertMessageId("b", "one")
+
def test_end_suspend_and_fail(self):
"""
Verify that the correct error is signalled if the suspend and
@@ -538,18 +570,7 @@ class DtxTests(TestBase):
else:
channel.dtx_coordination_rollback(xid=tx)
- indoubt = channel.dtx_coordination_recover().in_doubt
- #convert indoubt table to a list of xids (note: this will change for 0-10)
- data = indoubt["xids"]
- xids = []
- pos = 0
- while pos < len(data):
- size = unpack("!B", data[pos])[0]
- start = pos + 1
- end = start + size
- xid = data[start:end]
- xids.append(xid)
- pos = end
+ xids = channel.dtx_coordination_recover().in_doubt
#rollback the prepared transactions returned by recover
for x in xids:
@@ -567,6 +588,16 @@ class DtxTests(TestBase):
channel.dtx_coordination_rollback(xid=x)
self.fail("Recovered xids not as expected. missing: %s; extra: %s" % (missing, extra))
+ def test_bad_resume(self):
+ """
+ Test that a resume on a session not selected for use with dtx fails
+ """
+ channel = self.channel
+ try:
+ channel.dtx_demarcation_start(resume=True)
+ except Closed, e:
+ self.assertConnectionException(503, e.args[0])
+
def xid(self, txid):
DtxTests.tx_counter += 1
branchqual = "v%s" % DtxTests.tx_counter