Ejemplo n.º 1
0
  /**
   * Executes batch but finalizer is failed.
   *
   * @throws Exception if failed
   */
  @Test
  public void executeBatch_failed_finalize() throws Exception {
    ProfileBuilder prf = new ProfileBuilder(folder.getRoot());
    prf.setTracker(FinalizerFailed.class);
    ExecutionTask task = prf.task();
    try {
      task.executeBatch("batch");
      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));

    assertThat(flow(results, "left").size(), is(0));
    assertThat(flow(results, "right").size(), is(0));
    assertThat(flow(results, "last").size(), is(0));
  }
Ejemplo n.º 2
0
 /**
  * Executes batch with simulation mode.
  *
  * @throws Exception if failed
  */
 @Test
 public void executeBatch_sim() throws Exception {
   ProfileBuilder prf = new ProfileBuilder(folder.getRoot());
   prf.setInvalid();
   ExecutionTask task = prf.task();
   task.setRuntimeContext(RuntimeContext.DEFAULT.mode(ExecutionMode.SIMULATION));
   task.executeBatch("batch");
 }
Ejemplo n.º 3
0
  /**
   * Executes batch.
   *
   * @throws Exception if failed
   */
  @Test
  public void executeBatch() throws Exception {
    ProfileBuilder prf = new ProfileBuilder(folder.getRoot());
    ExecutionTask task = prf.task();
    task.executeBatch("batch");

    List<Record> results = SerialExecutionTracker.get(prf.trackingId);
    checkFlowHappensBefore(results, "testing", "left");
    checkFlowHappensBefore(results, "testing", "right");
    checkFlowHappensBefore(results, "left", "last");
    checkFlowHappensBefore(results, "right", "last");
    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(2));
    assertThat(phase(results, "testing", ExecutionPhase.CLEANUP).size(), is(2));

    assertThat(phase(results, "left", ExecutionPhase.SETUP).size(), is(2));
    assertThat(phase(results, "left", ExecutionPhase.INITIALIZE).size(), is(0));
    assertThat(phase(results, "left", ExecutionPhase.IMPORT).size(), is(0));
    assertThat(phase(results, "left", ExecutionPhase.PROLOGUE).size(), is(0));
    assertThat(phase(results, "left", ExecutionPhase.MAIN).size(), is(1));
    assertThat(phase(results, "left", ExecutionPhase.EPILOGUE).size(), is(0));
    assertThat(phase(results, "left", ExecutionPhase.EXPORT).size(), is(0));
    assertThat(phase(results, "left", ExecutionPhase.FINALIZE).size(), is(0));
    assertThat(phase(results, "left", ExecutionPhase.CLEANUP).size(), is(2));

    assertThat(phase(results, "right", ExecutionPhase.SETUP).size(), is(2));
    assertThat(phase(results, "right", ExecutionPhase.INITIALIZE).size(), is(0));
    assertThat(phase(results, "right", ExecutionPhase.IMPORT).size(), is(0));
    assertThat(phase(results, "right", ExecutionPhase.PROLOGUE).size(), is(0));
    assertThat(phase(results, "right", ExecutionPhase.MAIN).size(), is(1));
    assertThat(phase(results, "right", ExecutionPhase.EPILOGUE).size(), is(0));
    assertThat(phase(results, "right", ExecutionPhase.EXPORT).size(), is(0));
    assertThat(phase(results, "right", ExecutionPhase.FINALIZE).size(), is(0));
    assertThat(phase(results, "right", ExecutionPhase.CLEANUP).size(), is(2));

    assertThat(phase(results, "last", ExecutionPhase.SETUP).size(), is(2));
    assertThat(phase(results, "last", ExecutionPhase.INITIALIZE).size(), is(0));
    assertThat(phase(results, "last", ExecutionPhase.IMPORT).size(), is(0));
    assertThat(phase(results, "last", ExecutionPhase.PROLOGUE).size(), is(0));
    assertThat(phase(results, "last", ExecutionPhase.MAIN).size(), is(1));
    assertThat(phase(results, "last", ExecutionPhase.EPILOGUE).size(), is(0));
    assertThat(phase(results, "last", ExecutionPhase.EXPORT).size(), is(0));
    assertThat(phase(results, "last", ExecutionPhase.FINALIZE).size(), is(0));
    assertThat(phase(results, "last", ExecutionPhase.CLEANUP).size(), is(2));
  }
Ejemplo n.º 4
0
  /**
   * Executes batch but some flows are skipped.
   *
   * @throws Exception if failed
   */
  @Test
  public void executeBatch_seriaize() throws Exception {
    ProfileBuilder prf = new ProfileBuilder(folder.getRoot());
    prf.setTracker(FlowSerialized.class);
    ExecutionTask task = prf.task();
    task.setSerializeFlows(true);
    task.executeBatch("batch");

    List<Record> results = SerialExecutionTracker.get(prf.trackingId);
    checkFlowHappensBefore(results, "testing", "left");
    checkFlowHappensBefore(results, "testing", "right");
    checkFlowHappensBefore(results, "left", "last");
    checkFlowHappensBefore(results, "right", "last");
    verifyPhaseOrder(results);
  }