コード例 #1
0
 public boolean isSameRM(XAResource xaResource) throws XAException {
   if (!(xaResource instanceof TransactionXaAdapter)) {
     return false;
   }
   TransactionXaAdapter other = (TransactionXaAdapter) xaResource;
   return other.equals(this);
 }
コード例 #2
0
 public void testPrepareTxMarkedForRollback() {
   localTx.markForRollback();
   try {
     xaAdapter.prepare(xid);
     assert false;
   } catch (XAException e) {
     assert e.errorCode == XAException.XA_RBROLLBACK;
   }
 }
コード例 #3
0
 public void testRollabckOnNonexistentXid() {
   DummyXid xid = new DummyXid();
   try {
     xaAdapter.rollback(xid);
     assert false;
   } catch (XAException e) {
     assert e.errorCode == XAException.XAER_NOTA;
   }
 }
コード例 #4
0
 public void testCommitOnNonexistentXid() {
   DummyXid xid = new DummyXid();
   try {
     xaAdapter.commit(xid, false);
     assert false;
   } catch (XAException e) {
     assert e.errorCode == XAException.XAER_NOTA;
   }
 }
コード例 #5
0
 public void testPrepareOnNonexistentXid() {
   DummyXid xid = new DummyXid();
   try {
     xaAdapter.prepare(xid);
     assert false;
   } catch (XAException e) {
     assert e.errorCode == XAException.XAER_NOTA;
   }
 }
コード例 #6
0
 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;
   }
 }
コード例 #7
0
 public void testOnePhaseCommitConfigured() throws XAException {
   configuration.setCacheMode(Configuration.CacheMode.INVALIDATION_ASYNC); // this would force 1pc
   assert XAResource.XA_OK == xaAdapter.prepare(xid);
 }