/** * Execute the procedure up to "lastStep" and then the ProcedureExecutor * is restarted and an abort() is injected. * If the procedure implement abort() this should result in rollback being triggered. * At the end of this call the procedure should be finished and rolledback. * This method assert on the procedure being terminated with an AbortException. */ public static void testRollbackRetriableFailure( final ProcedureExecutor<MasterProcedureEnv> procExec, final long procId, final int lastStep) throws Exception { // Execute up to last step testRecoveryAndDoubleExecution(procExec, procId, lastStep, false); // execute the rollback testRestartWithAbort(procExec, procId); assertEquals(true, procExec.isRunning()); ProcedureTestingUtility.assertIsAbortException(procExec.getResult(procId)); }
private void testTimeoutEventProcedureDoubleExecution(final boolean killIfSuspended) throws Exception { TestTimeoutEventProcedure proc = new TestTimeoutEventProcedure(1000, 3); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); ProcedureTestingUtility.setKillIfSuspended(procExecutor, killIfSuspended); long procId = procExecutor.submitProcedure(proc); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId, true); ProcedureTestingUtility.assertIsAbortException(procExecutor.getResult(proc.getProcId())); }
/** * Tests being able to suspend a Procedure for N timeouts and then failing.s * Resets the timeout after each elapses. See {@link TestTimeoutEventProcedure} for example * of how to do this sort of trickery with the ProcedureExecutor; i.e. suspend for a while, * check for a condition and if not set, suspend again, etc., ultimately failing or succeeding * eventually. */ @Test public void testTimeoutEventProcedure() throws Exception { final int NTIMEOUTS = 5; TestTimeoutEventProcedure proc = new TestTimeoutEventProcedure(500, NTIMEOUTS); procExecutor.submitProcedure(proc); ProcedureTestingUtility.waitProcedure(procExecutor, proc.getProcId()); ProcedureTestingUtility.assertIsAbortException(procExecutor.getResult(proc.getProcId())); assertEquals(NTIMEOUTS + 1, proc.getTimeoutsCount()); }
ProcedureTestingUtility.assertIsAbortException(procExec.getResult(procId));
ProcedureTestingUtility.assertIsAbortException(result);
ProcedureTestingUtility.assertIsAbortException(result);
/** * Execute the procedure up to "lastStep" and then the ProcedureExecutor * is restarted and an abort() is injected. * If the procedure implement abort() this should result in rollback being triggered. * At the end of this call the procedure should be finished and rolledback. * This method assert on the procedure being terminated with an AbortException. */ public static void testRollbackRetriableFailure( final ProcedureExecutor<MasterProcedureEnv> procExec, final long procId, final int lastStep) throws Exception { // Execute up to last step testRecoveryAndDoubleExecution(procExec, procId, lastStep, false); // execute the rollback testRestartWithAbort(procExec, procId); assertEquals(true, procExec.isRunning()); ProcedureTestingUtility.assertIsAbortException(procExec.getResult(procId)); }
private void testTimeoutEventProcedureDoubleExecution(final boolean killIfSuspended) throws Exception { TestTimeoutEventProcedure proc = new TestTimeoutEventProcedure(1000, 3); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); ProcedureTestingUtility.setKillIfSuspended(procExecutor, killIfSuspended); long procId = procExecutor.submitProcedure(proc); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId, true); ProcedureTestingUtility.assertIsAbortException(procExecutor.getResult(proc.getProcId())); }
private void testTimeoutEventProcedureDoubleExecution(final boolean killIfSuspended) throws Exception { TestTimeoutEventProcedure proc = new TestTimeoutEventProcedure(1000, 3); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); ProcedureTestingUtility.setKillIfSuspended(procExecutor, killIfSuspended); long procId = procExecutor.submitProcedure(proc); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId, true); ProcedureTestingUtility.assertIsAbortException(procExecutor.getResult(proc.getProcId())); }
@Test public void testTimeoutEventProcedure() throws Exception { final int NTIMEOUTS = 5; TestTimeoutEventProcedure proc = new TestTimeoutEventProcedure(500, NTIMEOUTS); procExecutor.submitProcedure(proc); ProcedureTestingUtility.waitProcedure(procExecutor, proc.getProcId()); ProcedureTestingUtility.assertIsAbortException(procExecutor.getResult(proc.getProcId())); assertEquals(NTIMEOUTS + 1, proc.getTimeoutsCount()); }
/** * Tests being able to suspend a Procedure for N timeouts and then failing.s * Resets the timeout after each elapses. See {@link TestTimeoutEventProcedure} for example * of how to do this sort of trickery with the ProcedureExecutor; i.e. suspend for a while, * check for a condition and if not set, suspend again, etc., ultimately failing or succeeding * eventually. */ @Test public void testTimeoutEventProcedure() throws Exception { final int NTIMEOUTS = 5; TestTimeoutEventProcedure proc = new TestTimeoutEventProcedure(500, NTIMEOUTS); procExecutor.submitProcedure(proc); ProcedureTestingUtility.waitProcedure(procExecutor, proc.getProcId()); ProcedureTestingUtility.assertIsAbortException(procExecutor.getResult(proc.getProcId())); assertEquals(NTIMEOUTS + 1, proc.getTimeoutsCount()); }
ProcedureTestingUtility.assertIsAbortException(procExec.getResult(procId));
ProcedureTestingUtility.assertIsAbortException(result);
ProcedureTestingUtility.assertIsAbortException(result);
ProcedureTestingUtility.assertIsAbortException(result);
ProcedureTestingUtility.assertIsAbortException(result);