Rename ScriptEngineService to ScriptEngine (elastic/x-pack-elasticsearch#1374)
This is the xpack side of elastic/elasticsearch#24574 Original commit: elastic/x-pack-elasticsearch@4d37021f6d
This commit is contained in:
parent
c1016f3c3d
commit
85deb1f8f7
|
@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
||||||
public class LatchScriptEngine implements ScriptEngineService {
|
public class LatchScriptEngine implements ScriptEngine {
|
||||||
|
|
||||||
private static final String NAME = "latch";
|
private static final String NAME = "latch";
|
||||||
private static final LatchScriptEngine INSTANCE = new LatchScriptEngine();
|
private static final LatchScriptEngine INSTANCE = new LatchScriptEngine();
|
||||||
|
@ -103,7 +103,7 @@ public class LatchScriptEngine implements ScriptEngineService {
|
||||||
public static class LatchScriptPlugin extends Plugin implements ScriptPlugin {
|
public static class LatchScriptPlugin extends Plugin implements ScriptPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScriptEngineService getScriptEngineService(Settings settings) {
|
public ScriptEngine getScriptEngine(Settings settings) {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class MockMustacheScriptEngine extends MockScriptEngine {
|
||||||
|
|
||||||
public static class TestPlugin extends MockScriptPlugin {
|
public static class TestPlugin extends MockScriptPlugin {
|
||||||
@Override
|
@Override
|
||||||
public ScriptEngineService getScriptEngineService(Settings settings) {
|
public ScriptEngine getScriptEngine(Settings settings) {
|
||||||
return new MockMustacheScriptEngine();
|
return new MockMustacheScriptEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.monitoring.test;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.script.MockScriptEngine;
|
import org.elasticsearch.script.MockScriptEngine;
|
||||||
import org.elasticsearch.script.MockScriptPlugin;
|
import org.elasticsearch.script.MockScriptPlugin;
|
||||||
import org.elasticsearch.script.ScriptEngineService;
|
import org.elasticsearch.script.ScriptEngine;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -23,7 +23,7 @@ public class MockPainlessScriptEngine extends MockScriptEngine {
|
||||||
|
|
||||||
public static class TestPlugin extends MockScriptPlugin {
|
public static class TestPlugin extends MockScriptPlugin {
|
||||||
@Override
|
@Override
|
||||||
public ScriptEngineService getScriptEngineService(Settings settings) {
|
public ScriptEngine getScriptEngine(Settings settings) {
|
||||||
return new MockPainlessScriptEngine();
|
return new MockPainlessScriptEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.elasticsearch.script.MockScriptEngine;
|
||||||
import org.elasticsearch.script.Script;
|
import org.elasticsearch.script.Script;
|
||||||
import org.elasticsearch.script.ScriptContext;
|
import org.elasticsearch.script.ScriptContext;
|
||||||
import org.elasticsearch.script.ScriptContextRegistry;
|
import org.elasticsearch.script.ScriptContextRegistry;
|
||||||
|
import org.elasticsearch.script.ScriptEngine;
|
||||||
import org.elasticsearch.script.ScriptEngineRegistry;
|
import org.elasticsearch.script.ScriptEngineRegistry;
|
||||||
import org.elasticsearch.script.ScriptEngineService;
|
|
||||||
import org.elasticsearch.script.ScriptException;
|
import org.elasticsearch.script.ScriptException;
|
||||||
import org.elasticsearch.script.ScriptMetaData;
|
import org.elasticsearch.script.ScriptMetaData;
|
||||||
import org.elasticsearch.script.ScriptService;
|
import org.elasticsearch.script.ScriptService;
|
||||||
|
@ -50,7 +50,6 @@ import static java.util.Collections.emptyList;
|
||||||
import static java.util.Collections.singleton;
|
import static java.util.Collections.singleton;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.elasticsearch.script.ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING;
|
|
||||||
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
|
import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument;
|
||||||
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext;
|
import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
@ -87,7 +86,7 @@ public class ScriptConditionTests extends ESTestCase {
|
||||||
return total > threshold;
|
return total > threshold;
|
||||||
});
|
});
|
||||||
|
|
||||||
ScriptEngineService engine = new MockScriptEngine(MockScriptEngine.NAME, scripts);
|
ScriptEngine engine = new MockScriptEngine(MockScriptEngine.NAME, scripts);
|
||||||
|
|
||||||
ScriptEngineRegistry registry = new ScriptEngineRegistry(singleton(engine));
|
ScriptEngineRegistry registry = new ScriptEngineRegistry(singleton(engine));
|
||||||
ScriptContextRegistry contextRegistry = new ScriptContextRegistry(singleton(new ScriptContext.Plugin("xpack", "watch")));
|
ScriptContextRegistry contextRegistry = new ScriptContextRegistry(singleton(new ScriptContext.Plugin("xpack", "watch")));
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.elasticsearch.script.ScriptContextRegistry;
|
||||||
import org.elasticsearch.script.ScriptEngineRegistry;
|
import org.elasticsearch.script.ScriptEngineRegistry;
|
||||||
import org.elasticsearch.script.ScriptService;
|
import org.elasticsearch.script.ScriptService;
|
||||||
import org.elasticsearch.script.ScriptSettings;
|
import org.elasticsearch.script.ScriptSettings;
|
||||||
import org.elasticsearch.script.mustache.MustacheScriptEngineService;
|
import org.elasticsearch.script.mustache.MustacheScriptEngine;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.watcher.ResourceWatcherService;
|
import org.elasticsearch.watcher.ResourceWatcherService;
|
||||||
import org.elasticsearch.xpack.common.text.TextTemplate;
|
import org.elasticsearch.xpack.common.text.TextTemplate;
|
||||||
|
@ -47,7 +47,7 @@ public class WatcherTemplateIT extends ESTestCase {
|
||||||
ScriptContextRegistry registry = new ScriptContextRegistry(Collections.singletonList(new ScriptContext.Plugin("xpack", "watch")));
|
ScriptContextRegistry registry = new ScriptContextRegistry(Collections.singletonList(new ScriptContext.Plugin("xpack", "watch")));
|
||||||
|
|
||||||
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
||||||
Collections.singleton(new MustacheScriptEngineService())
|
Collections.singleton(new MustacheScriptEngine())
|
||||||
);
|
);
|
||||||
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
||||||
ScriptService scriptService = new ScriptService(setting, environment, resourceWatcherService, scriptEngineRegistry,
|
ScriptService scriptService = new ScriptService(setting, environment, resourceWatcherService, scriptEngineRegistry,
|
||||||
|
|
Loading…
Reference in New Issue