Interface ControlsInjector

All Known Implementing Classes:
ExecutionControlsInjector, NoOpControlsInjector

public interface ControlsInjector
  • Method Details

    • getSiteClass

      Class<?> getSiteClass()
      Get the injector's owning class.
      Returns:
      the injector's owning class
    • injectUnchecked

      void injectUnchecked(ExecutionControls executionControls, String desc)
      Inject (throw) an unchecked exception at this point, if an injection is specified, and it is time for it to be thrown.

      Implementors use this in their code at a site where they want to simulate an exception during testing.

      Parameters:
      executionControls - the controls in the current context
      desc - the site descriptor throws the exception specified by the injection, if it is time
    • injectChecked

      <T extends Throwable> void injectChecked(ExecutionControls executionControls, String desc, Class<T> exceptionClass) throws T
      Inject (throw) a checked exception at this point, if an injection is specified, and it is time for it to be thrown.

      Implementors use this in their code at a site where they want to simulate an exception during testing.

      Parameters:
      executionControls - the controls in the current context
      desc - the site descriptor
      exceptionClass - the expected class of the exception (or a super class of it)
      Throws:
      T - the exception specified by the injection, if it is time
    • injectPause

      void injectPause(ExecutionControls executionControls, String desc, org.slf4j.Logger logger)
      Pauses at this point, if such an injection is specified (i.e. matches the site description).

      Implementors use this in their code at a site where they want to simulate a pause during testing.

      Parameters:
      executionControls - the controls in the current context
      desc - the site descriptor
      logger - logger of the class containing the injection site
    • injectInterruptiblePause

      void injectInterruptiblePause(ExecutionControls executionControls, String desc, org.slf4j.Logger logger) throws InterruptedException
      Insert a pause that can be interrupted using Thread.interrupt() at the given site point, if such an injection is specified (i.e. matches the site description).

      Implementors use this in their code at a site where they want to simulate a interruptible pause during testing.

      Parameters:
      executionControls - the controls in the current context
      desc - the site descriptor
      logger - logger of the class containing the injection site
      Throws:
      InterruptedException - if interrupted using Thread.interrupt()
    • getLatch

      CountDownLatchInjection getLatch(ExecutionControls executionControls, String desc)
      Used to insert a latch in site class. See CountDownLatchInjection and org.apache.drill.exec.testing.TestCountDownLatchInjection for usage.
      Parameters:
      executionControls - the controls in the current context
      desc - the site descriptor