From dfdc738a9f91b55034c48f961406b42484b231b7 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 26 Nov 2015 09:50:41 +0100 Subject: [PATCH] Simplify MonitorService construction and detach from guice This is a pretty trivial change that moves most of the monitor service related object creation from guice into the monitor service. This is a babystep towards removing guice on the node level as well. Instead of opening huge PRs I try to do this in baby-steps that are easier to digest. --- .../client/transport/TransportClient.java | 10 ++- .../common/network/NetworkModule.java | 8 ++- .../common/network/NetworkService.java | 4 +- .../common/settings/SettingsFilter.java | 3 +- .../common/settings/SettingsModule.java | 6 +- .../elasticsearch/monitor/MonitorModule.java | 63 ------------------- .../elasticsearch/monitor/MonitorService.java | 18 +++--- .../org/elasticsearch/monitor/fs/FsProbe.java | 2 - .../elasticsearch/monitor/fs/FsService.java | 7 +-- .../monitor/jvm/JvmMonitorService.java | 2 - .../elasticsearch/monitor/jvm/JvmService.java | 2 - .../elasticsearch/monitor/os/OsService.java | 6 +- .../monitor/process/ProcessService.java | 6 +- .../java/org/elasticsearch/node/Node.java | 21 ++++--- .../org/elasticsearch/node/NodeModule.java | 10 ++- .../index/query/AbstractQueryTestCase.java | 3 +- .../index/query/TemplateQueryParserTests.java | 3 +- .../script/NativeScriptTests.java | 3 +- .../builder/SearchSourceBuilderTests.java | 3 +- 19 files changed, 66 insertions(+), 114 deletions(-) delete mode 100644 core/src/main/java/org/elasticsearch/monitor/MonitorModule.java diff --git a/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java index 10ef7bcb13c..73c950e8bf4 100644 --- a/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/core/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -38,7 +38,9 @@ import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.network.NetworkModule; +import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.env.Environment; @@ -46,6 +48,7 @@ import org.elasticsearch.env.EnvironmentModule; import org.elasticsearch.indices.breaker.CircuitBreakerModule; import org.elasticsearch.monitor.MonitorService; import org.elasticsearch.node.internal.InternalSettingsPreparer; +import org.elasticsearch.node.settings.NodeSettingsService; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.PluginsModule; import org.elasticsearch.plugins.PluginsService; @@ -128,7 +131,8 @@ public class TransportClient extends AbstractClient { Version version = Version.CURRENT; final ThreadPool threadPool = new ThreadPool(settings); - + final NetworkService networkService = new NetworkService(settings); + final SettingsFilter settingsFilter = new SettingsFilter(settings); boolean success = false; try { ModulesBuilder modules = new ModulesBuilder(); @@ -138,8 +142,8 @@ public class TransportClient extends AbstractClient { modules.add(pluginModule); } modules.add(new PluginsModule(pluginsService)); - modules.add(new SettingsModule(this.settings)); - modules.add(new NetworkModule()); + modules.add(new SettingsModule(this.settings, settingsFilter )); + modules.add(new NetworkModule(networkService)); modules.add(new ClusterNameModule(this.settings)); modules.add(new ThreadPoolModule(threadPool)); modules.add(new TransportModule(this.settings)); diff --git a/core/src/main/java/org/elasticsearch/common/network/NetworkModule.java b/core/src/main/java/org/elasticsearch/common/network/NetworkModule.java index 6f5d728a6dd..c1f282ac234 100644 --- a/core/src/main/java/org/elasticsearch/common/network/NetworkModule.java +++ b/core/src/main/java/org/elasticsearch/common/network/NetworkModule.java @@ -26,8 +26,14 @@ import org.elasticsearch.common.inject.AbstractModule; */ public class NetworkModule extends AbstractModule { + private final NetworkService networkService; + + public NetworkModule(NetworkService networkService) { + this.networkService = networkService; + } + @Override protected void configure() { - bind(NetworkService.class).asEagerSingleton(); + bind(NetworkService.class).toInstance(networkService); } } diff --git a/core/src/main/java/org/elasticsearch/common/network/NetworkService.java b/core/src/main/java/org/elasticsearch/common/network/NetworkService.java index 6a280519c55..9a3f7208687 100644 --- a/core/src/main/java/org/elasticsearch/common/network/NetworkService.java +++ b/core/src/main/java/org/elasticsearch/common/network/NetworkService.java @@ -20,7 +20,6 @@ package org.elasticsearch.common.network; import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; @@ -37,7 +36,7 @@ import java.util.concurrent.TimeUnit; /** * */ -public class NetworkService extends AbstractComponent { +public final class NetworkService extends AbstractComponent { /** By default, we bind to loopback interfaces */ public static final String DEFAULT_NETWORK_HOST = "_local_"; @@ -80,7 +79,6 @@ public class NetworkService extends AbstractComponent { private final List customNameResolvers = new CopyOnWriteArrayList<>(); - @Inject public NetworkService(Settings settings) { super(settings); IfConfig.logIfNecessary(); diff --git a/core/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java b/core/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java index 421e0081998..852f78b9677 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java +++ b/core/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java @@ -35,7 +35,7 @@ import java.util.concurrent.CopyOnWriteArrayList; /** * */ -public class SettingsFilter extends AbstractComponent { +public final class SettingsFilter extends AbstractComponent { /** * Can be used to specify settings filter that will be used to filter out matching settings in toXContent method */ @@ -43,7 +43,6 @@ public class SettingsFilter extends AbstractComponent { private final CopyOnWriteArrayList patterns = new CopyOnWriteArrayList<>(); - @Inject public SettingsFilter(Settings settings) { super(settings); } diff --git a/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java b/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java index 20e65760245..2ae4799d9f3 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java +++ b/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java @@ -29,14 +29,16 @@ import org.elasticsearch.common.inject.AbstractModule; public class SettingsModule extends AbstractModule { private final Settings settings; + private final SettingsFilter settingsFilter; - public SettingsModule(Settings settings) { + public SettingsModule(Settings settings, SettingsFilter settingsFilter) { this.settings = settings; + this.settingsFilter = settingsFilter; } @Override protected void configure() { bind(Settings.class).toInstance(settings); - bind(SettingsFilter.class).asEagerSingleton(); + bind(SettingsFilter.class).toInstance(settingsFilter); } } \ No newline at end of file diff --git a/core/src/main/java/org/elasticsearch/monitor/MonitorModule.java b/core/src/main/java/org/elasticsearch/monitor/MonitorModule.java deleted file mode 100644 index 94c6861da75..00000000000 --- a/core/src/main/java/org/elasticsearch/monitor/MonitorModule.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.monitor; - -import org.elasticsearch.common.inject.AbstractModule; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.monitor.fs.FsProbe; -import org.elasticsearch.monitor.fs.FsService; -import org.elasticsearch.monitor.jvm.JvmMonitorService; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.monitor.os.OsProbe; -import org.elasticsearch.monitor.os.OsService; -import org.elasticsearch.monitor.process.ProcessProbe; -import org.elasticsearch.monitor.process.ProcessService; - -/** - * - */ -public class MonitorModule extends AbstractModule { - - public static final class MonitorSettings { - public static final String MEMORY_MANAGER_TYPE = "monitor.memory.type"; - } - - private final Settings settings; - - public MonitorModule(Settings settings) { - this.settings = settings; - } - - @Override - protected void configure() { - // bind default implementations - bind(ProcessProbe.class).toInstance(ProcessProbe.getInstance()); - bind(OsProbe.class).toInstance(OsProbe.getInstance()); - bind(FsProbe.class).asEagerSingleton(); - - // bind other services - bind(ProcessService.class).asEagerSingleton(); - bind(OsService.class).asEagerSingleton(); - bind(JvmService.class).asEagerSingleton(); - bind(FsService.class).asEagerSingleton(); - - bind(JvmMonitorService.class).asEagerSingleton(); - } -} diff --git a/core/src/main/java/org/elasticsearch/monitor/MonitorService.java b/core/src/main/java/org/elasticsearch/monitor/MonitorService.java index d7ab517617a..e089cf9e2cf 100644 --- a/core/src/main/java/org/elasticsearch/monitor/MonitorService.java +++ b/core/src/main/java/org/elasticsearch/monitor/MonitorService.java @@ -22,11 +22,15 @@ package org.elasticsearch.monitor; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.monitor.fs.FsService; import org.elasticsearch.monitor.jvm.JvmMonitorService; import org.elasticsearch.monitor.jvm.JvmService; import org.elasticsearch.monitor.os.OsService; import org.elasticsearch.monitor.process.ProcessService; +import org.elasticsearch.threadpool.ThreadPool; + +import java.io.IOException; /** * @@ -44,15 +48,13 @@ public class MonitorService extends AbstractLifecycleComponent { private final FsService fsService; @Inject - public MonitorService(Settings settings, JvmMonitorService jvmMonitorService, - OsService osService, ProcessService processService, JvmService jvmService, - FsService fsService) { + public MonitorService(Settings settings, NodeEnvironment nodeEnvironment, ThreadPool threadPool) throws IOException { super(settings); - this.jvmMonitorService = jvmMonitorService; - this.osService = osService; - this.processService = processService; - this.jvmService = jvmService; - this.fsService = fsService; + this.jvmMonitorService = new JvmMonitorService(settings, threadPool); + this.osService = new OsService(settings); + this.processService = new ProcessService(settings); + this.jvmService = new JvmService(settings); + this.fsService = new FsService(settings, nodeEnvironment); } public OsService osService() { diff --git a/core/src/main/java/org/elasticsearch/monitor/fs/FsProbe.java b/core/src/main/java/org/elasticsearch/monitor/fs/FsProbe.java index 56bc352a5bc..dc1958f666b 100644 --- a/core/src/main/java/org/elasticsearch/monitor/fs/FsProbe.java +++ b/core/src/main/java/org/elasticsearch/monitor/fs/FsProbe.java @@ -20,7 +20,6 @@ package org.elasticsearch.monitor.fs; import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.NodeEnvironment.NodePath; @@ -31,7 +30,6 @@ public class FsProbe extends AbstractComponent { private final NodeEnvironment nodeEnv; - @Inject public FsProbe(Settings settings, NodeEnvironment nodeEnv) { super(settings); this.nodeEnv = nodeEnv; diff --git a/core/src/main/java/org/elasticsearch/monitor/fs/FsService.java b/core/src/main/java/org/elasticsearch/monitor/fs/FsService.java index c95a7bf8b3a..7019ec48e0b 100644 --- a/core/src/main/java/org/elasticsearch/monitor/fs/FsService.java +++ b/core/src/main/java/org/elasticsearch/monitor/fs/FsService.java @@ -20,10 +20,10 @@ package org.elasticsearch.monitor.fs; import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.SingleObjectCache; +import org.elasticsearch.env.NodeEnvironment; import java.io.IOException; @@ -35,10 +35,9 @@ public class FsService extends AbstractComponent { private final SingleObjectCache fsStatsCache; - @Inject - public FsService(Settings settings, FsProbe probe) throws IOException { + public FsService(Settings settings, NodeEnvironment nodeEnvironment) throws IOException { super(settings); - this.probe = probe; + this.probe = new FsProbe(settings, nodeEnvironment); TimeValue refreshInterval = settings.getAsTime("monitor.fs.refresh_interval", TimeValue.timeValueSeconds(1)); fsStatsCache = new FsInfoCache(refreshInterval, probe.stats()); logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval); diff --git a/core/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java b/core/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java index a11fc2957a4..8d83435bb98 100644 --- a/core/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java +++ b/core/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java @@ -20,7 +20,6 @@ package org.elasticsearch.monitor.jvm; import org.elasticsearch.common.component.AbstractLifecycleComponent; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.FutureUtils; @@ -71,7 +70,6 @@ public class JvmMonitorService extends AbstractLifecycleComponent osStatsCache; - @Inject - public OsService(Settings settings, OsProbe probe) { + public OsService(Settings settings) { super(settings); - this.probe = probe; + this.probe = OsProbe.getInstance(); TimeValue refreshInterval = settings.getAsTime("monitor.os.refresh_interval", TimeValue.timeValueSeconds(1)); diff --git a/core/src/main/java/org/elasticsearch/monitor/process/ProcessService.java b/core/src/main/java/org/elasticsearch/monitor/process/ProcessService.java index 08d286dd983..0861dfe5b0c 100644 --- a/core/src/main/java/org/elasticsearch/monitor/process/ProcessService.java +++ b/core/src/main/java/org/elasticsearch/monitor/process/ProcessService.java @@ -20,7 +20,6 @@ package org.elasticsearch.monitor.process; import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.SingleObjectCache; @@ -34,10 +33,9 @@ public final class ProcessService extends AbstractComponent { private final ProcessInfo info; private final SingleObjectCache processStatsCache; - @Inject - public ProcessService(Settings settings, ProcessProbe probe) { + public ProcessService(Settings settings) { super(settings); - this.probe = probe; + this.probe = ProcessProbe.getInstance(); final TimeValue refreshInterval = settings.getAsTime("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1)); processStatsCache = new ProcessStatsCache(refreshInterval, probe.processStats()); diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index d245692acc9..366f05c702b 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -20,8 +20,10 @@ package org.elasticsearch.node; import org.elasticsearch.Build; +import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.action.ActionModule; +import org.elasticsearch.bootstrap.Elasticsearch; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.client.Client; import org.elasticsearch.client.node.NodeClientModule; @@ -41,7 +43,9 @@ import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.network.NetworkModule; +import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.DiscoveryModule; @@ -66,7 +70,6 @@ import org.elasticsearch.indices.memory.IndexingMemoryController; import org.elasticsearch.indices.recovery.RecoverySettings; import org.elasticsearch.indices.store.IndicesStore; import org.elasticsearch.indices.ttl.IndicesTTLService; -import org.elasticsearch.monitor.MonitorModule; import org.elasticsearch.monitor.MonitorService; import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.node.internal.InternalSettingsPreparer; @@ -155,11 +158,13 @@ public class Node implements Releasable { } catch (IOException ex) { throw new IllegalStateException("Failed to created node environment", ex); } - + final NetworkService networkService = new NetworkService(settings); + final NodeSettingsService nodeSettingsService = new NodeSettingsService(settings); + final SettingsFilter settingsFilter = new SettingsFilter(settings); final ThreadPool threadPool = new ThreadPool(settings); - boolean success = false; try { + final MonitorService monitorService = new MonitorService(settings, nodeEnvironment, threadPool); ModulesBuilder modules = new ModulesBuilder(); modules.add(new Version.Module(version)); modules.add(new CircuitBreakerModule(settings)); @@ -168,9 +173,9 @@ public class Node implements Releasable { modules.add(pluginModule); } modules.add(new PluginsModule(pluginsService)); - modules.add(new SettingsModule(this.settings)); - modules.add(new NodeModule(this)); - modules.add(new NetworkModule()); + modules.add(new SettingsModule(this.settings, settingsFilter)); + modules.add(new NodeModule(this, nodeSettingsService, monitorService)); + modules.add(new NetworkModule(networkService)); modules.add(new ScriptModule(this.settings)); modules.add(new EnvironmentModule(environment)); modules.add(new NodeEnvironmentModule(nodeEnvironment)); @@ -186,7 +191,6 @@ public class Node implements Releasable { modules.add(new IndicesModule()); modules.add(new SearchModule()); modules.add(new ActionModule(false)); - modules.add(new MonitorModule(settings)); modules.add(new GatewayModule(settings)); modules.add(new NodeClientModule()); modules.add(new PercolatorModule()); @@ -195,7 +199,6 @@ public class Node implements Releasable { modules.add(new TribeModule()); modules.add(new AnalysisModule(environment)); - pluginsService.processModules(modules); injector = modules.createInjector(); @@ -203,6 +206,8 @@ public class Node implements Releasable { client = injector.getInstance(Client.class); threadPool.setNodeSettingsService(injector.getInstance(NodeSettingsService.class)); success = true; + } catch (IOException ex) { + throw new ElasticsearchException("failed to bind service", ex); } finally { if (!success) { nodeEnvironment.close(); diff --git a/core/src/main/java/org/elasticsearch/node/NodeModule.java b/core/src/main/java/org/elasticsearch/node/NodeModule.java index befba85af09..3641c325030 100644 --- a/core/src/main/java/org/elasticsearch/node/NodeModule.java +++ b/core/src/main/java/org/elasticsearch/node/NodeModule.java @@ -22,6 +22,7 @@ package org.elasticsearch.node; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.util.BigArrays; +import org.elasticsearch.monitor.MonitorService; import org.elasticsearch.node.Node; import org.elasticsearch.node.service.NodeService; import org.elasticsearch.node.settings.NodeSettingsService; @@ -32,13 +33,17 @@ import org.elasticsearch.node.settings.NodeSettingsService; public class NodeModule extends AbstractModule { private final Node node; + private final NodeSettingsService nodeSettingsService; + private final MonitorService monitorService; // pkg private so tests can mock Class pageCacheRecyclerImpl = PageCacheRecycler.class; Class bigArraysImpl = BigArrays.class; - public NodeModule(Node node) { + public NodeModule(Node node, NodeSettingsService nodeSettingsService, MonitorService monitorService) { this.node = node; + this.nodeSettingsService = nodeSettingsService; + this.monitorService = monitorService; } @Override @@ -55,7 +60,8 @@ public class NodeModule extends AbstractModule { } bind(Node.class).toInstance(node); - bind(NodeSettingsService.class).asEagerSingleton(); + bind(NodeSettingsService.class).toInstance(nodeSettingsService); + bind(MonitorService.class).toInstance(monitorService); bind(NodeService.class).asEagerSingleton(); } } diff --git a/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java b/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java index b5825e24704..c33beec3da7 100644 --- a/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java +++ b/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java @@ -57,6 +57,7 @@ import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.common.xcontent.*; @@ -183,7 +184,7 @@ public abstract class AbstractQueryTestCase> clientInvocationHandler); injector = new ModulesBuilder().add( new EnvironmentModule(new Environment(settings)), - new SettingsModule(settings), + new SettingsModule(settings, new SettingsFilter(settings)), new ThreadPoolModule(new ThreadPool(settings)), new IndicesModule() { @Override diff --git a/core/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTests.java b/core/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTests.java index 90ef9639e49..78379260b72 100644 --- a/core/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTests.java @@ -32,6 +32,7 @@ import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.inject.multibindings.Multibinder; import org.elasticsearch.common.inject.util.Providers; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; @@ -95,7 +96,7 @@ public class TemplateQueryParserTests extends ESTestCase { IndexSettings idxSettings = IndexSettingsModule.newIndexSettings(index, settings); injector = new ModulesBuilder().add( new EnvironmentModule(new Environment(settings)), - new SettingsModule(settings), + new SettingsModule(settings, new SettingsFilter(settings)), new ThreadPoolModule(new ThreadPool(settings)), new IndicesModule() { @Override diff --git a/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java b/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java index f386e829c64..02fad319846 100644 --- a/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java +++ b/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java @@ -24,6 +24,7 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; import org.elasticsearch.env.EnvironmentModule; @@ -55,7 +56,7 @@ public class NativeScriptTests extends ESTestCase { Injector injector = new ModulesBuilder().add( new EnvironmentModule(new Environment(settings)), new ThreadPoolModule(new ThreadPool(settings)), - new SettingsModule(settings), + new SettingsModule(settings, new SettingsFilter(settings)), scriptModule).createInjector(); ScriptService scriptService = injector.getInstance(ScriptService.class); diff --git a/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java b/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java index b52eec448c5..891ebf7e2d1 100644 --- a/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java @@ -31,6 +31,7 @@ import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.*; @@ -79,7 +80,7 @@ public class SearchSourceBuilderTests extends ESTestCase { .put("path.home", createTempDir()) .build(); injector = new ModulesBuilder().add( - new SettingsModule(settings), + new SettingsModule(settings, new SettingsFilter(settings)), new ThreadPoolModule(new ThreadPool(settings)), new IndicesModule() { @Override