From 3c650e483b428a59eb779c1f61dd103077b09ec9 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 23 Sep 2016 08:54:36 +0200 Subject: [PATCH] Followup from elastic/elasticsearchelastic/elasticsearch#20627 - Removal of AnalysisService Original commit: elastic/x-pack-elasticsearch@75c14534a7535ac166eb5cf62a041511ee6cf739 --- .../SecurityIndexSearcherWrapperUnitTests.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java index 7e43f6ffe1a..303b7c71362 100644 --- a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java +++ b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java @@ -39,7 +39,6 @@ import org.apache.lucene.util.SparseFixedBitSet; import org.elasticsearch.client.Client; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.compress.CompressedXContent; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.lucene.index.ElasticsearchDirectoryReader; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; @@ -47,7 +46,8 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; -import org.elasticsearch.index.analysis.AnalysisService; +import org.elasticsearch.index.analysis.IndexAnalyzers; +import org.elasticsearch.index.analysis.NamedAnalyzer; import org.elasticsearch.index.cache.bitset.BitsetFilterCache; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.mapper.ParentFieldMapper; @@ -78,9 +78,6 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.IndexSettingsModule; import org.elasticsearch.xpack.security.user.User; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.test.IndexSettingsModule; -import org.elasticsearch.xpack.security.authz.accesscontrol.DocumentSubsetReader.DocumentSubsetDirectoryReader; import org.elasticsearch.xpack.security.authz.permission.FieldPermissions; import org.junit.After; import org.junit.Before; @@ -127,10 +124,11 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase { Index index = new Index("_index", "testUUID"); scriptService = mock(ScriptService.class); indexSettings = IndexSettingsModule.newIndexSettings(index, Settings.EMPTY); - AnalysisService analysisService = new AnalysisService(indexSettings, Collections.emptyMap(), Collections.emptyMap(), - Collections.emptyMap(), Collections.emptyMap()); + NamedAnalyzer namedAnalyzer = new NamedAnalyzer("default", new StandardAnalyzer()); + IndexAnalyzers indexAnalyzers = new IndexAnalyzers(indexSettings, namedAnalyzer, namedAnalyzer, namedAnalyzer, + Collections.emptyMap()); SimilarityService similarityService = new SimilarityService(indexSettings, Collections.emptyMap()); - mapperService = new MapperService(indexSettings, analysisService, similarityService, + mapperService = new MapperService(indexSettings, indexAnalyzers, similarityService, new IndicesModule(emptyList()).getMapperRegistry(), () -> null); ShardId shardId = new ShardId(index, 0);