Merge pull request elastic/elasticsearch#2203 from dakrone/fix-sandbox-removal

Fix Watcher tests for 'sandbox' option removal

Original commit: elastic/x-pack-elasticsearch@cb2db48d13
This commit is contained in:
Lee Hinman 2016-05-13 10:13:20 -06:00
commit 8c05125781
5 changed files with 13 additions and 14 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

@ -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,19 +30,19 @@ 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();
return Collections.singletonList(NAME);
}
@Override

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;
@ -39,14 +40,15 @@ 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
@ -54,11 +56,6 @@ public class SleepScriptEngine implements ScriptEngineService {
return TYPES;
}
@Override
public boolean isSandboxed() {
return true;
}
@Override
public Object compile(String script, Map<String, String> params) {
return script;

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