Class ExecuteTaskHelper

Object
ExecuteTaskHelper

public class ExecuteTaskHelper extends Object
Executes a task on a single-input outputting into a specific directory.
Author:
Owen Feehan
  • Constructor Details

    • ExecuteTaskHelper

      public ExecuteTaskHelper()
      Create so that all outputs occur, and with default TaskArguments.
    • ExecuteTaskHelper

      public ExecuteTaskHelper(boolean copyNonIdentical)
      Create so that all outputs occur, and with default TaskArguments.
      Parameters:
      copyNonIdentical - when true, and two files are not identical, the version in the output directory is copied into the resources directory.
    • ExecuteTaskHelper

      public ExecuteTaskHelper(Optional<String> specificOutput, TaskArguments taskArguments, boolean copyNonIdentical)
      Create with specific arguments, not necessarily the defaults.
      Parameters:
      specificOutput - when defined, only this outputs are permitted to occur. Otherwise, all outputs occur as per defaults in the task.
      taskArguments - the arguments to use when executing the task.
      copyNonIdentical - when true, and two files are not identical, the version in the output directory is copied into the resources directory.
  • Method Details

    • assertExpectedTaskOutputs

      public <T extends InputFromManager, S, V extends Task<T, S>> void assertExpectedTaskOutputs(T input, V task, Path pathDirectoryOutput, String pathDirectorySaved, Iterable<String> pathsFileToCompare) throws OperationFailedException
      Executes a task on a single-input.

      Expected outputs exist in a resources directory, and the produced outputs are compared against them, to check that they are identical.

      Type Parameters:
      T - input type
      S - shared-state type
      V - task type
      Parameters:
      input - the input for the task.
      task - the task to run.
      pathDirectoryOutput - an absolute path to a directory where outputs of the task will be placed.
      pathDirectorySaved - a path (relative to the src/test/resources) to a directory of saved-results to compare with.
      pathsFileToCompare - paths (relative to the src/test/resources) to check that are identical.
      Throws:
      OperationFailedException - if anything goes wrong.
    • assertExpectedTaskOutputs

      public <T extends InputFromManager, S, V extends Task<T, S>> void assertExpectedTaskOutputs(List<T> inputs, V task, Path pathDirectoryOutput, String pathDirectorySaved, Iterable<String> pathsFileToCompare) throws OperationFailedException
      Executes a task on a multiple inputs and asserts expected outputs - with task arguments.

      Expected outputs exist in a resources directory, and the produced outputs are compared against them, to check that they are identical.

      Type Parameters:
      T - input type
      S - shared-state type
      V - task type
      Parameters:
      inputs - the inputs for the task.
      task - the task to run.
      pathDirectoryOutput - an absolute path to a directory where outputs of the task will be placed.
      pathDirectorySaved - a path (relative to the src/test/resources) to a directory of saved-results to compare with.
      pathsFileToCompare - paths (relative to the src/test/resources) to check that are identical.
      Throws:
      OperationFailedException - if anything goes wrong.