use of com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery in project narayana by jbosstm.
the class ImportNonUniqueBranchTest method beforeClass.
@BeforeClass
public static void beforeClass() {
RecoveryEnvironmentBean environmentBean = BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class);
List<String> moduleNames = new ArrayList<>();
moduleNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateAtomicActionRecoveryModule");
moduleNames.add("com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule");
environmentBean.setRecoveryModuleClassNames(moduleNames);
environmentBean.setRecoveryBackoffPeriod(1);
BeanPopulator.getDefaultInstance(JTAEnvironmentBean.class).setXAResourceRecordWrappingPlugin(new XAResourceRecordWrappingPluginImpl());
periodicRecovery = new PeriodicRecovery(false, false);
for (RecoveryModule recoveryModule : periodicRecovery.getModules()) {
if (recoveryModule instanceof XARecoveryModule) {
xaRecoveryModule = (XARecoveryModule) recoveryModule;
break;
}
}
}
use of com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery in project narayana by jbosstm.
the class PeriodicRecoveryTest method testInitialDelay.
@Test
public void testInitialDelay() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
RecoveryEnvironmentBean bean = recoveryPropertyManager.getRecoveryEnvironmentBean().setPeriodicRecoveryInitilizationOffset(1);
PeriodicRecovery periodicRecovery = new PeriodicRecovery(false, false);
Method doInitialWait = periodicRecovery.getClass().getDeclaredMethod("doInitialWait");
doInitialWait.setAccessible(true);
long l = System.currentTimeMillis();
try {
doInitialWait.invoke(periodicRecovery, null);
} finally {
doInitialWait.setAccessible(false);
}
assertTrue(System.currentTimeMillis() - l > 500);
}
Aggregations