use of com.arjuna.ats.internal.jta.transaction.jts.TransactionImple in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testRecovery.
@Test
public void testRecovery() throws Exception {
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
DummyXAResourceRecord xares = new DummyXAResourceRecord(new TransactionImple(), new DummyXA(false), new XidImple(new Uid()), params);
assertEquals(xares.getRecoveryCoordinator(), null);
assertEquals(xares.recover(), XARecoveryResource.FAILED_TO_RECOVER);
xares.setXAResource(null);
}
use of com.arjuna.ats.internal.jta.transaction.jts.TransactionImple in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testRollbackFailure.
@Test
public void testRollbackFailure() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
FailureXAResource fxa = new FailureXAResource(FailureXAResource.FailLocation.rollback);
TransactionImple tx = new TransactionImple();
XAResourceRecord xares = new XAResourceRecord(tx, fxa, tx.getTxId(), null);
assertEquals(xares.prepare(), Vote.VoteCommit);
try {
xares.rollback();
fail();
} catch (final HeuristicMixed ex) {
}
xares.forget();
}
use of com.arjuna.ats.internal.jta.transaction.jts.TransactionImple in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testPackUnpack.
@Test
public void testPackUnpack() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
XAResourceRecord xares;
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(), new DummyXA(false), new XidImple(new Uid()), params);
OutputObjectState os = new OutputObjectState();
assertTrue(xares.saveState(os));
xares = new XAResourceRecord();
InputObjectState is = new InputObjectState(os);
assertTrue(xares.restoreState(is));
}
use of com.arjuna.ats.internal.jta.transaction.jts.TransactionImple in project narayana by jbosstm.
the class XAResourceRecordUnitTest method test.
@Test
public void test() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
XAResourceRecord xares = new XAResourceRecord();
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(), new DummyXA(false), new XidImple(new Uid()), params);
xares.merge(null);
xares.alter(null);
assertTrue(xares.type() != null);
assertTrue(xares.toString() != null);
assertTrue(xares.get_uid().notEquals(Uid.nullUid()));
}
use of com.arjuna.ats.internal.jta.transaction.jts.TransactionImple in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testValid2PC.
@Test
public void testValid2PC() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
TransactionImple tx = new TransactionImple();
DummyXA res = new DummyXA(false);
XAResourceRecord xares = new XAResourceRecord(tx, res, tx.getTxId(), null);
assertEquals(xares.prepare(), Vote.VoteCommit);
xares.commit();
}
Aggregations