@Test(timeout = 60000) public void testRecoveryAndDoubleExecution() throws Exception { final NamespaceDescriptor nsd = NamespaceDescriptor.create("testRecoveryAndDoubleExecution").build(); final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor(); ProcedureTestingUtility.waitNoProcedureRunning(procExec); ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true); // Start the CreateNamespace procedure && kill the executor long procId = procExec.submitProcedure(new CreateNamespaceProcedure(procExec.getEnvironment(), nsd)); // Restart the executor and execute the step twice int numberOfSteps = CreateNamespaceState.values().length; MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId, numberOfSteps); // Validate the creation of namespace ProcedureTestingUtility.assertProcNotFailed(procExec, procId); validateNamespaceCreated(nsd); }
@Override protected int getStateId(final CreateNamespaceState state) { return state.getNumber(); }
@Override protected CreateNamespaceState getState(final int stateId) { return CreateNamespaceState.valueOf(stateId); }