Re: XA rollback problem
On Mon, 24 Apr 2006, Kris Jurka wrote:
Also to test this I added pg support to Simple JTA, but this required
adjusting the PGXADatasource code to have a setUrl method. Did you do the
same or do you have a simpler way of testing?
If anyone else is interested in looking at this the attached patch adds a
test for this situation to our existing regression tests.
Kris Jurka
Index: org/postgresql/test/xa/XADataSourceTest.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/xa/XADataSourceTest.java,v
retrieving revision 1.5
diff -c -r1.5 XADataSourceTest.java
*** org/postgresql/test/xa/XADataSourceTest.java 24 Nov 2005 02:31:44 -0000 1.5
--- org/postgresql/test/xa/XADataSourceTest.java 24 Apr 2006 07:28:17 -0000
***************
*** 142,147 ****
--- 142,160 ----
xaRes.commit(xid, false);
}
+ public void testCloseBeforeCommit() throws Exception {
+ Xid xid = new CustomXid(5);
+ xaRes.start(xid, XAResource.TMNOFLAGS);
+ assertEquals(1, conn.createStatement().executeUpdate("INSERT INTO testxa1 VALUES (1)"));
+ conn.close();
+ xaRes.end(xid, XAResource.TMSUCCESS);
+ xaRes.commit(xid, true);
+
+ ResultSet rs = _conn.createStatement().executeQuery("SELECT foo FROM testxa1");
+ assertTrue(rs.next());
+ assertEquals(1, rs.getInt(1));
+ }
+
public void testRecover() throws Exception {
Xid xid = new CustomXid(12345);
xaRes.start(xid, XAResource.TMNOFLAGS);
Home |
Main Index |
Thread Index