use of com.hp.mwtests.ts.jta.jts.common.DummyXA 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.hp.mwtests.ts.jta.jts.common.DummyXA in project narayana by jbosstm.
the class TransactionImpleUnitTest method test.
@Test
public void test() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
TransactionImple tx = new TransactionImple();
DummyXA res = new DummyXA(false);
tx.enlistResource(res);
tx.delistResource(res, XAResource.TMSUSPEND);
assertTrue(tx.getResources() != null);
assertTrue(tx.getTimeout() != -1);
tx.commit();
assertTrue(TransactionImple.getTransactions() != null);
assertEquals(TransactionImple.getTransactions().size(), 0);
try {
tx = (TransactionImple) TransactionManager.transactionManager(new InitialContext());
fail();
} catch (final Throwable ex) {
}
}
use of com.hp.mwtests.ts.jta.jts.common.DummyXA 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.hp.mwtests.ts.jta.jts.common.DummyXA in project narayana by jbosstm.
the class XARecoveryResourceManagerUnitTest method test.
@Test
public void test() {
XARecoveryResourceManagerImple man = new XARecoveryResourceManagerImple();
assertTrue(man.getResource(new Uid()) != null);
assertTrue(man.getResource(new Uid(), new DummyXA(false)) != null);
}
use of com.hp.mwtests.ts.jta.jts.common.DummyXA in project narayana by jbosstm.
the class ResourceManagerFailureUnitTest method test.
@Test
public void test() throws Exception {
transactionManager.begin();
transactionManager.getTransaction().enlistResource(new DummyXA(true));
transactionManager.getTransaction().enlistResource(new DummyXARMFail(true));
transactionManager.commit();
final int uidsCountBeforeRecovery = getUidsCount();
final RecoveryModule recoveryModule = recoveryManager.getModules().get(0);
recoveryModule.periodicWorkFirstPass();
recoveryModule.periodicWorkSecondPass();
Assert.assertEquals(uidsCountBeforeRecovery - 1, getUidsCount());
}
Aggregations