use of com.arjuna.ats.arjuna.recovery.RecoveryModule in project narayana by jbosstm.
the class TestJDBCStoreOffline method test.
@Test
public void test() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, SecurityException, HeuristicMixedException, HeuristicRollbackException, NamingException {
arjPropertyManager.getObjectStoreEnvironmentBean().setObjectStoreType(JDBCStore.class.getName());
arjPropertyManager.getObjectStoreEnvironmentBean().setJdbcAccess(TestJDBCAccess.class.getName());
javax.transaction.TransactionManager tm = TransactionManager.transactionManager();
tm.begin();
tm.getTransaction().enlistResource(new DummyXAResource());
tm.getTransaction().enlistResource(new DummyXAResource());
tm.commit();
assertTrue(commitCount == 1);
FAULT_JDBC = true;
jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(Arrays.asList(new String[] { "1" }));
jtaPropertyManager.getJTAEnvironmentBean().setXaResourceOrphanFilters(Arrays.asList(new XAResourceOrphanFilter[] { new com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter(), new com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter() }));
jtaPropertyManager.getJTAEnvironmentBean().setXaResourceRecoveries(Arrays.asList(new XAResourceRecovery[] { new DummyXAResourceRecovery() }));
jtaPropertyManager.getJTAEnvironmentBean().setOrphanSafetyInterval(1);
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryBackoffPeriod(2);
recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryModules(Arrays.asList(new RecoveryModule[] { new XARecoveryModule() }));
RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT);
manager.scan();
assertFalse(rollbackCalled);
}
use of com.arjuna.ats.arjuna.recovery.RecoveryModule 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