Connection connection1 = poolingDataSource1.getConnection();
PooledConnectionProxy handle1 = (PooledConnectionProxy) connection1;
XAConnection xaConnection1 = (XAConnection) AbstractMockJdbcTest.getWrappedXAConnectionOf(handle1.getPooledConnection());
MockXAResource xaResource1 = (MockXAResource) xaConnection1.getXAResource();
xaResource1.setEndException(new BitronixXAException("screw delistment", XAException.XAER_RMERR));
xaResource1.setRollbackException(new BitronixXAException("delistment was screwed, cannot rollback", XAException.XAER_RMERR));
connection1.createStatement(); // triggers enlistment
Connection connection2 = poolingDataSource2.getConnection();
PooledConnectionProxy handle2 = (PooledConnectionProxy) connection2;
XAConnection xaConnection2 = (XAConnection) AbstractMockJdbcTest.getWrappedXAConnectionOf(handle2.getPooledConnection());
MockXAResource xaResource2 = (MockXAResource) xaConnection2.getXAResource();
xaResource2.setEndException(new BitronixXAException("what was that transaction again?", XAException.XAER_NOTA));
xaResource2.setRollbackException(new BitronixXAException("delistment unilaterally rolled back, cannot rollback twice", XAException.XAER_RMERR));
connection2.createStatement(); // triggers enlistment
try {
btm.commit();