Connection conn;
conn = xa.getConnection();
Statement stat = conn.createStatement();
stat.execute("create table test(id int primary key, name varchar(255))");
Xid xid = SimpleXid.createRandom();
xa.getXAResource().start(xid, XAResource.TMNOFLAGS);
conn.setAutoCommit(false);
stat.execute("insert into test values(1, 'Hello')");
xa.getXAResource().end(xid, XAResource.TMSUCCESS);
xa.getXAResource().prepare(xid);
if (shutdown) {
shutdown(ds);
}
xa = ds.getXAConnection();
Xid[] list = xa.getXAResource().recover(XAResource.TMSTARTRSCAN);
assertEquals(1, list.length);
assertTrue(xid.equals(list[0]));
if (commit) {
xa.getXAResource().commit(list[0], false);
} else {
xa.getXAResource().rollback(list[0]);
}