Merge branch 'master' into fix/remove-xpack-password

Original commit: elastic/x-pack-elasticsearch@50e8be9f0e
This commit is contained in:
Lukas Olson 2016-05-13 12:57:29 -07:00
commit 547e0cfd3c
6 changed files with 22 additions and 26 deletions

View File

@ -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));

View File

@ -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);

View File

@ -107,11 +107,11 @@ public class ShieldServerTransportService extends TransportService {
@Override
public <Request extends TransportRequest> void registerRequestHandler(String action, Supplier<Request> request, String executor,
boolean forceExecution,
boolean forceExecution, boolean canTripCircuitBreaker,
TransportRequestHandler<Request> handler) {
TransportRequestHandler<Request> 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<String, ServerTransportFilter> initializeProfileFilters() {

View File

@ -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<String> getTypes() {
return Collections.singletonList(NAME);
public String getType() {
return NAME;
}
@Override
public List<String> getExtensions() {
return getTypes();
public String getExtension() {
return NAME;
}
@Override
public Object compile(String script, Map<String, String> params) {
public Object compile(String name, String script, Map<String, String> 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);
}
}

View File

@ -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<String> 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<String> getTypes() {
return TYPES;
public String getType() {
return NAME;
}
@Override
public List<String> getExtensions() {
return TYPES;
public String getExtension() {
return NAME;
}
@Override
public boolean isSandboxed() {
return true;
}
@Override
public Object compile(String script, Map<String, String> params) {
return script;
public Object compile(String scriptName, String scriptSource, Map<String, String> params) {
return scriptSource;
}
@Override

View File

@ -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();
}