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:
commit
8c05125781
|
@ -42,7 +42,7 @@ public final class MessyTestUtils {
|
||||||
engineServiceSet.add(groovyScriptEngineService);
|
engineServiceSet.add(groovyScriptEngineService);
|
||||||
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new ScriptEngineRegistry.ScriptEngineRegistration(GroovyScriptEngineService.class, GroovyScriptEngineService.TYPES)
|
new ScriptEngineRegistry.ScriptEngineRegistration(GroovyScriptEngineService.class, GroovyScriptEngineService.NAME)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Arrays.asList(ScriptServiceProxy.INSTANCE));
|
ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Arrays.asList(ScriptServiceProxy.INSTANCE));
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class WatcherTemplateTests extends ESTestCase {
|
||||||
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new ScriptEngineRegistry.ScriptEngineRegistration(MustacheScriptEngineService.class,
|
new ScriptEngineRegistry.ScriptEngineRegistration(MustacheScriptEngineService.class,
|
||||||
MustacheScriptEngineService.TYPES)
|
MustacheScriptEngineService.NAME)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.script;
|
package org.elasticsearch.script;
|
||||||
|
|
||||||
|
import org.elasticsearch.script.ScriptMode;
|
||||||
import org.elasticsearch.xpack.common.text.DefaultTextTemplateEngine;
|
import org.elasticsearch.xpack.common.text.DefaultTextTemplateEngine;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -29,19 +30,19 @@ public class MockMustacheScriptEngine extends MockScriptEngine {
|
||||||
|
|
||||||
public void onModule(ScriptModule module) {
|
public void onModule(ScriptModule module) {
|
||||||
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(MockMustacheScriptEngine.class,
|
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(MockMustacheScriptEngine.class,
|
||||||
Collections.singletonList(NAME)));
|
NAME, ScriptMode.ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTypes() {
|
public String getType() {
|
||||||
return Collections.singletonList(NAME);
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getExtensions() {
|
public List<String> getExtensions() {
|
||||||
return getTypes();
|
return Collections.singletonList(NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.elasticsearch.script;
|
||||||
|
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
import org.elasticsearch.script.ScriptMode;
|
||||||
import org.elasticsearch.search.lookup.SearchLookup;
|
import org.elasticsearch.search.lookup.SearchLookup;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -39,14 +40,15 @@ public class SleepScriptEngine implements ScriptEngineService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(ScriptModule module) {
|
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
|
@Override
|
||||||
public List<String> getTypes() {
|
public String getType() {
|
||||||
return TYPES;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,11 +56,6 @@ public class SleepScriptEngine implements ScriptEngineService {
|
||||||
return TYPES;
|
return TYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSandboxed() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object compile(String script, Map<String, String> params) {
|
public Object compile(String script, Map<String, String> params) {
|
||||||
return script;
|
return script;
|
||||||
|
|
|
@ -136,6 +136,7 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
|
||||||
.put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100))
|
.put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100))
|
||||||
.put(ShieldSettings.settings(shieldEnabled))
|
.put(ShieldSettings.settings(shieldEnabled))
|
||||||
.put("xpack.watcher.trigger.schedule.engine", scheduleImplName)
|
.put("xpack.watcher.trigger.schedule.engine", scheduleImplName)
|
||||||
|
.put("script.inline", "true")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue