aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/java/org/apache/drill/exec/testing
diff options
context:
space:
mode:
authoradeneche <adeneche@gmail.com>2015-05-13 09:45:23 -0700
committerJacques Nadeau <jacques@apache.org>2015-05-13 19:36:30 -0700
commit583ca4a95df2c45b5ba20b517cb1aeed48c7548e (patch)
tree666ab6cc3e178986444873e6637e5731c190be69 /exec/java-exec/src/main/java/org/apache/drill/exec/testing
parentf63dac9dc9d65624712932fe0527726626d304cc (diff)
DRILL-3053: add unchecked exception injection site in ChildAllocator
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/testing')
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControlsInjector.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControlsInjector.java b/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControlsInjector.java
index 387d300ce..e3a4ba6f0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControlsInjector.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/testing/ExecutionControlsInjector.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.testing;
+import org.apache.drill.exec.ops.FragmentContext;
import org.apache.drill.exec.util.AssertionUtil;
import org.slf4j.Logger;
@@ -83,6 +84,23 @@ public class ExecutionControlsInjector {
}
/**
+ * Inject (throw) an unchecked exception at this point, if the fragmentContext is not null,
+ * an injection is specified, and it is time for it to be thrown.
+ * <p/>
+ * <p>Implementors use this in their code at a site where they want to simulate an exception
+ * during testing.
+ *
+ * @param fragmentContext fragmentContext used to retrieve the controls, can be null
+ * @param desc the site description
+ * throws the exception specified by the injection, if it is time
+ */
+ public void injectUnchecked(final FragmentContext fragmentContext, final String desc) {
+ if (fragmentContext != null) {
+ injectUnchecked(fragmentContext.getExecutionControls(), desc);
+ }
+ }
+
+ /**
* Inject (throw) a checked exception at this point, if an injection is specified, and it is time
* for it to be thrown.
* <p/>