Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 91FD38BDA for ; Thu, 1 Sep 2011 20:19:22 +0000 (UTC) Received: (qmail 33042 invoked by uid 500); 1 Sep 2011 20:19:22 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 32988 invoked by uid 500); 1 Sep 2011 20:19:21 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 32981 invoked by uid 99); 1 Sep 2011 20:19:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 20:19:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 20:19:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 869792388847 for ; Thu, 1 Sep 2011 20:18:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1164246 - /qpid/trunk/qpid/cpp/src/tests/cluster_tests.py Date: Thu, 01 Sep 2011 20:18:56 -0000 To: commits@qpid.apache.org From: aconway@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110901201856.869792388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: aconway Date: Thu Sep 1 20:18:56 2011 New Revision: 1164246 URL: http://svn.apache.org/viewvc?rev=1164246&view=rev Log: QPID-3384: DTX transactions - additional transaction tests. - Update suspended & ended transactions. Modified: qpid/trunk/qpid/cpp/src/tests/cluster_tests.py Modified: qpid/trunk/qpid/cpp/src/tests/cluster_tests.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/cluster_tests.py?rev=1164246&r1=1164245&r2=1164246&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/tests/cluster_tests.py (original) +++ qpid/trunk/qpid/cpp/src/tests/cluster_tests.py Thu Sep 1 20:18:56 2011 @@ -729,25 +729,28 @@ class DtxTestFixture: self.connection = broker.connect_old() self.session = self.connection.session(name, 1) # 1 second timeout self.queue = self.session.queue_declare(name, exclusive=exclusive) - self.xid = self.session.xid(format=0, global_id=name) self.session.dtx_select() self.consumer = None - def start(self, resume=False): - self.test.assertEqual(XA_OK, self.session.dtx_start(xid=self.xid, resume=resume).status) + def xid(self, id=None): + if id is None: id = self.name + return self.session.xid(format=0, global_id=id) - def end(self, suspend=False): - self.test.assertEqual(XA_OK, self.session.dtx_end(xid=self.xid, suspend=suspend).status) + def start(self, id=None, resume=False): + self.test.assertEqual(XA_OK, self.session.dtx_start(xid=self.xid(id), resume=resume).status) - def prepare(self): - self.test.assertEqual(XA_OK, self.session.dtx_prepare(xid=self.xid).status) + def end(self, id=None, suspend=False): + self.test.assertEqual(XA_OK, self.session.dtx_end(xid=self.xid(id), suspend=suspend).status) - def commit(self, one_phase=True): + def prepare(self, id=None): + self.test.assertEqual(XA_OK, self.session.dtx_prepare(xid=self.xid(id)).status) + + def commit(self, id=None, one_phase=True): self.test.assertEqual( - XA_OK, self.session.dtx_commit(xid=self.xid, one_phase=one_phase).status) + XA_OK, self.session.dtx_commit(xid=self.xid(id), one_phase=one_phase).status) - def rollback(self): - self.test.assertEqual(XA_OK, self.session.dtx_rollback(xid=self.xid).status) + def rollback(self, id=None): + self.test.assertEqual(XA_OK, self.session.dtx_rollback(xid=self.xid(id)).status) def send(self, messages): for m in messages: @@ -827,13 +830,19 @@ class DtxTests(BrokerTest): t7.start() self.assertEqual(t7.accept().body, "a"); - # Suspended transaction across join. + # Ended, suspended transactions across join. t8 = DtxTestFixture(self, cluster[0], "t8") - t8.start() + t8.start(id="1") t8.send(["x"]) - t8.end(suspend=True) + t8.end(id="1", suspend=True) + t8.start(id="2") + t8.send(["y"]) + t8.end(id="2") + t8.start() + t8.send("z") - # Start new member + + # Start new cluster member cluster.start() sessions.append(cluster[1].connect().session()) @@ -880,11 +889,14 @@ class DtxTests(BrokerTest): t7.verify(sessions, ["a", "b", "c"]) # Resume t8 - t8.start(resume=True) - t8.send(["y"]) t8.end() t8.commit(one_phase=True) - t8.verify(sessions, ["x","y"]) + t8.start("1", resume=True) + t8.end("1") + t8.commit("1", one_phase=True) + t8.commit("2", one_phase=True) + t8.verify(sessions, ["z", "x","y"]) + def test_dtx_failover_rollback(self): """Kill a broker during a transaction, verify we roll back correctly""" --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscribe@qpid.apache.org