public static <TEnv> void testRecoveryAndDoubleExecution(final ProcedureExecutor<TEnv> procExec, final long procId, final boolean expectFailure) throws Exception { testRecoveryAndDoubleExecution(procExec, procId, expectFailure, null); }
/** * Run through all procedure flow states TWICE while also restarting * procedure executor at each step; i.e force a reread of procedure store. * *<p>It does * <ol><li>Execute step N - kill the executor before store update * <li>Restart executor/store * <li>Execute step N - and then save to store * </ol> * *<p>This is a good test for finding state that needs persisting and steps that are not * idempotent. */ public static <TEnv> void testRecoveryAndDoubleExecution(final ProcedureExecutor<TEnv> procExec, final long procId) throws Exception { testRecoveryAndDoubleExecution(procExec, procId, false); }
@Test public void testChildOnLastStepDoubleExecution() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); long procId = procExecutor.submitProcedure(new TestSMProcedure()); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId); assertEquals(6, procExecutor.getEnvironment().execCount.get()); assertEquals(0, procExecutor.getEnvironment().rollbackCount.get()); ProcedureTestingUtility.assertProcNotFailed(procExecutor, procId); }
@Test public void testChildOnLastStepWithRollbackDoubleExecution() throws Exception { procExecutor.getEnvironment().triggerChildRollback = true; ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); long procId = procExecutor.submitProcedure(new TestSMProcedure()); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId, true); assertEquals(6, procExecutor.getEnvironment().execCount.get()); assertEquals(6, procExecutor.getEnvironment().rollbackCount.get()); Throwable cause = ProcedureTestingUtility.assertProcFailed(procExecutor, procId); assertEquals(TEST_FAILURE_EXCEPTION, cause); }
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())); }
public static <TEnv> void testRecoveryAndDoubleExecution(final ProcedureExecutor<TEnv> procExec, final long procId, final boolean expectFailure) throws Exception { testRecoveryAndDoubleExecution(procExec, procId, expectFailure, null); }
public static <TEnv> void testRecoveryAndDoubleExecution(final ProcedureExecutor<TEnv> procExec, final long procId, final boolean expectFailure) throws Exception { testRecoveryAndDoubleExecution(procExec, procId, expectFailure, null); }
/** * Run through all procedure flow states TWICE while also restarting * procedure executor at each step; i.e force a reread of procedure store. * *<p>It does * <ol><li>Execute step N - kill the executor before store update * <li>Restart executor/store * <li>Execute step N - and then save to store * </ol> * *<p>This is a good test for finding state that needs persisting and steps that are not * idempotent. */ public static <TEnv> void testRecoveryAndDoubleExecution(final ProcedureExecutor<TEnv> procExec, final long procId) throws Exception { testRecoveryAndDoubleExecution(procExec, procId, false); }
/** * Run through all procedure flow states TWICE while also restarting * procedure executor at each step; i.e force a reread of procedure store. * *<p>It does * <ol><li>Execute step N - kill the executor before store update * <li>Restart executor/store * <li>Execute step N - and then save to store * </ol> * *<p>This is a good test for finding state that needs persisting and steps that are not * idempotent. */ public static <TEnv> void testRecoveryAndDoubleExecution(final ProcedureExecutor<TEnv> procExec, final long procId) throws Exception { testRecoveryAndDoubleExecution(procExec, procId, false); }
@Test public void testChildOnLastStepDoubleExecution() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); long procId = procExecutor.submitProcedure(new TestSMProcedure()); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId); assertEquals(6, procExecutor.getEnvironment().execCount.get()); assertEquals(0, procExecutor.getEnvironment().rollbackCount.get()); ProcedureTestingUtility.assertProcNotFailed(procExecutor, procId); }
@Test public void testChildOnLastStepDoubleExecution() throws Exception { ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); long procId = procExecutor.submitProcedure(new TestSMProcedure()); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId); assertEquals(6, procExecutor.getEnvironment().execCount.get()); assertEquals(0, procExecutor.getEnvironment().rollbackCount.get()); ProcedureTestingUtility.assertProcNotFailed(procExecutor, procId); }
@Test public void testChildOnLastStepWithRollbackDoubleExecution() throws Exception { procExecutor.getEnvironment().triggerChildRollback = true; ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); long procId = procExecutor.submitProcedure(new TestSMProcedure()); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId, true); assertEquals(6, procExecutor.getEnvironment().execCount.get()); assertEquals(6, procExecutor.getEnvironment().rollbackCount.get()); Throwable cause = ProcedureTestingUtility.assertProcFailed(procExecutor, procId); assertEquals(TEST_FAILURE_EXCEPTION, cause); }
@Test public void testChildOnLastStepWithRollbackDoubleExecution() throws Exception { procExecutor.getEnvironment().triggerChildRollback = true; ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExecutor, true); long procId = procExecutor.submitProcedure(new TestSMProcedure()); ProcedureTestingUtility.testRecoveryAndDoubleExecution(procExecutor, procId, true); assertEquals(6, procExecutor.getEnvironment().execCount.get()); assertEquals(6, procExecutor.getEnvironment().rollbackCount.get()); Throwable cause = ProcedureTestingUtility.assertProcFailed(procExecutor, procId); assertEquals(TEST_FAILURE_EXCEPTION, cause); }
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())); }