Merge branch 'master' into gh-2001

Original commit: elastic/x-pack-elasticsearch@7ebbf816d5
This commit is contained in:
Shaunak Kashyap 2016-05-13 21:58:41 -07:00
commit 7d0a210813
9 changed files with 26 additions and 33 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

@ -38,8 +38,6 @@ public class RestMonitoringBulkAction extends MonitoringRestHandler {
controller.registerHandler(PUT, URI_BASE + "/_bulk", this);
controller.registerHandler(POST, URI_BASE + "/{type}/_bulk", this);
controller.registerHandler(PUT, URI_BASE + "/{type}/_bulk", this);
controller.registerHandler(POST, URI_BASE + "/{index}/{type}/_bulk", this);
controller.registerHandler(PUT, URI_BASE + "/{index}/{type}/_bulk", this);
}
@Override

View File

@ -13,6 +13,9 @@
"xpack.version": "${project.version}"
}
},
"kibana": {
"enabled": false
},
"node": {
"enabled": false
}

View File

@ -4,12 +4,8 @@
"methods": ["POST", "PUT"],
"url": {
"path": "/_x-pack/monitoring/_bulk",
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{index}/_bulk", "/_x-pack/monitoring/{index}/{type}/_bulk"],
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{type}/_bulk"],
"parts": {
"index": {
"type" : "string",
"description" : "Default index for items which don't provide one"
},
"type": {
"type" : "string",
"description" : "Default document type for items which don't provide one"

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