diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/MessyTestUtils.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/MessyTestUtils.java index 05330ac5ad0..c4bbc2186b9 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/MessyTestUtils.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/MessyTestUtils.java @@ -42,7 +42,7 @@ public final class MessyTestUtils { engineServiceSet.add(groovyScriptEngineService); ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry( Arrays.asList( - new ScriptEngineRegistry.ScriptEngineRegistration(GroovyScriptEngineService.class, GroovyScriptEngineService.TYPES) + new ScriptEngineRegistry.ScriptEngineRegistration(GroovyScriptEngineService.class, GroovyScriptEngineService.NAME) ) ); ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Arrays.asList(ScriptServiceProxy.INSTANCE)); diff --git a/elasticsearch/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateTests.java b/elasticsearch/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateTests.java index 8665dd318a3..efe00900d07 100644 --- a/elasticsearch/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateTests.java +++ b/elasticsearch/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateTests.java @@ -56,7 +56,7 @@ public class WatcherTemplateTests extends ESTestCase { ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry( Arrays.asList( new ScriptEngineRegistry.ScriptEngineRegistration(MustacheScriptEngineService.class, - MustacheScriptEngineService.TYPES) + MustacheScriptEngineService.NAME) ) ); ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry); diff --git a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java index 33a7ae27cb1..8f5baa4ae33 100644 --- a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java +++ b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java @@ -107,11 +107,11 @@ public class ShieldServerTransportService extends TransportService { @Override public void registerRequestHandler(String action, Supplier request, String executor, - boolean forceExecution, + boolean forceExecution, boolean canTripCircuitBreaker, TransportRequestHandler handler) { TransportRequestHandler wrappedHandler = new ProfileSecuredRequestHandler<>(action, handler, profileFilters, licenseState, threadPool.getThreadContext()); - super.registerRequestHandler(action, request, executor, forceExecution, wrappedHandler); + super.registerRequestHandler(action, request, executor, forceExecution, canTripCircuitBreaker, wrappedHandler); } protected Map initializeProfileFilters() { diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java index c0d1c7bce39..bd9cb51019d 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.script; +import org.elasticsearch.script.ScriptMode; import org.elasticsearch.xpack.common.text.DefaultTextTemplateEngine; import java.util.Collections; @@ -29,28 +30,27 @@ public class MockMustacheScriptEngine extends MockScriptEngine { public void onModule(ScriptModule module) { module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(MockMustacheScriptEngine.class, - Collections.singletonList(NAME))); + NAME, ScriptMode.ON)); } } @Override - public List getTypes() { - return Collections.singletonList(NAME); + public String getType() { + return NAME; } @Override - public List getExtensions() { - return getTypes(); + public String getExtension() { + return NAME; } @Override - public Object compile(String script, Map params) { + public Object compile(String name, String script, Map params) { if (script.contains("{{") && script.contains("}}")) { throw new IllegalArgumentException("Fix your test to not rely on mustache"); } - return script; + return super.compile(name, script, params); } - } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java index 2a1cfcdd893..fe34b142ad3 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java @@ -7,6 +7,7 @@ package org.elasticsearch.script; import org.elasticsearch.common.Nullable; import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.script.ScriptMode; import org.elasticsearch.search.lookup.SearchLookup; import java.io.IOException; @@ -21,8 +22,6 @@ public class SleepScriptEngine implements ScriptEngineService { public static final String NAME = "sleep"; - public static final List TYPES = Collections.singletonList(NAME); - public static class TestPlugin extends Plugin { public TestPlugin() { @@ -39,29 +38,25 @@ public class SleepScriptEngine implements ScriptEngineService { } public void onModule(ScriptModule module) { - module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(SleepScriptEngine.class, SleepScriptEngine.TYPES)); + module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(SleepScriptEngine.class, + SleepScriptEngine.NAME, ScriptMode.ON)); } } @Override - public List getTypes() { - return TYPES; + public String getType() { + return NAME; } @Override - public List getExtensions() { - return TYPES; + public String getExtension() { + return NAME; } @Override - public boolean isSandboxed() { - return true; - } - - @Override - public Object compile(String script, Map params) { - return script; + public Object compile(String scriptName, String scriptSource, Map params) { + return scriptSource; } @Override diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java index 7ce32199a56..86a16d50abf 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java @@ -136,6 +136,7 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase .put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100)) .put(ShieldSettings.settings(shieldEnabled)) .put("xpack.watcher.trigger.schedule.engine", scheduleImplName) + .put("script.inline", "true") .build(); }