/** * Executes flow but finalizer is failed. * * @throws Exception if failed */ @Test public void executeFlow_failed_finalize() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); prf.setTracker(FinalizerFailed.class); ExecutionTask task = prf.task(); try { task.executeFlow("batch", "testing", "flow"); fail(); } catch (IOException e) { // ok. } List<Record> results = SerialExecutionTracker.get(prf.trackingId); verifyPhaseOrder(results); assertThat(phase(results, "testing", ExecutionPhase.SETUP).size(), is(2)); assertThat(phase(results, "testing", ExecutionPhase.INITIALIZE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.IMPORT).size(), is(2)); assertThat(phase(results, "testing", ExecutionPhase.PROLOGUE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.MAIN).size(), is(4)); assertThat(phase(results, "testing", ExecutionPhase.EPILOGUE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.EXPORT).size(), is(2)); assertThat(phase(results, "testing", ExecutionPhase.FINALIZE).size(), is(1)); assertThat(phase(results, "testing", ExecutionPhase.CLEANUP).size(), is(0)); }
/** * Executes flow in simulation mode. * * @throws Exception if failed */ @Test public void executeFlow_sim() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); prf.setInvalid(); ExecutionTask task = prf.task(); task.setRuntimeContext(RuntimeContext.DEFAULT.mode(ExecutionMode.SIMULATION)); task.executeFlow("batch", "testing", "flow"); }
/** * Executes flow but is skipped. * * @throws Exception if failed */ @Test public void executeFlow_skip() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); ExecutionTask task = prf.task(); task.getSkipFlows().add("testing"); task.executeFlow("batch", "testing", "flow"); List<Record> results = SerialExecutionTracker.get(prf.trackingId); assertThat(results, is(Collections.<Record>emptyList())); }