use of com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord 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();
}
use of com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testNested.
@Test
public void testNested() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
XAResourceRecord xares = new XAResourceRecord();
assertEquals(xares.prepare_subtransaction(), Vote.VoteRollback);
try {
xares.commit_subtransaction(null);
fail();
} catch (final UNKNOWN ex) {
}
try {
xares.rollback_subtransaction();
fail();
} catch (final UNKNOWN ex) {
}
assertFalse(xares.propagateOnAbort());
assertFalse(xares.propagateOnCommit());
}
use of com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testReadonly.
@Test
public void testReadonly() 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 TestResource(true), new XidImple(new Uid()), params);
try {
xares.commit();
fail();
} catch (final NotPrepared ex) {
}
assertEquals(xares.prepare(), Vote.VoteReadOnly);
}
use of com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testValid1PC.
@Test
public void testValid1PC() 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);
xares.commit_one_phase();
}
use of com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testCommitFailure.
@Test
public void testCommitFailure() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
FailureXAResource fxa = new FailureXAResource(FailureXAResource.FailLocation.commit);
TransactionImple tx = new TransactionImple();
XAResourceRecord xares = new XAResourceRecord(tx, fxa, tx.getTxId(), null);
assertEquals(xares.prepare(), Vote.VoteCommit);
try {
xares.commit();
fail();
} catch (final HeuristicMixed ex) {
}
xares.forget();
}
Aggregations