/** * Execute phase as simulation mode. * * @throws Exception if failed */ @Test public void phase_sim() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); prf.setInvalid(); ExecutionTask task = prf.task(); task.setRuntimeContext(RuntimeContext.DEFAULT.mode(ExecutionMode.SIMULATION)); task.executePhase("batch", "testing", "f1", ExecutionPhase.MAIN); }
/** * Execute phase but will be skipped. * * @throws Exception if failed */ @Test public void phase_sskip() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); ExecutionTask task = prf.task(); task.getSkipFlows().add("testing"); task.executePhase("batch", "testing", "f-setup", ExecutionPhase.SETUP); List<Record> results = SerialExecutionTracker.get(prf.trackingId); assertThat(results, is(Collections.<Record>emptyList())); }
/** * Execute setup phase. * * @throws Exception if failed */ @Test public void phase_setup() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); ExecutionTask task = prf.task(); task.executePhase("batch", "testing", "f-setup", ExecutionPhase.SETUP); List<Record> results = SerialExecutionTracker.get(prf.trackingId); verifyPhaseOrder(results); assertThat(results.size(), is(2)); List<Record> records = phase(results, "testing", ExecutionPhase.SETUP); assertThat(records, is(results)); }
/** * Execute main phase. * * @throws Exception if failed */ @Test public void phase_main() throws Exception { ProfileBuilder prf = new ProfileBuilder(folder.getRoot()); ExecutionTask task = prf.task(); task.executePhase("batch", "testing", "f1", ExecutionPhase.MAIN); List<Record> results = SerialExecutionTracker.get(prf.trackingId); verifyPhaseOrder(results); assertThat(results.size(), is(4)); assertThat(id(results), is(set("a", "b", "c", "d"))); checkScriptHappensBefore(results, "a", "b"); checkScriptHappensBefore(results, "a", "c"); checkScriptHappensBefore(results, "b", "d"); checkScriptHappensBefore(results, "c", "d"); List<Record> records = phase(results, "testing", ExecutionPhase.MAIN); assertThat(records, is(results)); }