Package org.apache.drill.exec.testing
Class NoOpControlsInjector
java.lang.Object
org.apache.drill.exec.testing.NoOpControlsInjector
- All Implemented Interfaces:
ControlsInjector
An injector that does not inject any controls, useful when not testing (i.e. assertions are not enabled).
See
ControlsInjector
for documentation.-
Field Summary
Modifier and TypeFieldDescriptionstatic final CountDownLatchInjection
When assertions are not enabled, this count down latch that does nothing is injected. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetLatch
(ExecutionControls executionControls, String desc) Used to insert a latch in site class.Class<?>
Get the injector's owning class.<T extends Throwable>
voidinjectChecked
(ExecutionControls executionControls, String desc, Class<T> exceptionClass) Inject (throw) a checked exception at this point, if an injection is specified, and it is time for it to be thrown.void
injectInterruptiblePause
(ExecutionControls executionControls, String desc, org.slf4j.Logger logger) Insert a pause that can be interrupted usingThread.interrupt()
at the given site point, if such an injection is specified (i.e.void
injectPause
(ExecutionControls executionControls, String desc, org.slf4j.Logger logger) Pauses at this point, if such an injection is specified (i.e.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.
-
Field Details
-
LATCH
When assertions are not enabled, this count down latch that does nothing is injected.
-
-
Constructor Details
-
NoOpControlsInjector
Constructor. Classes should use the staticControlsInjectorFactory.getInjector(java.lang.Class<?>)
method to obtain their injector.- Parameters:
clazz
- the owning class
-
-
Method Details
-
getSiteClass
Description copied from interface:ControlsInjector
Get the injector's owning class.- Specified by:
getSiteClass
in interfaceControlsInjector
- Returns:
- the injector's owning class
-
injectUnchecked
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 interfaceControlsInjector
- Parameters:
executionControls
- the controls in the current contextdesc
- 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 interfaceControlsInjector
- Parameters:
executionControls
- the controls in the current contextdesc
- the site descriptorexceptionClass
- 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
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 interfaceControlsInjector
- Parameters:
executionControls
- the controls in the current contextdesc
- the site descriptorlogger
- 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 usingThread.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 interfaceControlsInjector
- Parameters:
executionControls
- the controls in the current contextdesc
- the site descriptorlogger
- logger of the class containing the injection site- Throws:
InterruptedException
- if interrupted usingThread.interrupt()
-
getLatch
Description copied from interface:ControlsInjector
Used to insert a latch in site class. SeeCountDownLatchInjection
andorg.apache.drill.exec.testing.TestCountDownLatchInjection
for usage.- Specified by:
getLatch
in interfaceControlsInjector
- Parameters:
executionControls
- the controls in the current contextdesc
- the site descriptor
-