Class NoOpControlsInjector

java.lang.Object
org.apache.drill.exec.testing.NoOpControlsInjector
All Implemented Interfaces:
ControlsInjector

public final class NoOpControlsInjector extends Object implements ControlsInjector
An injector that does not inject any controls, useful when not testing (i.e. assertions are not enabled). See ControlsInjector for documentation.
  • Field Details

    • LATCH

      public static final CountDownLatchInjection LATCH
      When assertions are not enabled, this count down latch that does nothing is injected.
  • Constructor Details

  • Method Details

    • getSiteClass

      public Class<?> getSiteClass()
      Description copied from interface: ControlsInjector
      Get the injector's owning class.
      Specified by:
      getSiteClass in interface ControlsInjector
      Returns:
      the injector's owning class
    • injectUnchecked

      public void injectUnchecked(ExecutionControls executionControls, String desc)
      Description copied from interface: ControlsInjector
      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.

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

      public <T extends Throwable> void injectChecked(ExecutionControls executionControls, String desc, Class<T> exceptionClass) throws T
      Description copied from interface: ControlsInjector
      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.

      Specified by:
      injectChecked in interface ControlsInjector
      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

      public void injectPause(ExecutionControls executionControls, String desc, org.slf4j.Logger logger)
      Description copied from interface: ControlsInjector
      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.

      Specified by:
      injectPause in interface ControlsInjector
      Parameters:
      executionControls - the controls in the current context
      desc - the site descriptor
      logger - logger of the class containing the injection site
    • injectInterruptiblePause

      public void injectInterruptiblePause(ExecutionControls executionControls, String desc, org.slf4j.Logger logger) throws InterruptedException
      Description copied from interface: ControlsInjector
      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.

      Specified by:
      injectInterruptiblePause in interface ControlsInjector
      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

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