public boolean isSameRM(XAResource xaResource) throws XAException { if (!(xaResource instanceof TransactionXaAdapter)) { return false; } TransactionXaAdapter other = (TransactionXaAdapter) xaResource; return other.equals(this); }
public void testPrepareTxMarkedForRollback() { localTx.markForRollback(); try { xaAdapter.prepare(xid); assert false; } catch (XAException e) { assert e.errorCode == XAException.XA_RBROLLBACK; } }
public void testRollabckOnNonexistentXid() { DummyXid xid = new DummyXid(); try { xaAdapter.rollback(xid); assert false; } catch (XAException e) { assert e.errorCode == XAException.XAER_NOTA; } }
public void testCommitOnNonexistentXid() { DummyXid xid = new DummyXid(); try { xaAdapter.commit(xid, false); assert false; } catch (XAException e) { assert e.errorCode == XAException.XAER_NOTA; } }
public void testPrepareOnNonexistentXid() { DummyXid xid = new DummyXid(); try { xaAdapter.prepare(xid); assert false; } catch (XAException e) { assert e.errorCode == XAException.XAER_NOTA; } }
public void test1PcAndNonExistentXid() { configuration.setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC); try { DummyXid doesNotExists = new DummyXid(); xaAdapter.commit(doesNotExists, false); assert false; } catch (XAException e) { assert e.errorCode == XAException.XAER_NOTA; } }
public void testOnePhaseCommitConfigured() throws XAException { configuration.setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC); // this would force 1pc assert XAResource.XA_OK == xaAdapter.prepare(xid); }