diff --git a/core/src/main/java/org/elasticsearch/script/NativeScriptEngineService.java b/core/src/main/java/org/elasticsearch/script/NativeScriptEngineService.java index 4b99b7bd8ff..71154a59441 100644 --- a/core/src/main/java/org/elasticsearch/script/NativeScriptEngineService.java +++ b/core/src/main/java/org/elasticsearch/script/NativeScriptEngineService.java @@ -93,11 +93,6 @@ public class NativeScriptEngineService extends AbstractComponent implements Scri }; } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - return executable(compiledScript, vars).run(); - } - @Override public void close() { } diff --git a/core/src/main/java/org/elasticsearch/script/ScriptEngineService.java b/core/src/main/java/org/elasticsearch/script/ScriptEngineService.java index 0825bf45049..993c95ad797 100644 --- a/core/src/main/java/org/elasticsearch/script/ScriptEngineService.java +++ b/core/src/main/java/org/elasticsearch/script/ScriptEngineService.java @@ -42,8 +42,6 @@ public interface ScriptEngineService extends Closeable { SearchScript search(CompiledScript compiledScript, SearchLookup lookup, @Nullable Map vars); - Object execute(CompiledScript compiledScript, Map vars); - /** * Handler method called when a script is removed from the Guava cache. * diff --git a/core/src/main/java/org/elasticsearch/script/mustache/MustacheScriptEngineService.java b/core/src/main/java/org/elasticsearch/script/mustache/MustacheScriptEngineService.java index 2aae4202fb9..3affd0c5a12 100644 --- a/core/src/main/java/org/elasticsearch/script/mustache/MustacheScriptEngineService.java +++ b/core/src/main/java/org/elasticsearch/script/mustache/MustacheScriptEngineService.java @@ -19,7 +19,6 @@ package org.elasticsearch.script.mustache; import com.github.mustachejava.Mustache; -import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; @@ -34,7 +33,6 @@ import org.elasticsearch.script.ScriptException; import org.elasticsearch.script.SearchScript; import org.elasticsearch.search.lookup.SearchLookup; -import java.io.IOException; import java.lang.ref.SoftReference; import java.util.Collections; import java.util.Map; @@ -88,29 +86,6 @@ public class MustacheScriptEngineService extends AbstractComponent implements Sc return (new JsonEscapingMustacheFactory()).compile(new FastStringReader(template), "query-template"); } - /** - * Execute a compiled template object (as retrieved from the compile method) - * and fill potential place holders with the variables given. - * - * @param template - * compiled template object. - * @param vars - * map of variables to use during substitution. - * - * @return the processed string with all given variables substitued. - * */ - @Override - public Object execute(CompiledScript template, Map vars) { - BytesStreamOutput result = new BytesStreamOutput(); - try (UTF8StreamWriter writer = utf8StreamWriter().setOutput(result)) { - ((Mustache) template.compiled()).execute(writer, vars); - } catch (Exception e) { - logger.error("Error executing " + template, e); - throw new ScriptException("Error executing " + template, e); - } - return result.bytes(); - } - @Override public String[] types() { return new String[] {NAME}; diff --git a/core/src/test/java/org/elasticsearch/script/MockScriptEngine.java b/core/src/test/java/org/elasticsearch/script/MockScriptEngine.java index 0ef84f5e656..1cdac14f3ef 100644 --- a/core/src/test/java/org/elasticsearch/script/MockScriptEngine.java +++ b/core/src/test/java/org/elasticsearch/script/MockScriptEngine.java @@ -103,11 +103,6 @@ public class MockScriptEngine implements ScriptEngineService { }; } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - return null; - } - @Override public void scriptRemoved(@Nullable CompiledScript script) { } diff --git a/core/src/test/java/org/elasticsearch/script/ScriptModesTests.java b/core/src/test/java/org/elasticsearch/script/ScriptModesTests.java index 8a98baa1b16..efda8d25453 100644 --- a/core/src/test/java/org/elasticsearch/script/ScriptModesTests.java +++ b/core/src/test/java/org/elasticsearch/script/ScriptModesTests.java @@ -285,11 +285,6 @@ public class ScriptModesTests extends ESTestCase { return null; } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - return null; - } - @Override public void close() { diff --git a/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java b/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java index ee66752fd3d..26ba5807b2a 100644 --- a/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java +++ b/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java @@ -496,11 +496,6 @@ public class ScriptServiceTests extends ESTestCase { return null; } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - return null; - } - @Override public void close() { diff --git a/core/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTests.java b/core/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTests.java index b44d180221e..28ae80809a1 100644 --- a/core/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTests.java +++ b/core/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTests.java @@ -54,7 +54,7 @@ public class MustacheScriptEngineTests extends ESTestCase { + "\"negative\": {\"term\": {\"body\": {\"value\": \"solr\"}" + "}}, \"negative_boost\": {{boost_val}} } }}"; Map vars = new HashMap<>(); vars.put("boost_val", "0.3"); - BytesReference o = (BytesReference) qe.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "", "mustache", qe.compile(template)), vars); + BytesReference o = (BytesReference) qe.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "", "mustache", qe.compile(template)), vars).run(); assertEquals("GET _search {\"query\": {\"boosting\": {\"positive\": {\"match\": {\"body\": \"gift\"}}," + "\"negative\": {\"term\": {\"body\": {\"value\": \"solr\"}}}, \"negative_boost\": 0.3 } }}", new String(o.toBytes(), Charset.forName("UTF-8"))); @@ -65,7 +65,7 @@ public class MustacheScriptEngineTests extends ESTestCase { Map vars = new HashMap<>(); vars.put("boost_val", "0.3"); vars.put("body_val", "\"quick brown\""); - BytesReference o = (BytesReference) qe.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "", "mustache", qe.compile(template)), vars); + BytesReference o = (BytesReference) qe.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "", "mustache", qe.compile(template)), vars).run(); assertEquals("GET _search {\"query\": {\"boosting\": {\"positive\": {\"match\": {\"body\": \"gift\"}}," + "\"negative\": {\"term\": {\"body\": {\"value\": \"\\\"quick brown\\\"\"}}}, \"negative_boost\": 0.3 } }}", new String(o.toBytes(), Charset.forName("UTF-8"))); diff --git a/plugins/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngineService.java b/plugins/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngineService.java index 44fc0ceabf9..72a1dd7d5c6 100644 --- a/plugins/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngineService.java +++ b/plugins/lang-expression/src/main/java/org/elasticsearch/script/expression/ExpressionScriptEngineService.java @@ -236,12 +236,6 @@ public class ExpressionScriptEngineService extends AbstractComponent implements return new ExpressionExecutableScript(compiledScript, vars); } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - ExpressionExecutableScript expressionExecutableScript = new ExpressionExecutableScript(compiledScript, vars); - return expressionExecutableScript.run(); - } - @Override public void close() {} diff --git a/plugins/lang-groovy/src/main/java/org/elasticsearch/script/groovy/GroovyScriptEngineService.java b/plugins/lang-groovy/src/main/java/org/elasticsearch/script/groovy/GroovyScriptEngineService.java index 3d39fbbb2aa..d1e7160282b 100644 --- a/plugins/lang-groovy/src/main/java/org/elasticsearch/script/groovy/GroovyScriptEngineService.java +++ b/plugins/lang-groovy/src/main/java/org/elasticsearch/script/groovy/GroovyScriptEngineService.java @@ -244,20 +244,6 @@ public class GroovyScriptEngineService extends AbstractComponent implements Scri }; } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - try { - Map allVars = new HashMap<>(); - if (vars != null) { - allVars.putAll(vars); - } - Script scriptObject = createScript(compiledScript.compiled(), allVars); - return scriptObject.run(); - } catch (Exception e) { - throw new ScriptException("failed to execute " + compiledScript, e); - } - } - public static final class GroovyScript implements ExecutableScript, LeafSearchScript { private final CompiledScript compiledScript; diff --git a/plugins/lang-javascript/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java b/plugins/lang-javascript/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java index fd039473ce1..70fc5f46d63 100644 --- a/plugins/lang-javascript/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java +++ b/plugins/lang-javascript/src/main/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineService.java @@ -178,26 +178,6 @@ public class JavaScriptScriptEngineService extends AbstractComponent implements } } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - Context ctx = Context.enter(); - ctx.setWrapFactory(wrapFactory); - try { - Script script = (Script) compiledScript.compiled(); - Scriptable scope = ctx.newObject(globalScope); - scope.setPrototype(globalScope); - scope.setParentScope(null); - - for (Map.Entry entry : vars.entrySet()) { - ScriptableObject.putProperty(scope, entry.getKey(), entry.getValue()); - } - Object ret = script.exec(ctx, scope); - return ScriptValueConverter.unwrapValue(ret); - } finally { - Context.exit(); - } - } - private String generateScriptName() { return "Script" + counter.incrementAndGet() + ".js"; } diff --git a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineTests.java b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineTests.java index 98e95b58111..f0a31810c4c 100644 --- a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineTests.java +++ b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptEngineTests.java @@ -57,7 +57,7 @@ public class JavaScriptScriptEngineTests extends ESTestCase { @Test public void testSimpleEquation() { Map vars = new HashMap(); - Object o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testSimpleEquation", "js", se.compile("1 + 2")), vars); + Object o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testSimpleEquation", "js", se.compile("1 + 2")), vars).run(); assertThat(((Number) o).intValue(), equalTo(3)); } @@ -68,21 +68,21 @@ public class JavaScriptScriptEngineTests extends ESTestCase { Map obj2 = MapBuilder.newMapBuilder().put("prop2", "value2").map(); Map obj1 = MapBuilder.newMapBuilder().put("prop1", "value1").put("obj2", obj2).put("l", Arrays.asList("2", "1")).map(); vars.put("obj1", obj1); - Object o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "js", se.compile("obj1")), vars); + Object o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "js", se.compile("obj1")), vars).run(); assertThat(o, instanceOf(Map.class)); obj1 = (Map) o; assertThat((String) obj1.get("prop1"), equalTo("value1")); assertThat((String) ((Map) obj1.get("obj2")).get("prop2"), equalTo("value2")); - o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "js", se.compile("obj1.l[0]")), vars); + o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "js", se.compile("obj1.l[0]")), vars).run(); assertThat(((String) o), equalTo("2")); } @Test public void testJavaScriptObjectToMap() { Map vars = new HashMap(); - Object o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testJavaScriptObjectToMap", "js", - se.compile("var obj1 = {}; obj1.prop1 = 'value1'; obj1.obj2 = {}; obj1.obj2.prop2 = 'value2'; obj1")), vars); + Object o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testJavaScriptObjectToMap", "js", + se.compile("var obj1 = {}; obj1.prop1 = 'value1'; obj1.obj2 = {}; obj1.obj2.prop2 = 'value2'; obj1")), vars).run(); Map obj1 = (Map) o; assertThat((String) obj1.get("prop1"), equalTo("value1")); assertThat((String) ((Map) obj1.get("obj2")).get("prop2"), equalTo("value2")); @@ -131,22 +131,22 @@ public class JavaScriptScriptEngineTests extends ESTestCase { Map obj1 = MapBuilder.newMapBuilder().put("prop1", "value1").put("obj2", obj2).map(); vars.put("l", Arrays.asList("1", "2", "3", obj1)); - Object o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", - se.compile("l.length")), vars); + Object o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", + se.compile("l.length")), vars).run(); assertThat(((Number) o).intValue(), equalTo(4)); - o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", - se.compile("l[0]")), vars); + o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", + se.compile("l[0]")), vars).run(); assertThat(((String) o), equalTo("1")); - o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", - se.compile("l[3]")), vars); + o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", + se.compile("l[3]")), vars).run(); obj1 = (Map) o; assertThat((String) obj1.get("prop1"), equalTo("value1")); assertThat((String) ((Map) obj1.get("obj2")).get("prop2"), equalTo("value2")); - o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", - se.compile("l[3].prop1")), vars); + o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessInScript", "js", + se.compile("l[3].prop1")), vars).run(); assertThat(((String) o), equalTo("value1")); } diff --git a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTests.java b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTests.java index 1d9090d94b2..b639ed99f6b 100644 --- a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTests.java +++ b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptScriptMultiThreadedTests.java @@ -149,7 +149,7 @@ public class JavaScriptScriptMultiThreadedTests extends ESTestCase { long addition = x + y; runtimeVars.put("x", x); runtimeVars.put("y", y); - long result = ((Number) se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testExecutableNoRuntimeParams", "js", compiled), runtimeVars)).longValue(); + long result = ((Number) se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testExecutableNoRuntimeParams", "js", compiled), runtimeVars).run()).longValue(); assertThat(result, equalTo(addition)); } } catch (Throwable t) { diff --git a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptSecurityTests.java b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptSecurityTests.java index 36636eb0cc4..887317fb744 100644 --- a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptSecurityTests.java +++ b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/JavaScriptSecurityTests.java @@ -50,7 +50,7 @@ public class JavaScriptSecurityTests extends ESTestCase { /** runs a script */ private void doTest(String script) { Map vars = new HashMap(); - se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "test", "js", se.compile(script)), vars); + se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "test", "js", se.compile(script)), vars).run(); } /** asserts that a script runs without exception */ diff --git a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/SimpleBench.java b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/SimpleBench.java index 9cb44ef43e4..bb7eb31c85d 100644 --- a/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/SimpleBench.java +++ b/plugins/lang-javascript/src/test/java/org/elasticsearch/script/javascript/SimpleBench.java @@ -43,14 +43,14 @@ public class SimpleBench { for (int i = 0; i < 1000; i++) { vars.put("x", i); vars.put("y", i + 1); - se.execute(compiledScript, vars); + se.executable(compiledScript, vars).run(); } final long ITER = 100000; StopWatch stopWatch = new StopWatch().start(); for (long i = 0; i < ITER; i++) { - se.execute(compiledScript, vars); + se.executable(compiledScript, vars).run(); } System.out.println("Execute Took: " + stopWatch.stop().lastTaskTime()); diff --git a/plugins/lang-python/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java b/plugins/lang-python/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java index aa7cb825db7..3dfa4bcd0f9 100644 --- a/plugins/lang-python/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java +++ b/plugins/lang-python/src/main/java/org/elasticsearch/script/python/PythonScriptEngineService.java @@ -124,18 +124,6 @@ public class PythonScriptEngineService extends AbstractComponent implements Scri }; } - @Override - public Object execute(CompiledScript compiledScript, Map vars) { - PyObject pyVars = Py.java2py(vars); - interp.setLocals(pyVars); - // eval the script with reduced privileges - PyObject ret = evalRestricted((PyCode) compiledScript.compiled()); - if (ret == null) { - return null; - } - return ret.__tojava__(Object.class); - } - @Override public void close() { interp.cleanup(); diff --git a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptEngineTests.java b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptEngineTests.java index 4badab25a64..979da657c5f 100644 --- a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptEngineTests.java +++ b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptEngineTests.java @@ -59,7 +59,7 @@ public class PythonScriptEngineTests extends ESTestCase { @Test public void testSimpleEquation() { Map vars = new HashMap(); - Object o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testSimpleEquation", "python", se.compile("1 + 2")), vars); + Object o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testSimpleEquation", "python", se.compile("1 + 2")), vars).run(); assertThat(((Number) o).intValue(), equalTo(3)); } @@ -70,13 +70,13 @@ public class PythonScriptEngineTests extends ESTestCase { Map obj2 = MapBuilder.newMapBuilder().put("prop2", "value2").map(); Map obj1 = MapBuilder.newMapBuilder().put("prop1", "value1").put("obj2", obj2).put("l", Arrays.asList("2", "1")).map(); vars.put("obj1", obj1); - Object o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "python", se.compile("obj1")), vars); + Object o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "python", se.compile("obj1")), vars).run(); assertThat(o, instanceOf(Map.class)); obj1 = (Map) o; assertThat((String) obj1.get("prop1"), equalTo("value1")); assertThat((String) ((Map) obj1.get("obj2")).get("prop2"), equalTo("value2")); - o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "python", se.compile("obj1['l'][0]")), vars); + o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testMapAccess", "python", se.compile("obj1['l'][0]")), vars).run(); assertThat(((String) o), equalTo("2")); } @@ -110,15 +110,15 @@ public class PythonScriptEngineTests extends ESTestCase { // Object o = se.execute(se.compile("l.length"), vars); // assertThat(((Number) o).intValue(), equalTo(4)); - Object o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessListInScript", "python", se.compile("l[0]")), vars); + Object o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessListInScript", "python", se.compile("l[0]")), vars).run(); assertThat(((String) o), equalTo("1")); - o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessListInScript", "python", se.compile("l[3]")), vars); + o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessListInScript", "python", se.compile("l[3]")), vars).run(); obj1 = (Map) o; assertThat((String) obj1.get("prop1"), equalTo("value1")); assertThat((String) ((Map) obj1.get("obj2")).get("prop2"), equalTo("value2")); - o = se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessListInScript", "python", se.compile("l[3]['prop1']")), vars); + o = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testAccessListInScript", "python", se.compile("l[3]['prop1']")), vars).run(); assertThat(((String) o), equalTo("value1")); } diff --git a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptMultiThreadedTests.java b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptMultiThreadedTests.java index 6798dab8ef0..81ebf69b62a 100644 --- a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptMultiThreadedTests.java +++ b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonScriptMultiThreadedTests.java @@ -158,7 +158,7 @@ public class PythonScriptMultiThreadedTests extends ESTestCase { long addition = x + y; runtimeVars.put("x", x); runtimeVars.put("y", y); - long result = ((Number) se.execute(compiledScript, runtimeVars)).longValue(); + long result = ((Number) se.executable(compiledScript, runtimeVars).run()).longValue(); assertThat(result, equalTo(addition)); } } catch (Throwable t) { diff --git a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonSecurityTests.java b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonSecurityTests.java index 745a109d5f1..a753ffa2e12 100644 --- a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonSecurityTests.java +++ b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/PythonSecurityTests.java @@ -53,7 +53,7 @@ public class PythonSecurityTests extends ESTestCase { /** runs a script */ private void doTest(String script) { Map vars = new HashMap(); - se.execute(new CompiledScript(ScriptService.ScriptType.INLINE, "test", "python", se.compile(script)), vars); + se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "test", "python", se.compile(script)), vars).run(); } /** asserts that a script runs without exception */ diff --git a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/SimpleBench.java b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/SimpleBench.java index 4fab7dd8fb9..60e792c34b5 100644 --- a/plugins/lang-python/src/test/java/org/elasticsearch/script/python/SimpleBench.java +++ b/plugins/lang-python/src/test/java/org/elasticsearch/script/python/SimpleBench.java @@ -44,14 +44,14 @@ public class SimpleBench { for (int i = 0; i < 1000; i++) { vars.put("x", i); vars.put("y", i + 1); - se.execute(compiledScript, vars); + se.executable(compiledScript, vars).run(); } final long ITER = 100000; StopWatch stopWatch = new StopWatch().start(); for (long i = 0; i < ITER; i++) { - se.execute(compiledScript, vars); + se.executable(compiledScript, vars).run(); } System.out.println("Execute Took: " + stopWatch.stop().lastTaskTime());