Xid externalXid = xidFactory.createXid();
Transaction tx = tm.importXid(externalXid, 0);
tx.enlistResource(r1_1);
tx.enlistResource(r1_2);
tx.enlistResource(r2_1);
tx.enlistResource(r2_2);
tx.delistResource(r1_1, XAResource.TMSUCCESS);
tx.delistResource(r1_2, XAResource.TMSUCCESS);
tx.delistResource(r2_1, XAResource.TMSUCCESS);
tx.delistResource(r2_2, XAResource.TMSUCCESS);
assertEquals(XAResource.XA_OK, tm.prepare(tx));