Search in sources :

Example 1 with XAResourceRecovery

use of com.arjuna.ats.jta.recovery.XAResourceRecovery 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);
}
Also used : XAResourceRecovery(com.arjuna.ats.jta.recovery.XAResourceRecovery) RecoveryManager(com.arjuna.ats.arjuna.recovery.RecoveryManager) JDBCStore(com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore) XARecoveryModule(com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule) RecoveryModule(com.arjuna.ats.arjuna.recovery.RecoveryModule) XAResourceOrphanFilter(com.arjuna.ats.jta.recovery.XAResourceOrphanFilter) XARecoveryModule(com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule) Test(org.junit.Test)

Aggregations

RecoveryManager (com.arjuna.ats.arjuna.recovery.RecoveryManager)1 RecoveryModule (com.arjuna.ats.arjuna.recovery.RecoveryModule)1 JDBCStore (com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore)1 XARecoveryModule (com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule)1 XAResourceOrphanFilter (com.arjuna.ats.jta.recovery.XAResourceOrphanFilter)1 XAResourceRecovery (com.arjuna.ats.jta.recovery.XAResourceRecovery)1 Test (org.junit.Test)1