Package org.elasticsearch.script
Class MockScriptEngine
java.lang.Object
org.elasticsearch.script.MockScriptEngine
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.elasticsearch.script.ScriptEngine
A mocked script engine that can be used for testing purpose.
This script engine allows to define a set of predefined scripts that basically a combination of a key and a
function:
The key can be anything as long as it is a
String
and is used to resolve the scripts
at compilation time. For inline scripts, the key can be a description of the script. For stored and file scripts,
the source must match a key in the predefined set of scripts.
The function is used to provide the result of the script execution and can return anything.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A non-typed compiler for a single custom contextclass
static class
static class
static class
static class
static class
static class
static class
static class
static class
class
class
class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMockScriptEngine
(String type, Map<String, Function<Map<String, Object>, Object>> deterministicScripts, Map<String, Function<Map<String, Object>, Object>> nonDeterministicScripts, Map<org.elasticsearch.script.ScriptContext<?>, MockScriptEngine.ContextCompiler> contexts) MockScriptEngine
(String type, Map<String, Function<Map<String, Object>, Object>> scripts, Map<org.elasticsearch.script.ScriptContext<?>, MockScriptEngine.ContextCompiler> contexts) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.script.ScriptEngine
close
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
MockScriptEngine
-
MockScriptEngine
-
MockScriptEngine
public MockScriptEngine()
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceorg.elasticsearch.script.ScriptEngine
-
compile
public <T> T compile(String name, String source, org.elasticsearch.script.ScriptContext<T> context, Map<String, String> params) - Specified by:
compile
in interfaceorg.elasticsearch.script.ScriptEngine
-
getSupportedContexts
- Specified by:
getSupportedContexts
in interfaceorg.elasticsearch.script.ScriptEngine
-
mockInlineScript
-