From de12d4b58d9023224b8835aac5f08fd6a8d1c4c9 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Tue, 5 Jan 2016 13:53:40 -0500 Subject: [PATCH] Stop building query parsers with guice This is the fallout from https://github.com/elastic/elasticsearch/pull/15761 Original commit: elastic/x-pack-elasticsearch@9509feb3100923fab7404280381fe4c623a8b7ee --- .../elasticsearch/shield/audit/AuditTrailModuleTests.java | 2 +- .../elasticsearch/watcher/support/WatcherUtilsTests.java | 6 ++---- .../java/org/elasticsearch/watcher/watch/WatchTests.java | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java index f4a67e90f6d..c0adb8bade1 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java @@ -56,7 +56,7 @@ public class AuditTrailModuleTests extends ESTestCase { try { Injector injector = Guice.createInjector( new SettingsModule(settings, new SettingsFilter(settings)), - new NetworkModule(new NetworkService(settings), settings, false) { + new NetworkModule(new NetworkService(settings), settings, false, null) { @Override protected void configure() { bind(Transport.class).to(LocalTransport.class).asEagerSingleton(); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/support/WatcherUtilsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/support/WatcherUtilsTests.java index 23025ca22d0..3050e1db62b 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/support/WatcherUtilsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/support/WatcherUtilsTests.java @@ -11,7 +11,6 @@ import org.elasticsearch.action.search.SearchType; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; @@ -34,7 +33,6 @@ import org.joda.time.DateTime; import java.io.IOException; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -134,7 +132,7 @@ public class WatcherUtilsTests extends ESTestCase { builder = WatcherUtils.writeSearchRequest(expectedRequest, builder, ToXContent.EMPTY_PARAMS); XContentParser parser = XContentHelper.createParser(builder.bytes()); assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT)); - IndicesQueriesRegistry registry = new IndicesQueriesRegistry(Settings.EMPTY, Collections.singleton(new MatchAllQueryParser()), new NamedWriteableRegistry()); + IndicesQueriesRegistry registry = new IndicesQueriesRegistry(Settings.EMPTY, singletonMap("match_all", new MatchAllQueryParser())); QueryParseContext context = new QueryParseContext(registry); context.reset(parser); SearchRequest result = WatcherUtils.readSearchRequest(parser, ExecutableSearchInput.DEFAULT_SEARCH_TYPE, context); @@ -220,7 +218,7 @@ public class WatcherUtilsTests extends ESTestCase { XContentParser parser = XContentHelper.createParser(builder.bytes()); assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT)); - IndicesQueriesRegistry registry = new IndicesQueriesRegistry(Settings.EMPTY, Collections.singleton(new MatchAllQueryParser()), new NamedWriteableRegistry()); + IndicesQueriesRegistry registry = new IndicesQueriesRegistry(Settings.EMPTY, singletonMap("match_all", new MatchAllQueryParser())); QueryParseContext context = new QueryParseContext(registry); context.reset(parser); SearchRequest result = WatcherUtils.readSearchRequest(parser, ExecutableSearchInput.DEFAULT_SEARCH_TYPE, context); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/watch/WatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/watch/WatchTests.java index 5c1e4c58c0b..5aac9732d7c 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/watch/WatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/watch/WatchTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.watcher.watch; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; @@ -345,7 +344,7 @@ public class WatchTests extends ESTestCase { Map parsers = new HashMap<>(); switch (input.type()) { case SearchInput.TYPE: - IndicesQueriesRegistry queryRegistry = new IndicesQueriesRegistry(Settings.EMPTY, Collections.singleton(new MatchAllQueryParser()), new NamedWriteableRegistry()); + IndicesQueriesRegistry queryRegistry = new IndicesQueriesRegistry(Settings.EMPTY, singletonMap("match_all", new MatchAllQueryParser())); parsers.put(SearchInput.TYPE, new SearchInputFactory(settings, client, queryRegistry)); return new InputRegistry(parsers); default: @@ -405,7 +404,7 @@ public class WatchTests extends ESTestCase { } private TransformRegistry transformRegistry() { - IndicesQueriesRegistry queryRegistry = new IndicesQueriesRegistry(Settings.EMPTY, Collections.singleton(new MatchAllQueryParser()), new NamedWriteableRegistry()); + IndicesQueriesRegistry queryRegistry = new IndicesQueriesRegistry(Settings.EMPTY, singletonMap("match_all", new MatchAllQueryParser())); Map factories = new HashMap<>(); ChainTransformFactory parser = new ChainTransformFactory(); factories.put(ChainTransform.TYPE, parser);