use of com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection 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.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection 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.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection 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);
}
Aggregations