diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java index 751caf048d3..905f52651e5 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java @@ -15,7 +15,7 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.RestUtils; -import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.xpack.common.http.auth.HttpAuth; import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; import org.elasticsearch.xpack.common.text.TextTemplate; @@ -459,7 +459,7 @@ public class HttpRequestTemplate implements ToXContent { } public Builder body(XContentBuilder content) throws IOException { - return body(new TextTemplate(content.string(), content.contentType(), ScriptService.ScriptType.INLINE, null)); + return body(new TextTemplate(content.string(), content.contentType(), ScriptType.INLINE, null)); } public Builder connectionTimeout(TimeValue timeout) { diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/common/text/TextTemplate.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/common/text/TextTemplate.java index 83ce0db34e6..4657916e838 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/common/text/TextTemplate.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/common/text/TextTemplate.java @@ -12,7 +12,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService.ScriptType; +import org.elasticsearch.script.ScriptType; import java.io.IOException; import java.util.Map; diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java index 998e027e203..753d8cf76f4 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java @@ -20,7 +20,7 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.query.QueryParseContext; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.SearchRequestParsers; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.xpack.common.text.TextTemplate; @@ -54,7 +54,7 @@ public class WatcherSearchTemplateRequest implements ToXContent { this.indicesOptions = indicesOptions; // Here we convert a watch search request body into an inline search template, // this way if any Watcher related context variables are used, they will get resolved. - this.template = new Script(searchSource.utf8ToString(), ScriptService.ScriptType.INLINE, TextTemplate.DEFAULT_TEMPLATE_LANG, null); + this.template = new Script(searchSource.utf8ToString(), ScriptType.INLINE, TextTemplate.DEFAULT_TEMPLATE_LANG, null); this.searchSource = null; } @@ -118,7 +118,7 @@ public class WatcherSearchTemplateRequest implements ToXContent { if (template != null) { return template; } else { - return new Script(searchSource.utf8ToString(), ScriptService.ScriptType.INLINE, TextTemplate.DEFAULT_TEMPLATE_LANG, null); + return new Script(searchSource.utf8ToString(), ScriptType.INLINE, TextTemplate.DEFAULT_TEMPLATE_LANG, null); } } diff --git a/elasticsearch/src/test/java/org/elasticsearch/script/SleepScriptEngine.java b/elasticsearch/src/test/java/org/elasticsearch/script/SleepScriptEngine.java index acd5daf3131..8961cc3e440 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/script/SleepScriptEngine.java +++ b/elasticsearch/src/test/java/org/elasticsearch/script/SleepScriptEngine.java @@ -69,7 +69,7 @@ public class SleepScriptEngine implements ScriptEngineService { } public static Script sleepScript(long millis) { - return new Script("", ScriptService.ScriptType.INLINE, "sleep", Collections.singletonMap("millis", millis)); + return new Script("", ScriptType.INLINE, "sleep", Collections.singletonMap("millis", millis)); } @Override diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java index b204fece9f6..1ca501f0d32 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java @@ -14,7 +14,7 @@ import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.script.CompiledScript; import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.ScriptService; -import org.elasticsearch.script.ScriptService.ScriptType; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.script.Script; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.watcher.Watcher; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java index 793c2c7f1cf..889c9cc2447 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java @@ -19,7 +19,7 @@ import org.elasticsearch.script.AbstractSearchScript; import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.NativeScriptFactory; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService.ScriptType; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.xpack.graph.action.GraphExploreAction; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java index 874f3e53373..1ef212073f2 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java @@ -73,6 +73,7 @@ import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.xpack.security.authz.accesscontrol.DocumentSubsetReader.DocumentSubsetDirectoryReader; import org.elasticsearch.license.XPackLicenseState; @@ -591,7 +592,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase { XContentBuilder builder = jsonBuilder(); String query = new TermQueryBuilder("field", "{{_user.username}}").toXContent(builder, ToXContent.EMPTY_PARAMS).string(); - Script script = new Script(query, ScriptService.ScriptType.INLINE, null, Collections.singletonMap("custom", "value")); + Script script = new Script(query, ScriptType.INLINE, null, Collections.singletonMap("custom", "value")); builder = jsonBuilder().startObject().field("template"); script.toXContent(builder, ToXContent.EMPTY_PARAMS); BytesReference querySource = builder.endObject().bytes(); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/condition/ScriptConditionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/condition/ScriptConditionTests.java index 9a39383da33..3e093e30476 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/condition/ScriptConditionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/condition/ScriptConditionTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.script.ScriptEngineRegistry; import org.elasticsearch.script.ScriptEngineService; import org.elasticsearch.script.ScriptException; import org.elasticsearch.script.ScriptService; -import org.elasticsearch.script.ScriptService.ScriptType; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.script.ScriptSettings; import org.elasticsearch.search.internal.InternalSearchResponse; import org.elasticsearch.test.ESTestCase; diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java index fe0ad306398..1f9220ec2e7 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.MockScriptPlugin; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.xpack.support.clock.SystemClock; import org.elasticsearch.xpack.watcher.WatcherService; import org.elasticsearch.xpack.watcher.actions.ActionStatus; @@ -348,7 +348,7 @@ public class ManualExecutionTests extends AbstractWatcherIntegrationTestCase { } public void testWatchExecutionDuration() throws Exception { - Script script = new Script("sleep", ScriptService.ScriptType.INLINE, null, singletonMap("millis", 100L)); + Script script = new Script("sleep", ScriptType.INLINE, null, singletonMap("millis", 100L)); WatchSourceBuilder watchBuilder = watchBuilder() .trigger(schedule(cron("0 0 0 1 * ? 2099"))) .input(simpleInput("foo", "bar")) @@ -364,7 +364,7 @@ public class ManualExecutionTests extends AbstractWatcherIntegrationTestCase { } public void testForceDeletionOfLongRunningWatch() throws Exception { - Script script = new Script("sleep", ScriptService.ScriptType.INLINE, null, singletonMap("millis", 10000L)); + Script script = new Script("sleep", ScriptType.INLINE, null, singletonMap("millis", 10000L)); WatchSourceBuilder watchBuilder = watchBuilder() .trigger(schedule(cron("0 0 0 1 * ? 2099"))) .input(simpleInput("foo", "bar")) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java index 51f69d65361..7ebef1122fb 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.MockScriptPlugin; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; @@ -265,7 +265,7 @@ public class HistoryActionConditionTests extends AbstractWatcherIntegrationTestC * @return Never {@code null} */ private static Condition mockScriptCondition(String inlineScript) { - Script script = new Script(inlineScript, ScriptService.ScriptType.INLINE, MockScriptPlugin.NAME, null, null); + Script script = new Script(inlineScript, ScriptType.INLINE, MockScriptPlugin.NAME, null, null); return new ScriptCondition(script); } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java index 64617575d66..007fb0dbc3f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java @@ -17,7 +17,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.support.clock.SystemClock; @@ -32,7 +31,8 @@ import java.util.Map; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.script.ScriptService.ScriptType; + +import org.elasticsearch.script.ScriptType; import static org.elasticsearch.xpack.watcher.input.search.ExecutableSearchInput.DEFAULT_SEARCH_TYPE; import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.formatDate; import static org.elasticsearch.xpack.watcher.support.WatcherUtils.flattenModel; @@ -107,7 +107,7 @@ public class WatcherUtilsTests extends ESTestCase { } } String text = randomAsciiOfLengthBetween(1, 5); - ScriptService.ScriptType scriptType = randomFrom(ScriptService.ScriptType.values()); + ScriptType scriptType = randomFrom(ScriptType.values()); expectedTemplate = new Script(text, scriptType, "mustache", params); request = new WatcherSearchTemplateRequest(expectedIndices, expectedTypes, expectedSearchType, expectedIndicesOptions, expectedTemplate); @@ -206,7 +206,7 @@ public class WatcherUtilsTests extends ESTestCase { } } String text = randomAsciiOfLengthBetween(1, 5); - ScriptService.ScriptType scriptType = randomFrom(ScriptService.ScriptType.values()); + ScriptType scriptType = randomFrom(ScriptType.values()); template = new Script(text, scriptType, "mustache", params); builder.field("template", template); } diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java index e57666c503d..c9617204a95 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.action.search.SearchType; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.xpack.support.clock.SystemClock; import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; @@ -256,7 +256,7 @@ public class BasicWatcherTests extends AbstractWatcherIntegrationTestCase { .setSource(jsonBuilder().startObject().field("template").value(searchSourceBuilder).endObject().bytes()) .get()); - Script template = new Script("my-template", ScriptService.ScriptType.STORED, "mustache", null); + Script template = new Script("my-template", ScriptType.STORED, "mustache", null); WatcherSearchTemplateRequest searchRequest = new WatcherSearchTemplateRequest(new String[]{"events"}, new String[0], SearchType.DEFAULT, WatcherSearchTemplateRequest.DEFAULT_INDICES_OPTIONS, template); testConditionSearch(searchRequest); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java index 7025d705143..2936e1ed6d7 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java @@ -22,6 +22,7 @@ import org.elasticsearch.script.MockMustacheScriptEngine; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.SearchRequestParsers; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.test.ESIntegTestCase; @@ -192,7 +193,7 @@ public class SearchTransformTests extends ESIntegTestCase { builder.field("search_type", searchType.name()); } if (templateName != null) { - TextTemplate template = new TextTemplate(templateName, null, ScriptService.ScriptType.FILE, null); + TextTemplate template = new TextTemplate(templateName, null, ScriptType.FILE, null); builder.field("template", template); } @@ -229,7 +230,7 @@ public class SearchTransformTests extends ESIntegTestCase { } if (templateName != null) { assertThat(executable.transform().getRequest().getTemplate(), - equalTo(new Script("template1", ScriptService.ScriptType.FILE, "mustache", null))); + equalTo(new Script("template1", ScriptType.FILE, "mustache", null))); } assertThat(executable.transform().getRequest().getSearchSource().utf8ToString(), equalTo("{\"query\":{\"match_all\":{}}}")); assertThat(executable.transform().getTimeout(), equalTo(readTimeout)); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java index 1d85f4d21ca..80c131d533b 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java @@ -15,7 +15,7 @@ import org.elasticsearch.env.Environment; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.MockScriptPlugin; import org.elasticsearch.script.Script; -import org.elasticsearch.script.ScriptService; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.support.search.WatcherSearchTemplateRequest; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; @@ -128,10 +128,10 @@ public class TransformIntegrationTests extends AbstractWatcherIntegrationTestCas .setScriptLang("painless") .setSource(new BytesArray("{\"script\" : \"['key3' : ctx.payload.key1 + ctx.payload.key2]\"}")) .get()); - script = new Script("my-script", ScriptService.ScriptType.STORED, "painless", null); + script = new Script("my-script", ScriptType.STORED, "painless", null); } else { logger.info("testing script transform with a file script"); - script = new Script("my-script", ScriptService.ScriptType.FILE, "painless", null); + script = new Script("my-script", ScriptType.FILE, "painless", null); } // put a watch that has watch level transform: diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java index 6433d0f5278..903a95bf22a 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java @@ -15,7 +15,7 @@ import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.GeneralScriptException; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptService; -import org.elasticsearch.script.ScriptService.ScriptType; +import org.elasticsearch.script.ScriptType; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool;