[libpostgresql-jdbc-java] 86/128: Added test case for checking the return code when an xid does not exist.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:18:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to annotated tag REL9_3_1100
in repository libpostgresql-jdbc-java.

commit d2274085e1cbccc5fb84829c95b1d4a57e371a90
Author: Jeremy Whiting <whitingjr at hotmail.com>
Date:   Wed Jul 31 11:58:23 2013 +0100

    Added test case for checking the return code when an xid does not exist.
---
 org/postgresql/test/xa/XADataSourceTest.java | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/org/postgresql/test/xa/XADataSourceTest.java b/org/postgresql/test/xa/XADataSourceTest.java
index 086f925..097f9d1 100644
--- a/org/postgresql/test/xa/XADataSourceTest.java
+++ b/org/postgresql/test/xa/XADataSourceTest.java
@@ -319,7 +319,33 @@ public class XADataSourceTest extends TestCase {
 
         assertTrue(!conn.getAutoCommit());
     }
-
+    
+    /**
+     * Test how the driver responds to rolling back a transaction
+     * that has already been rolled back. Check the driver
+     * reports the xid does not exist. The db knows the fact. 
+     * ERROR:  prepared transaction with identifier "blah" does not exist
+     * 
+     * @throws Exception 
+     */
+    public void testRepeatedRolledBack() throws Exception {
+    	Xid xid = new CustomXid(654321);
+        xaRes.start(xid, XAResource.TMNOFLAGS);
+        xaRes.end(xid, XAResource.TMSUCCESS);
+        xaRes.prepare(xid);
+        //tm crash
+        xaRes.recover(XAResource.TMSTARTRSCAN);
+        xaRes.rollback(xid);
+        try
+        {
+        	xaRes.rollback(xid);
+        }
+        catch (XAException xae)
+        {
+        	assertEquals("Checking the errorCode is XAER_NOTA indicating the " +
+        			"xid does not exist.", XAException.XAER_NOTA, xae.errorCode );
+        }
+    }
 
     /* We don't support transaction interleaving.
     public void testInterleaving1() throws Exception {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list