use of com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testInvalid.
@Test
public void testInvalid() throws Exception {
XAResourceRecord xares = new XAResourceRecord();
assertEquals(xares.getXid(), null);
assertEquals(xares.value(), null);
assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_NOTOK);
assertEquals(xares.topLevelAbort(), TwoPhaseOutcome.FINISH_ERROR);
assertEquals(xares.topLevelCommit(), TwoPhaseOutcome.FINISH_ERROR);
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method test.
@Test
public void test() throws Exception {
XAResourceRecord xares = new XAResourceRecord();
Object obj = new Object();
xares.setValue(obj);
assertTrue(xares.value() != obj);
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(0), new DummyXA(false), new XidImple(new Uid()), params);
assertTrue(xares.type() != null);
xares.merge(xares);
xares.replace(xares);
assertTrue(xares.toString() != null);
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testNested.
@Test
public void testNested() throws Exception {
XAResourceRecord xares = new XAResourceRecord();
assertEquals(xares.nestedOnePhaseCommit(), TwoPhaseOutcome.FINISH_ERROR);
assertEquals(xares.nestedPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(xares.nestedCommit(), TwoPhaseOutcome.FINISH_OK);
assertEquals(xares.nestedAbort(), TwoPhaseOutcome.FINISH_OK);
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testReadonly.
@Test
public void testReadonly() throws Exception {
XAResourceRecord xares;
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(0), new TestResource(true), new XidImple(new Uid()), params);
assertEquals(xares.topLevelCommit(), TwoPhaseOutcome.NOT_PREPARED);
assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
}
use of com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord in project narayana by jbosstm.
the class XAResourceRecordBean method activate.
public boolean activate() {
boolean ok = super.activate();
className = rec.getClass().getName();
if (rec instanceof XAResourceRecord) {
XAResourceRecord xarec = (XAResourceRecord) rec;
eisProductName = xarec.getProductName();
eisProductVersion = xarec.getProductVersion();
jndiName = xarec.getJndiName();
}
if (rec.value() != null) {
XAResource xar = (XAResource) rec.value();
className = xar.getClass().getName();
try {
timeout = xar.getTransactionTimeout();
} catch (Exception e) {
}
}
return ok;
}
Aggregations