diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java index efd364a07fd..83beb0016a9 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java @@ -148,7 +148,7 @@ public class PutRepositoryRequest extends AcknowledgedRequest * The settings to create the index with (either json/yaml/properties format) */ public CreateIndexRequest settings(String source) { - this.settings = Settings.settingsBuilder().loadFromSource(source).build(); + this.settings = Settings.builder().loadFromSource(source).build(); return this; } diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java b/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java index fb4525a6842..494b9df7bd3 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java @@ -124,7 +124,7 @@ public class UpdateSettingsRequest extends AcknowledgedRequest, FromXContentBuild } public Builder numberOfShards(int numberOfShards) { - settings = settingsBuilder().put(settings).put(SETTING_NUMBER_OF_SHARDS, numberOfShards).build(); + settings = Settings.builder().put(settings).put(SETTING_NUMBER_OF_SHARDS, numberOfShards).build(); return this; } @@ -703,7 +702,7 @@ public class IndexMetaData implements Diffable, FromXContentBuild } public Builder numberOfReplicas(int numberOfReplicas) { - settings = settingsBuilder().put(settings).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas).build(); + settings = Settings.builder().put(settings).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas).build(); return this; } @@ -712,7 +711,7 @@ public class IndexMetaData implements Diffable, FromXContentBuild } public Builder creationDate(long creationDate) { - settings = settingsBuilder().put(settings).put(SETTING_CREATION_DATE, creationDate).build(); + settings = Settings.builder().put(settings).put(SETTING_CREATION_DATE, creationDate).build(); return this; } @@ -989,7 +988,7 @@ public class IndexMetaData implements Diffable, FromXContentBuild currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { if (KEY_SETTINGS.equals(currentFieldName)) { - builder.settings(Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered()))); + builder.settings(Settings.builder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered()))); } else if (KEY_MAPPINGS.equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java b/core/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java index 5b70f6820b1..6ae9a6746e5 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java @@ -376,7 +376,7 @@ public class IndexTemplateMetaData extends AbstractDiffable, Diffable, Fr this.version = version; this.transientSettings = transientSettings; this.persistentSettings = persistentSettings; - this.settings = Settings.settingsBuilder().put(persistentSettings).put(transientSettings).build(); + this.settings = Settings.builder().put(persistentSettings).put(transientSettings).build(); this.indices = indices; this.customs = customs; this.templates = templates; @@ -925,7 +924,7 @@ public class MetaData implements Iterable, Diffable, Fr throw new IndexNotFoundException(index); } put(IndexMetaData.builder(indexMetaData) - .settings(settingsBuilder().put(indexMetaData.getSettings()).put(settings))); + .settings(Settings.builder().put(indexMetaData.getSettings()).put(settings))); } return this; } @@ -1124,7 +1123,7 @@ public class MetaData implements Iterable, Diffable, Fr currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { if ("settings".equals(currentFieldName)) { - builder.persistentSettings(Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build()); + builder.persistentSettings(Settings.builder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build()); } else if ("indices".equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { builder.put(IndexMetaData.Builder.fromXContent(parser), false); diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java index e85ef9e4bc9..6c2b3e5f728 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java @@ -86,7 +86,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_INDEX_UUI import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_CREATED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * Service responsible for submitting create index requests @@ -175,7 +174,7 @@ public class MetaDataCreateIndexService extends AbstractComponent { } public void createIndex(final CreateIndexClusterStateUpdateRequest request, final ActionListener listener) { - Settings.Builder updatedSettingsBuilder = Settings.settingsBuilder(); + Settings.Builder updatedSettingsBuilder = Settings.builder(); updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); indexScopedSettings.validate(updatedSettingsBuilder); request.settings(updatedSettingsBuilder.build()); @@ -265,7 +264,7 @@ public class MetaDataCreateIndexService extends AbstractComponent { } } - Settings.Builder indexSettingsBuilder = settingsBuilder(); + Settings.Builder indexSettingsBuilder = Settings.builder(); // apply templates, here, in reverse order, since first ones are better matching for (int i = templates.size() - 1; i >= 0; i--) { indexSettingsBuilder.put(templates.get(i).settings()); diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java index 1206185a609..0b3652b3672 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java @@ -106,7 +106,7 @@ public class MetaDataIndexTemplateService extends AbstractComponent { } public void putTemplate(final PutRequest request, final PutListener listener) { - Settings.Builder updatedSettingsBuilder = Settings.settingsBuilder(); + Settings.Builder updatedSettingsBuilder = Settings.builder(); updatedSettingsBuilder.put(request.settings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); request.settings(updatedSettingsBuilder.build()); diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java index e1b0415fbd0..3daf6c4dd3a 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java @@ -52,8 +52,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - /** * Service responsible for submitting update index settings requests */ @@ -124,7 +122,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements if (nrReplicasChanged.size() > 0) { // update settings and kick of a reroute (implicit) for them to take effect for (final Integer fNumberOfReplicas : nrReplicasChanged.keySet()) { - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, fNumberOfReplicas).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, fNumberOfReplicas).build(); final List indices = nrReplicasChanged.get(fNumberOfReplicas); UpdateSettingsClusterStateUpdateRequest updateRequest = new UpdateSettingsClusterStateUpdateRequest() @@ -152,7 +150,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements } public void updateSettings(final UpdateSettingsClusterStateUpdateRequest request, final ActionListener listener) { - final Settings normalizedSettings = Settings.settingsBuilder().put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); + final Settings normalizedSettings = Settings.builder().put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); Settings.Builder settingsForClosedIndices = Settings.builder(); Settings.Builder settingsForOpenIndices = Settings.builder(); Settings.Builder skipppedSettings = Settings.builder(); @@ -316,7 +314,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements if (Version.CURRENT.equals(indexMetaData.getCreationVersion()) == false) { // No reason to pollute the settings, we didn't really upgrade anything metaDataBuilder.put(IndexMetaData.builder(indexMetaData) - .settings(settingsBuilder().put(indexMetaData.getSettings()) + .settings(Settings.builder().put(indexMetaData.getSettings()) .put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE, entry.getValue().v2()) .put(IndexMetaData.SETTING_VERSION_UPGRADED, entry.getValue().v1()) ) diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java b/core/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java index b5646e17f9a..aa8f204953a 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java @@ -154,7 +154,7 @@ public class RepositoriesMetaData extends AbstractDiffable implements Me if (parser.nextToken() != XContentParser.Token.START_OBJECT) { throw new ElasticsearchParseException("failed to parse repository [{}], incompatible params", name); } - settings = Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build(); + settings = Settings.builder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build(); } else { throw new ElasticsearchParseException("failed to parse repository [{}], unknown field [{}]", name, currentFieldName); } diff --git a/core/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java b/core/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java index da628b09d2b..eba89c2e02a 100644 --- a/core/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java +++ b/core/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java @@ -43,7 +43,6 @@ import java.util.Set; import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.common.Strings.cleanPath; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * Configures log4j with a special set of replacements. @@ -106,7 +105,7 @@ public class LogConfigurator { // TODO: this is partly a copy of InternalSettingsPreparer...we should pass in Environment and not do all this... Environment environment = new Environment(settings); - Settings.Builder settingsBuilder = settingsBuilder(); + Settings.Builder settingsBuilder = Settings.builder(); if (resolveConfig) { resolveConfig(environment, settingsBuilder); } diff --git a/core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java b/core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java index 358706c9d3f..00dd235aee9 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java +++ b/core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java @@ -427,7 +427,7 @@ public abstract class AbstractScopedSettings extends AbstractComponent { private boolean updateSettings(Settings toApply, Settings.Builder target, Settings.Builder updates, String type, boolean onlyDynamic) { boolean changed = false; final Set toRemove = new HashSet<>(); - Settings.Builder settingsBuilder = Settings.settingsBuilder(); + Settings.Builder settingsBuilder = Settings.builder(); for (Map.Entry entry : toApply.getAsMap().entrySet()) { if (entry.getValue() == null) { toRemove.add(entry.getKey()); diff --git a/core/src/main/java/org/elasticsearch/common/settings/Settings.java b/core/src/main/java/org/elasticsearch/common/settings/Settings.java index ce79bf92d20..5608eca394a 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/Settings.java +++ b/core/src/main/java/org/elasticsearch/common/settings/Settings.java @@ -735,14 +735,10 @@ public final class Settings implements ToXContent { } } - public static Builder builder() { - return new Builder(); - } - /** * Returns a builder to be used in order to build settings. */ - public static Builder settingsBuilder() { + public static Builder builder() { return new Builder(); } @@ -771,7 +767,7 @@ public final class Settings implements ToXContent { /** * A builder allowing to put different settings and then {@link #build()} an immutable - * settings implementation. Use {@link Settings#settingsBuilder()} in order to + * settings implementation. Use {@link Settings#builder()} in order to * construct it. */ public static class Builder { 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 29532c53bab..636b1e40afc 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java +++ b/core/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java @@ -97,7 +97,7 @@ public final class SettingsFilter extends AbstractComponent { } private static Settings filterSettings(Iterable patterns, Settings settings) { - Settings.Builder builder = Settings.settingsBuilder().put(settings); + Settings.Builder builder = Settings.builder().put(settings); List simpleMatchPatternList = new ArrayList<>(); for (String pattern : patterns) { if (Regex.isSimpleMatchPattern(pattern)) { diff --git a/core/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java b/core/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java index 20a1d341cf9..02aca17e03c 100644 --- a/core/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java +++ b/core/src/main/java/org/elasticsearch/indices/analysis/AnalysisModule.java @@ -73,7 +73,7 @@ import java.util.Map; public final class AnalysisModule extends AbstractModule { static { - Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .build(); diff --git a/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java b/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java index 75c15f09778..d2da2a5d672 100644 --- a/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java +++ b/core/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java @@ -213,12 +213,12 @@ public class HunspellService extends AbstractComponent { private static Settings loadDictionarySettings(Path dir, Settings defaults) { Path file = dir.resolve("settings.yml"); if (Files.exists(file)) { - return Settings.settingsBuilder().loadFromPath(file).put(defaults).build(); + return Settings.builder().loadFromPath(file).put(defaults).build(); } file = dir.resolve("settings.json"); if (Files.exists(file)) { - return Settings.settingsBuilder().loadFromPath(file).put(defaults).build(); + return Settings.builder().loadFromPath(file).put(defaults).build(); } return defaults; diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 79dd7e1519e..f58b2676cf5 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -121,8 +121,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.function.Function; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - /** * A node represent a node within a cluster (cluster.name). The {@link #client()} can be used * in order to use a {@link Client} to perform actions/operations against the cluster. @@ -162,7 +160,7 @@ public class Node implements Closeable { } protected Node(Environment tmpEnv, Version version, Collection> classpathPlugins) { - Settings tmpSettings = settingsBuilder().put(tmpEnv.settings()) + Settings tmpSettings = Settings.builder().put(tmpEnv.settings()) .put(Client.CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE).build(); tmpSettings = TribeService.processSettings(tmpSettings); diff --git a/core/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java b/core/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java index 8864a70ccdc..124c8b2dbdd 100644 --- a/core/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java +++ b/core/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java @@ -45,7 +45,6 @@ import java.util.Map; import java.util.Set; import static org.elasticsearch.common.Strings.cleanPath; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * @@ -65,7 +64,7 @@ public class InternalSettingsPreparer { * Prepares the settings by gathering all elasticsearch system properties and setting defaults. */ public static Settings prepareSettings(Settings input) { - Settings.Builder output = settingsBuilder(); + Settings.Builder output = Settings.builder(); initializeSettings(output, input, true); finalizeSettings(output, null, null); return output.build(); @@ -82,7 +81,7 @@ public class InternalSettingsPreparer { */ public static Environment prepareEnvironment(Settings input, Terminal terminal) { // just create enough settings to build the environment, to get the config dir - Settings.Builder output = settingsBuilder(); + Settings.Builder output = Settings.builder(); initializeSettings(output, input, true); Environment environment = new Environment(output.build()); diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java index c1f3043cd32..f373da6987d 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -238,7 +238,7 @@ public class PluginsService extends AbstractComponent { public Settings updatedSettings() { Map foundSettings = new HashMap<>(); - final Settings.Builder builder = Settings.settingsBuilder(); + final Settings.Builder builder = Settings.builder(); for (Tuple plugin : plugins) { Settings settings = plugin.v2().additionalSettings(); for (String setting : settings.getAsMap().keySet()) { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java index 4477ff25011..5bd102594d7 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java @@ -67,10 +67,10 @@ public class RestUpdateSettingsAction extends BaseRestHandler { updateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", updateSettingsRequest.masterNodeTimeout())); updateSettingsRequest.indicesOptions(IndicesOptions.fromRequest(request, updateSettingsRequest.indicesOptions())); - Settings.Builder updateSettings = Settings.settingsBuilder(); + Settings.Builder updateSettings = Settings.builder(); String bodySettingsStr = request.content().toUtf8(); if (Strings.hasText(bodySettingsStr)) { - Settings buildSettings = Settings.settingsBuilder().loadFromSource(bodySettingsStr).build(); + Settings buildSettings = Settings.builder().loadFromSource(bodySettingsStr).build(); for (Map.Entry entry : buildSettings.getAsMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); diff --git a/core/src/main/java/org/elasticsearch/snapshots/RestoreService.java b/core/src/main/java/org/elasticsearch/snapshots/RestoreService.java index 0f03fa6ad9e..a51cf29df1d 100644 --- a/core/src/main/java/org/elasticsearch/snapshots/RestoreService.java +++ b/core/src/main/java/org/elasticsearch/snapshots/RestoreService.java @@ -255,7 +255,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis createIndexService.validateIndexName(renamedIndexName, currentState); createIndexService.validateIndexSettings(renamedIndexName, snapshotIndexMetaData.getSettings()); IndexMetaData.Builder indexMdBuilder = IndexMetaData.builder(snapshotIndexMetaData).state(IndexMetaData.State.OPEN).index(renamedIndexName); - indexMdBuilder.settings(Settings.settingsBuilder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, Strings.randomBase64UUID())); + indexMdBuilder.settings(Settings.builder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, Strings.randomBase64UUID())); if (!request.includeAliases() && !snapshotIndexMetaData.getAliases().isEmpty()) { // Remove all aliases - they shouldn't be restored indexMdBuilder.removeAllAliases(); @@ -291,7 +291,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis aliases.add(alias.value); } } - indexMdBuilder.settings(Settings.settingsBuilder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, currentIndexMetaData.getIndexUUID())); + indexMdBuilder.settings(Settings.builder().put(snapshotIndexMetaData.getSettings()).put(IndexMetaData.SETTING_INDEX_UUID, currentIndexMetaData.getIndexUUID())); IndexMetaData updatedIndexMetaData = indexMdBuilder.index(renamedIndexName).build(); rtBuilder.addAsRestore(updatedIndexMetaData, restoreSource); blocks.updateBlocks(updatedIndexMetaData); @@ -388,7 +388,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis if (changeSettings.names().isEmpty() && ignoreSettings.length == 0) { return indexMetaData; } - Settings normalizedChangeSettings = Settings.settingsBuilder().put(changeSettings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); + Settings normalizedChangeSettings = Settings.builder().put(changeSettings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); IndexMetaData.Builder builder = IndexMetaData.builder(indexMetaData); Map settingsMap = new HashMap<>(indexMetaData.getSettings().getAsMap()); List simpleMatchPatterns = new ArrayList<>(); diff --git a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index b223b477740..30881073397 100644 --- a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -65,7 +65,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import static java.util.Collections.unmodifiableMap; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.unit.SizeValue.parseSizeValue; import static org.elasticsearch.common.unit.TimeValue.timeValueMinutes; @@ -181,7 +180,7 @@ public class ThreadPool extends AbstractComponent implements Closeable { } public Settings build() { - return settingsBuilder().put(settings).build(); + return Settings.builder().put(settings).build(); } } diff --git a/core/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java b/core/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java index 5315d536f80..9453eaae222 100644 --- a/core/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java +++ b/core/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java @@ -126,7 +126,6 @@ import static org.elasticsearch.common.settings.Setting.boolSetting; import static org.elasticsearch.common.settings.Setting.byteSizeSetting; import static org.elasticsearch.common.settings.Setting.intSetting; import static org.elasticsearch.common.settings.Setting.timeSetting; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.transport.NetworkExceptionHelper.isCloseConnectionException; import static org.elasticsearch.common.transport.NetworkExceptionHelper.isConnectException; import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.newConcurrentMap; @@ -337,7 +336,7 @@ public class NettyTransport extends AbstractLifecycleComponent implem profileSettings.toDelimitedString(',')); continue; } else if (TransportSettings.DEFAULT_PROFILE.equals(name)) { - profileSettings = settingsBuilder() + profileSettings = Settings.builder() .put(profileSettings) .put("port", profileSettings.get("port", TransportSettings.PORT.get(this.settings))) .build(); @@ -348,7 +347,7 @@ public class NettyTransport extends AbstractLifecycleComponent implem } // merge fallback settings with default settings with profile settings so we have complete settings with default values - Settings mergedSettings = settingsBuilder() + Settings mergedSettings = Settings.builder() .put(fallbackSettings) .put(defaultSettings) .put(profileSettings) @@ -414,7 +413,7 @@ public class NettyTransport extends AbstractLifecycleComponent implem } private Settings createFallbackSettings() { - Settings.Builder fallbackSettingsBuilder = settingsBuilder(); + Settings.Builder fallbackSettingsBuilder = Settings.builder(); List fallbackBindHost = TransportSettings.BIND_HOST.get(settings); if (fallbackBindHost.isEmpty() == false) { diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java index d2e678ca311..f9b5855f39c 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java @@ -52,7 +52,7 @@ public final class ClusterAllocationExplainIT extends ESIntegTestCase { }); logger.info("--> creating 'test' index"); - prepareCreate("test").setSettings(Settings.settingsBuilder() + prepareCreate("test").setSettings(Settings.builder() .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "1m") .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 5) .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1)).get(); diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java index 503db65e810..0aa5691dc67 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksIT.java @@ -45,7 +45,7 @@ public class RepositoryBlocksIT extends ESIntegTestCase { assertBlocked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(Settings.settingsBuilder().put("location", randomRepoPath())), MetaData.CLUSTER_READ_ONLY_BLOCK); + .setSettings(Settings.builder().put("location", randomRepoPath())), MetaData.CLUSTER_READ_ONLY_BLOCK); } finally { setClusterReadOnly(false); } @@ -54,14 +54,14 @@ public class RepositoryBlocksIT extends ESIntegTestCase { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.builder().put("location", randomRepoPath()))); } public void testVerifyRepositoryWithBlocks() { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.builder().put("location", randomRepoPath()))); // This test checks that the Get Repository operation is never blocked, even if the cluster is read only. try { @@ -77,7 +77,7 @@ public class RepositoryBlocksIT extends ESIntegTestCase { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.builder().put("location", randomRepoPath()))); logger.info("--> deleting a repository is blocked when the cluster is read only"); try { @@ -95,7 +95,7 @@ public class RepositoryBlocksIT extends ESIntegTestCase { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.builder().put("location", randomRepoPath()))); // This test checks that the Get Repository operation is never blocked, even if the cluster is read only. try { diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java index 82a2637d76b..10d8659cf2c 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksIT.java @@ -69,7 +69,7 @@ public class SnapshotBlocksIT extends ESIntegTestCase { logger.info("--> register a repository"); assertAcked(client().admin().cluster().preparePutRepository(REPOSITORY_NAME) .setType("fs") - .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.builder().put("location", randomRepoPath()))); logger.info("--> verify the repository"); VerifyRepositoryResponse verifyResponse = client().admin().cluster().prepareVerifyRepository(REPOSITORY_NAME).get(); diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java index b0db0c97226..1be7c626502 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIT.java @@ -38,7 +38,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -159,7 +158,7 @@ public class ClusterStatsIT extends ESIntegTestCase { public void testValuesSmokeScreen() throws IOException { internalCluster().ensureAtMostNumDataNodes(5); internalCluster().ensureAtLeastNumDataNodes(1); - assertAcked(prepareCreate("test1").setSettings(settingsBuilder().put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0).build())); + assertAcked(prepareCreate("test1").setSettings(Settings.builder().put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0).build())); index("test1", "type", "1", "f", "f"); /* * Ensure at least one shard is allocated otherwise the FS stats might diff --git a/core/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java b/core/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java index ed4e8cd387e..ff7faab1f6a 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java +++ b/core/src/test/java/org/elasticsearch/action/admin/indices/TransportAnalyzeActionTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.analysis.AnalysisRegistry; import org.elasticsearch.index.analysis.AnalysisService; @@ -36,8 +35,6 @@ import org.elasticsearch.test.IndexSettingsModule; import java.io.IOException; import java.util.List; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - public class TransportAnalyzeActionTests extends ESTestCase { private AnalysisService analysisService; @@ -49,7 +46,7 @@ public class TransportAnalyzeActionTests extends ESTestCase { super.setUp(); Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build(); - Settings indexSettings = settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.filter.wordDelimiter.type", "word_delimiter") .put("index.analysis.filter.wordDelimiter.split_on_numerics", false) diff --git a/core/src/test/java/org/elasticsearch/action/admin/indices/template/put/MetaDataIndexTemplateServiceTests.java b/core/src/test/java/org/elasticsearch/action/admin/indices/template/put/MetaDataIndexTemplateServiceTests.java index 54bf0115d87..0dcbd82d56a 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/indices/template/put/MetaDataIndexTemplateServiceTests.java +++ b/core/src/test/java/org/elasticsearch/action/admin/indices/template/put/MetaDataIndexTemplateServiceTests.java @@ -48,7 +48,7 @@ public class MetaDataIndexTemplateServiceTests extends ESTestCase { Map map = new HashMap<>(); map.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "0"); - request.settings(Settings.settingsBuilder().put(map).build()); + request.settings(Settings.builder().put(map).build()); List throwables = putTemplate(request); assertEquals(throwables.size(), 1); @@ -62,7 +62,7 @@ public class MetaDataIndexTemplateServiceTests extends ESTestCase { Map map = new HashMap<>(); map.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "0"); - request.settings(Settings.settingsBuilder().put(map).build()); + request.settings(Settings.builder().put(map).build()); List throwables = putTemplate(request); assertEquals(throwables.size(), 1); diff --git a/core/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsIT.java b/core/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsIT.java index 35fb73b7bfa..48d989209cb 100644 --- a/core/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsIT.java +++ b/core/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsIT.java @@ -28,7 +28,7 @@ import org.elasticsearch.test.ESIntegTestCase.Scope; public class BulkProcessorClusterSettingsIT extends ESIntegTestCase { public void testBulkProcessorAutoCreateRestrictions() throws Exception { // See issue #8125 - Settings settings = Settings.settingsBuilder().put("action.auto_create_index", false).build(); + Settings settings = Settings.builder().put("action.auto_create_index", false).build(); internalCluster().startNode(settings); diff --git a/core/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTestCase.java b/core/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTestCase.java index cf4690e3616..fb23f024b5d 100644 --- a/core/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTestCase.java +++ b/core/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTestCase.java @@ -208,7 +208,7 @@ public abstract class AbstractTermVectorsTestCase extends ESIntegTestCase { field.addToMappings(mappingBuilder); } mappingBuilder.endObject().endObject().endObject(); - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.tv_test.tokenizer", "standard") .putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase"); diff --git a/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java b/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java index c637e49bae0..12af9f8a2c2 100644 --- a/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java +++ b/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java @@ -37,7 +37,6 @@ import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.engine.VersionConflictEngineException; import org.elasticsearch.index.mapper.FieldMapper; import org.hamcrest.Matcher; @@ -52,7 +51,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows; @@ -198,7 +196,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { .endObject().endObject(); assertAcked(prepareCreate("test").addMapping("type1", mapping) .addAlias(new Alias("alias")) - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.tv_test.tokenizer", "whitespace") .putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase"))); @@ -285,7 +283,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { .endObject() .endObject().endObject(); assertAcked(prepareCreate("test").addMapping("type1", mapping) - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put("index.analysis.analyzer.tv_test.tokenizer", "whitespace") .putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase"))); ensureYellow(); @@ -431,7 +429,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { .startObject("field").field("type", "text").field("term_vector", "with_positions_offsets_payloads") .field("analyzer", "payload_test").endObject().endObject().endObject().endObject(); assertAcked(prepareCreate("test").addMapping("type1", mapping).setSettings( - settingsBuilder() + Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.payload_test.tokenizer", "whitespace") .putArray("index.analysis.analyzer.payload_test.filter", "my_delimited_payload_filter") @@ -597,7 +595,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { assertAcked(prepareCreate("test") .addMapping("type1", mapping) - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.tv_test.tokenizer", "whitespace") .putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase"))); @@ -785,7 +783,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { public void testArtificialVsExisting() throws ExecutionException, InterruptedException, IOException { // setup indices - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer", "standard"); assertAcked(prepareCreate("test") @@ -843,7 +841,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { public void testArtificialNoDoc() throws IOException { // setup indices - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer", "standard"); assertAcked(prepareCreate("test") @@ -891,7 +889,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { mapping.endObject().endObject().endObject(); // setup indices with mapping - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer", "standard"); assertAcked(prepareCreate("test") @@ -982,7 +980,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { public void testTermVectorsWithVersion() { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen(); TermVectorsResponse response = client().prepareTermVectors("test", "type1", "1").get(); @@ -1085,7 +1083,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { public void testFilterLength() throws ExecutionException, InterruptedException, IOException { logger.info("Setting up the index ..."); - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer", "keyword"); assertAcked(prepareCreate("test") @@ -1123,7 +1121,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { public void testFilterTermFreq() throws ExecutionException, InterruptedException, IOException { logger.info("Setting up the index ..."); - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer", "keyword"); assertAcked(prepareCreate("test") @@ -1163,7 +1161,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase { public void testFilterDocFreq() throws ExecutionException, InterruptedException, IOException { logger.info("Setting up the index ..."); - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer", "keyword") .put("index.number_of_shards", 1); // no dfs diff --git a/core/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsIT.java b/core/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsIT.java index 516eaf371e0..57a89c82cc8 100644 --- a/core/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsIT.java +++ b/core/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsIT.java @@ -85,7 +85,7 @@ public class MultiTermVectorsIT extends AbstractTermVectorsTestCase { public void testMultiTermVectorsWithVersion() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen(); MultiTermVectorsResponse response = client().prepareMultiTermVectors().add(indexOrAlias(), "type1", "1").get(); diff --git a/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java b/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java index 539c65c6193..b2a3a8b222f 100644 --- a/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java +++ b/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java @@ -35,6 +35,7 @@ import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.cluster.metadata.AliasOrIndex; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.StopWatch; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; @@ -64,7 +65,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_ME import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_READ; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_WRITE; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery; import static org.elasticsearch.index.query.QueryBuilders.hasParentQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -447,7 +447,7 @@ public class IndexAliasesIT extends ESIntegTestCase { public void testWaitForAliasCreationSingleShard() throws Exception { logger.info("--> creating index [test]"); - assertAcked(admin().indices().create(createIndexRequest("test").settings(settingsBuilder().put("index.number_of_replicas", 0).put("index.number_of_shards", 1))).get()); + assertAcked(admin().indices().create(createIndexRequest("test").settings(Settings.builder().put("index.number_of_replicas", 0).put("index.number_of_shards", 1))).get()); ensureGreen(); diff --git a/core/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java b/core/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java index f7270ca2c3d..ffe82f9388d 100644 --- a/core/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java +++ b/core/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java @@ -27,11 +27,11 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase; import java.util.HashMap; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.notNullValue; @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST) @@ -83,11 +83,11 @@ public class SimpleBlocksIT extends ESIntegTestCase { canCreateIndex("test1"); canIndexDocument("test1"); client().admin().indices().prepareUpdateSettings("test1") - .setSettings(settingsBuilder().put(IndexMetaData.SETTING_BLOCKS_WRITE, true)) + .setSettings(Settings.builder().put(IndexMetaData.SETTING_BLOCKS_WRITE, true)) .execute().actionGet(); canNotIndexDocument("test1"); client().admin().indices().prepareUpdateSettings("test1") - .setSettings(settingsBuilder().put(IndexMetaData.SETTING_BLOCKS_WRITE, false)) + .setSettings(Settings.builder().put(IndexMetaData.SETTING_BLOCKS_WRITE, false)) .execute().actionGet(); canIndexDocument("test1"); } diff --git a/core/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatIT.java b/core/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatIT.java index 108fcefecd4..81d894e3349 100644 --- a/core/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatIT.java +++ b/core/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatIT.java @@ -99,7 +99,7 @@ public class ClusterStateBackwardsCompatIT extends ESBackcompatTestCase { } private TransportClient newTransportClient() { - Settings settings = Settings.settingsBuilder().put("client.transport.ignore_cluster_name", true) + Settings settings = Settings.builder().put("client.transport.ignore_cluster_name", true) .put("node.name", "transport_client_" + getTestName()).build(); return TransportClient.builder().settings(settings).build(); } diff --git a/core/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatIT.java b/core/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatIT.java index 29d4fdeb3b5..c9d5f0b622e 100644 --- a/core/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatIT.java +++ b/core/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatIT.java @@ -38,7 +38,7 @@ public class NodesStatsBasicBackwardsCompatIT extends ESBackcompatTestCase { NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet(); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("client.transport.ignore_cluster_name", true) .put("node.name", "transport_client_" + getTestName()).build(); @@ -56,7 +56,7 @@ public class NodesStatsBasicBackwardsCompatIT extends ESBackcompatTestCase { NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet(); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("node.name", "transport_client_" + getTestName()) .put("client.transport.ignore_cluster_name", true).build(); diff --git a/core/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatIT.java b/core/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatIT.java index 5b81621e6dd..a2811f60ac9 100644 --- a/core/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatIT.java +++ b/core/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatIT.java @@ -52,7 +52,6 @@ import java.util.Locale; import java.util.SortedSet; import java.util.TreeSet; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -66,7 +65,7 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { if (randomBoolean()) { // Configure using path.repo - return settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(Environment.PATH_REPO_SETTING.getKey(), getBwcIndicesPath()) .build(); @@ -74,7 +73,7 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase { // Configure using url white list try { URI repoJarPatternUri = new URI("jar:" + getBwcIndicesPath().toUri().toString() + "*.zip!/repo/"); - return settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .putArray(URLRepository.ALLOWED_URLS_SETTING.getKey(), repoJarPatternUri.toString()) .build(); @@ -159,7 +158,7 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase { URI repoJarUri = new URI("jar:" + repoFileUri.toString() + "!/repo/"); logger.info("--> creating repository [{}] for version [{}]", repo, version); assertAcked(client().admin().cluster().preparePutRepository(repo) - .setType("url").setSettings(settingsBuilder() + .setType("url").setSettings(Settings.builder() .put("url", repoJarUri.toString()))); } diff --git a/core/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityIT.java b/core/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityIT.java index d6eea58cb7b..a5f6931f835 100644 --- a/core/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityIT.java +++ b/core/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityIT.java @@ -38,7 +38,7 @@ public class UnicastBackwardsCompatibilityIT extends ESBackcompatTestCase { @Override protected Settings externalNodeSettings(int nodeOrdinal) { - return Settings.settingsBuilder() + return Settings.builder() .put(super.externalNodeSettings(nodeOrdinal)) .put(TransportSettings.PORT.getKey(), 9390 + nodeOrdinal) .put("discovery.zen.ping.unicast.hosts", "localhost:9380,localhost:9381,localhost:9390,localhost:9391") diff --git a/core/src/test/java/org/elasticsearch/client/node/NodeClientIT.java b/core/src/test/java/org/elasticsearch/client/node/NodeClientIT.java index ae839e8837e..073a2bfc0ae 100644 --- a/core/src/test/java/org/elasticsearch/client/node/NodeClientIT.java +++ b/core/src/test/java/org/elasticsearch/client/node/NodeClientIT.java @@ -24,7 +24,6 @@ import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; /** @@ -34,7 +33,7 @@ import static org.hamcrest.Matchers.is; public class NodeClientIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put(Client.CLIENT_TYPE_SETTING_S.getKey(), "anything").build(); + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(Client.CLIENT_TYPE_SETTING_S.getKey(), "anything").build(); } public void testThatClientTypeSettingCannotBeChanged() { diff --git a/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java b/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java index 079c4a65ec0..a62f15f9277 100644 --- a/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java +++ b/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java @@ -34,7 +34,6 @@ import org.elasticsearch.transport.TransportService; import java.io.IOException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; @@ -92,7 +91,7 @@ public class TransportClientIT extends ESIntegTestCase { } public void testThatTransportClientSettingCannotBeChanged() { - Settings baseSettings = settingsBuilder() + Settings baseSettings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .build(); try (TransportClient client = TransportClient.builder().settings(baseSettings).build()) { diff --git a/core/src/test/java/org/elasticsearch/client/transport/TransportClientRetryIT.java b/core/src/test/java/org/elasticsearch/client/transport/TransportClientRetryIT.java index e45b1685c5a..e9b6833bf32 100644 --- a/core/src/test/java/org/elasticsearch/client/transport/TransportClientRetryIT.java +++ b/core/src/test/java/org/elasticsearch/client/transport/TransportClientRetryIT.java @@ -38,7 +38,6 @@ import org.elasticsearch.transport.TransportService; import java.io.IOException; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -52,7 +51,7 @@ public class TransportClientRetryIT extends ESIntegTestCase { addresses[i++] = instance.boundAddress().publishAddress(); } - Settings.Builder builder = settingsBuilder().put("client.transport.nodes_sampler_interval", "1s") + Settings.Builder builder = Settings.builder().put("client.transport.nodes_sampler_interval", "1s") .put("node.name", "transport_client_retry_test") .put(Node.NODE_MODE_SETTING.getKey(), internalCluster().getNodeMode()) .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), internalCluster().getClusterName()) diff --git a/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java b/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java index 28b0b7e18cf..4338a43fa2d 100644 --- a/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceIT.java @@ -62,7 +62,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import static java.util.Collections.emptySet; import static java.util.Collections.unmodifiableSet; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.util.set.Sets.newHashSet; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.CoreMatchers.equalTo; @@ -139,7 +138,7 @@ public class ClusterInfoServiceIT extends ESIntegTestCase { public void testClusterInfoServiceCollectsInformation() throws Exception { internalCluster().startNodesAsync(2).get(); - assertAcked(prepareCreate("test").setSettings(settingsBuilder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0) .put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE).build())); ensureGreen("test"); diff --git a/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesIT.java b/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesIT.java index 991ed9ee883..61bb898acc2 100644 --- a/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesIT.java @@ -51,7 +51,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Predicate; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout; @@ -75,7 +74,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { public void testSimpleMinimumMasterNodes() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .put("discovery.zen.minimum_master_nodes", 2) .put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "200ms") @@ -187,7 +186,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { } public void testMultipleNodesShutdownNonMasterNodes() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .put("discovery.zen.minimum_master_nodes", 3) .put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "1s") @@ -263,7 +262,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { } public void testDynamicUpdateMinimumMasterNodes() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "400ms") .put("discovery.initial_state_timeout", "500ms") @@ -291,7 +290,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { assertNoMasterBlockOnAllNodes(); logger.info("--> bringing another node up"); - internalCluster().startNode(settingsBuilder().put(settings).put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 2).build()); + internalCluster().startNode(Settings.builder().put(settings).put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 2).build()); clusterHealthResponse = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes("2").get(); assertThat(clusterHealthResponse.isTimedOut(), equalTo(false)); } @@ -321,7 +320,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { public void testCanNotBringClusterDown() throws ExecutionException, InterruptedException { int nodeCount = scaledRandomIntBetween(1, 5); - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put("discovery.type", "zen") .put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "200ms") .put("discovery.initial_state_timeout", "500ms"); @@ -341,7 +340,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { logger.info("--> updating [{}] to [{}]", ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount); assertAcked(client().admin().cluster().prepareUpdateSettings() - .setPersistentSettings(settingsBuilder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount))); + .setPersistentSettings(Settings.builder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount))); logger.info("--> verifying no node left and master is up"); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes(Integer.toString(nodeCount)).get().isTimedOut()); @@ -350,7 +349,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { logger.info("--> trying to updating [{}] to [{}]", ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount); try { client().admin().cluster().prepareUpdateSettings() - .setPersistentSettings(settingsBuilder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount)); + .setPersistentSettings(Settings.builder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), updateCount)); } catch (IllegalArgumentException ex) { assertEquals(ex.getMessage(), "cannot set discovery.zen.minimum_master_nodes to more than the current master nodes count [" +updateCount+ "]"); } @@ -360,7 +359,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase { } public void testCanNotPublishWithoutMinMastNodes() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .put(FaultDetection.PING_TIMEOUT_SETTING.getKey(), "1h") // disable it .put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "200ms") diff --git a/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java b/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java index 13b1d40b5d3..99c46f1fc2e 100644 --- a/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java @@ -43,7 +43,6 @@ import org.elasticsearch.test.ESIntegTestCase.Scope; import java.util.HashMap; import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertExists; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows; @@ -61,7 +60,7 @@ public class NoMasterNodeIT extends ESIntegTestCase { boolean autoCreateIndex = randomBoolean(); logger.info("auto_create_index set to {}", autoCreateIndex); - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .put("action.auto_create_index", autoCreateIndex) .put("discovery.zen.minimum_master_nodes", 2) @@ -213,7 +212,7 @@ public class NoMasterNodeIT extends ESIntegTestCase { } public void testNoMasterActionsWriteMasterBlock() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .put("action.auto_create_index", false) .put("discovery.zen.minimum_master_nodes", 2) diff --git a/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java b/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java index 46c31cf58e3..43aa088a3b9 100644 --- a/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java @@ -23,13 +23,13 @@ import org.elasticsearch.action.UnavailableShardsException; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.client.Requests; import org.elasticsearch.common.Priority; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; import static org.elasticsearch.client.Requests.createIndexRequest; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; import static org.hamcrest.Matchers.equalTo; @@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo; @ClusterScope(scope= Scope.TEST, numDataNodes =0) public class SimpleDataNodesIT extends ESIntegTestCase { public void testDataNodes() throws Exception { - internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); + internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); client().admin().indices().create(createIndexRequest("test")).actionGet(); try { client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test")).timeout(timeValueSeconds(1))).actionGet(); @@ -48,7 +48,7 @@ public class SimpleDataNodesIT extends ESIntegTestCase { // all is well } - internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); + internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes("2").setLocal(true).execute().actionGet().isTimedOut(), equalTo(false)); // still no shard should be allocated @@ -60,7 +60,7 @@ public class SimpleDataNodesIT extends ESIntegTestCase { } // now, start a node data, and see that it gets with shards - internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), true).build()); + internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), true).build()); assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes("3").setLocal(true).execute().actionGet().isTimedOut(), equalTo(false)); IndexResponse indexResponse = client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); diff --git a/core/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationIT.java b/core/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationIT.java index 43a455cb84a..89f072e2a35 100644 --- a/core/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationIT.java @@ -21,14 +21,13 @@ package org.elasticsearch.cluster; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.common.Priority; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; -import java.util.List; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -36,14 +35,11 @@ import static org.hamcrest.Matchers.equalTo; @ClusterScope(scope= Scope.TEST, numDataNodes =0) public class UpdateSettingsValidationIT extends ESIntegTestCase { public void testUpdateSettingsValidation() throws Exception { - List nodes = internalCluster().startNodesAsync( - settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build(), - settingsBuilder().put(Node.NODE_MASTER_SETTING.getKey(), false).build(), - settingsBuilder().put(Node.NODE_MASTER_SETTING.getKey(), false).build() + internalCluster().startNodesAsync( + Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build(), + Settings.builder().put(Node.NODE_MASTER_SETTING.getKey(), false).build(), + Settings.builder().put(Node.NODE_MASTER_SETTING.getKey(), false).build() ).get(); - String master = nodes.get(0); - String node_1 = nodes.get(1); - String node_2 = nodes.get(2); createIndex("test"); NumShards test = getNumShards("test"); @@ -52,13 +48,13 @@ public class UpdateSettingsValidationIT extends ESIntegTestCase { assertThat(healthResponse.isTimedOut(), equalTo(false)); assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(test.totalNumShards)); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.number_of_replicas", 0)).execute().actionGet(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.number_of_replicas", 0)).execute().actionGet(); healthResponse = client().admin().cluster().prepareHealth("test").setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); assertThat(healthResponse.getIndices().get("test").getActiveShards(), equalTo(test.numPrimaries)); try { - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.refresh_interval", "")).execute().actionGet(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.refresh_interval", "")).execute().actionGet(); fail(); } catch (IllegalArgumentException ex) { logger.info("Error message: [{}]", ex.getMessage()); diff --git a/core/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java b/core/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java index 279e40bbc59..8e2dea63d6a 100644 --- a/core/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java @@ -36,7 +36,6 @@ import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -91,7 +90,7 @@ public class AckClusterUpdateSettingsIT extends ESIntegTestCase { assertNotNull(excludedNodeId); ClusterUpdateSettingsResponse clusterUpdateSettingsResponse = client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get(); + .setTransientSettings(Settings.builder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get(); assertAcked(clusterUpdateSettingsResponse); assertThat(clusterUpdateSettingsResponse.getTransientSettings().get("cluster.routing.allocation.exclude._id"), equalTo(excludedNodeId)); @@ -115,7 +114,7 @@ public class AckClusterUpdateSettingsIT extends ESIntegTestCase { public void testClusterUpdateSettingsNoAcknowledgement() { client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put("number_of_shards", between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS)) .put("number_of_replicas", 0)).get(); ensureGreen(); @@ -134,7 +133,7 @@ public class AckClusterUpdateSettingsIT extends ESIntegTestCase { assertNotNull(excludedNodeId); ClusterUpdateSettingsResponse clusterUpdateSettingsResponse = client().admin().cluster().prepareUpdateSettings().setTimeout("0s") - .setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get(); + .setTransientSettings(Settings.builder().put("cluster.routing.allocation.exclude._id", excludedNodeId)).get(); assertThat(clusterUpdateSettingsResponse.isAcknowledged(), equalTo(false)); assertThat(clusterUpdateSettingsResponse.getTransientSettings().get("cluster.routing.allocation.exclude._id"), equalTo(excludedNodeId)); } diff --git a/core/src/test/java/org/elasticsearch/cluster/ack/AckIT.java b/core/src/test/java/org/elasticsearch/cluster/ack/AckIT.java index eb58e597c14..fdf4dfaaae8 100644 --- a/core/src/test/java/org/elasticsearch/cluster/ack/AckIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/ack/AckIT.java @@ -47,7 +47,6 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; @@ -121,7 +120,7 @@ public class AckIT extends ESIntegTestCase { public void testClusterRerouteNoAcknowledgement() throws InterruptedException { client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS)) .put(SETTING_NUMBER_OF_REPLICAS, 0)).get(); ensureGreen(); @@ -134,7 +133,7 @@ public class AckIT extends ESIntegTestCase { public void testClusterRerouteAcknowledgementDryRun() throws InterruptedException { client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS)) .put(SETTING_NUMBER_OF_REPLICAS, 0)).get(); ensureGreen(); @@ -169,7 +168,7 @@ public class AckIT extends ESIntegTestCase { public void testClusterRerouteNoAcknowledgementDryRun() throws InterruptedException { client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS)) .put(SETTING_NUMBER_OF_REPLICAS, 0)).get(); ensureGreen(); diff --git a/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardFailedClusterStateTaskExecutorTests.java b/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardFailedClusterStateTaskExecutorTests.java index 29ce8e7a636..317bb6cfc47 100644 --- a/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardFailedClusterStateTaskExecutorTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardFailedClusterStateTaskExecutorTests.java @@ -55,7 +55,6 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.IntStream; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.not; @@ -73,7 +72,7 @@ public class ShardFailedClusterStateTaskExecutorTests extends ESAllocationTestCa @Before public void setUp() throws Exception { super.setUp(); - allocationService = createAllocationService(settingsBuilder() + allocationService = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 8) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationIT.java b/core/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationIT.java index d074ad15166..94863dc4f56 100644 --- a/core/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationIT.java @@ -38,7 +38,6 @@ import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import java.util.List; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; @@ -55,13 +54,13 @@ public class AwarenessAllocationIT extends ESIntegTestCase { } public void testSimpleAwareness() throws Exception { - Settings commonSettings = Settings.settingsBuilder() + Settings commonSettings = Settings.builder() .put("cluster.routing.allocation.awareness.attributes", "rack_id") .build(); logger.info("--> starting 2 nodes on the same rack"); - internalCluster().startNodesAsync(2, Settings.settingsBuilder().put(commonSettings).put("node.attr.rack_id", "rack_1").build()).get(); + internalCluster().startNodesAsync(2, Settings.builder().put(commonSettings).put("node.attr.rack_id", "rack_1").build()).get(); createIndex("test1"); createIndex("test2"); @@ -74,7 +73,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase { ensureGreen(); logger.info("--> starting 1 node on a different rack"); - final String node3 = internalCluster().startNode(Settings.settingsBuilder().put(commonSettings).put("node.attr.rack_id", "rack_2").build()); + final String node3 = internalCluster().startNode(Settings.builder().put(commonSettings).put("node.attr.rack_id", "rack_2").build()); // On slow machines the initial relocation might be delayed assertThat(awaitBusy( @@ -104,7 +103,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase { } public void testAwarenessZones() throws Exception { - Settings commonSettings = Settings.settingsBuilder() + Settings commonSettings = Settings.builder() .put(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP_SETTING.getKey() + "zone.values", "a,b") .put(AwarenessAllocationDecider.CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTE_SETTING.getKey(), "zone") .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 3) @@ -113,10 +112,10 @@ public class AwarenessAllocationIT extends ESIntegTestCase { logger.info("--> starting 4 nodes on different zones"); List nodes = internalCluster().startNodesAsync( - Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "a").build(), - Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build(), - Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build(), - Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "a").build() + Settings.builder().put(commonSettings).put("node.attr.zone", "a").build(), + Settings.builder().put(commonSettings).put("node.attr.zone", "b").build(), + Settings.builder().put(commonSettings).put("node.attr.zone", "b").build(), + Settings.builder().put(commonSettings).put("node.attr.zone", "a").build() ).get(); String A_0 = nodes.get(0); String B_0 = nodes.get(1); @@ -128,7 +127,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase { assertThat(health.isTimedOut(), equalTo(false)); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 5) + .setSettings(Settings.builder().put("index.number_of_shards", 5) .put("index.number_of_replicas", 1)).execute().actionGet(); logger.info("--> waiting for shards to be allocated"); @@ -152,20 +151,20 @@ public class AwarenessAllocationIT extends ESIntegTestCase { } public void testAwarenessZonesIncrementalNodes() throws Exception { - Settings commonSettings = Settings.settingsBuilder() + Settings commonSettings = Settings.builder() .put("cluster.routing.allocation.awareness.force.zone.values", "a,b") .put("cluster.routing.allocation.awareness.attributes", "zone") .build(); logger.info("--> starting 2 nodes on zones 'a' & 'b'"); List nodes = internalCluster().startNodesAsync( - Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "a").build(), - Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build() + Settings.builder().put(commonSettings).put("node.attr.zone", "a").build(), + Settings.builder().put(commonSettings).put("node.attr.zone", "b").build() ).get(); String A_0 = nodes.get(0); String B_0 = nodes.get(1); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 5) + .setSettings(Settings.builder().put("index.number_of_shards", 5) .put("index.number_of_replicas", 1)).execute().actionGet(); ClusterHealthResponse health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("2").setWaitForRelocatingShards(0).execute().actionGet(); assertThat(health.isTimedOut(), equalTo(false)); @@ -183,7 +182,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase { assertThat(counts.get(B_0), equalTo(5)); logger.info("--> starting another node in zone 'b'"); - String B_1 = internalCluster().startNode(Settings.settingsBuilder().put(commonSettings).put("node.attr.zone", "b").build()); + String B_1 = internalCluster().startNode(Settings.builder().put(commonSettings).put("node.attr.zone", "b").build()); health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet(); assertThat(health.isTimedOut(), equalTo(false)); client().admin().cluster().prepareReroute().get(); @@ -228,7 +227,7 @@ public class AwarenessAllocationIT extends ESIntegTestCase { assertThat(counts.get(B_0), equalTo(3)); assertThat(counts.get(B_1), equalTo(2)); assertThat(counts.containsKey(noZoneNode), equalTo(false)); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.settingsBuilder().put("cluster.routing.allocation.awareness.attributes", "").build()).get(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put("cluster.routing.allocation.awareness.attributes", "").build()).get(); health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForNodes("4").setWaitForActiveShards(10).setWaitForRelocatingShards(0).execute().actionGet(); diff --git a/core/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteIT.java b/core/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteIT.java index 1021cdbf848..a6bafb912a2 100644 --- a/core/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteIT.java @@ -58,7 +58,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_RE import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_WRITE; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked; import static org.hamcrest.Matchers.equalTo; @@ -71,7 +70,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { private final ESLogger logger = Loggers.getLogger(ClusterRerouteIT.class); public void testRerouteWithCommands_disableAllocationSettings() throws Exception { - Settings commonSettings = settingsBuilder() + Settings commonSettings = Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none") .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none") .build(); @@ -79,7 +78,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { } public void testRerouteWithCommands_enableAllocationSettings() throws Exception { - Settings commonSettings = settingsBuilder() + Settings commonSettings = Settings.builder() .put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.NONE.name()) .build(); rerouteWithCommands(commonSettings); @@ -92,7 +91,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { logger.info("--> create an index with 1 shard, 1 replica, nothing should allocate"); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 1)) + .setSettings(Settings.builder().put("index.number_of_shards", 1)) .execute().actionGet(); ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState(); @@ -147,7 +146,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { } public void testRerouteWithAllocateLocalGateway_disableAllocationSettings() throws Exception { - Settings commonSettings = settingsBuilder() + Settings commonSettings = Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none") .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none") .build(); @@ -155,14 +154,14 @@ public class ClusterRerouteIT extends ESIntegTestCase { } public void testRerouteWithAllocateLocalGateway_enableAllocationSettings() throws Exception { - Settings commonSettings = settingsBuilder() + Settings commonSettings = Settings.builder() .put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.NONE.name()) .build(); rerouteWithAllocateLocalGateway(commonSettings); } public void testDelayWithALargeAmountOfShards() throws Exception { - Settings commonSettings = settingsBuilder() + Settings commonSettings = Settings.builder() .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING.getKey(), 1) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 1) .build(); @@ -179,7 +178,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { logger.info("--> create indices"); for (int i = 0; i < 25; i++) { client().admin().indices().prepareCreate("test" + i) - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put("index.number_of_shards", 5).put("index.number_of_replicas", 1) .put("index.unassigned.node_left.delayed_timeout", randomIntBetween(250, 1000) + "ms")) .execute().actionGet(); @@ -204,7 +203,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { logger.info("--> create an index with 1 shard, 1 replica, nothing should allocate"); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 1)) + .setSettings(Settings.builder().put("index.number_of_shards", 1)) .execute().actionGet(); ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState(); @@ -264,7 +263,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { } public void testRerouteExplain() { - Settings commonSettings = settingsBuilder().build(); + Settings commonSettings = Settings.builder().build(); logger.info("--> starting a node"); String node_1 = internalCluster().startNode(commonSettings); @@ -275,13 +274,13 @@ public class ClusterRerouteIT extends ESIntegTestCase { logger.info("--> create an index with 1 shard"); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) + .setSettings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) .execute().actionGet(); ensureGreen("test"); logger.info("--> disable allocation"); - Settings newSettings = settingsBuilder() + Settings newSettings = Settings.builder() .put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.NONE.name()) .build(); client().admin().cluster().prepareUpdateSettings().setTransientSettings(newSettings).execute().actionGet(); @@ -309,7 +308,7 @@ public class ClusterRerouteIT extends ESIntegTestCase { List nodesIds = internalCluster().startNodesAsync(2).get(); logger.info("--> create an index with 1 shard and 0 replicas"); - assertAcked(prepareCreate("test-blocks").setSettings(settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0))); + assertAcked(prepareCreate("test-blocks").setSettings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0))); ensureGreen("test-blocks"); logger.info("--> check that the index has 1 shard"); diff --git a/core/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationIT.java b/core/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationIT.java index 6413cf7277c..4cc04086421 100644 --- a/core/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationIT.java @@ -26,6 +26,7 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -33,7 +34,6 @@ import org.elasticsearch.test.ESIntegTestCase.Scope; import java.util.List; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; @ClusterScope(scope= Scope.TEST, numDataNodes =0) @@ -50,7 +50,7 @@ public class FilteringAllocationIT extends ESIntegTestCase { logger.info("--> creating an index with no replicas"); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_replicas", 0)) + .setSettings(Settings.builder().put("index.number_of_replicas", 0)) .execute().actionGet(); ensureGreen(); logger.info("--> index some data"); @@ -62,7 +62,7 @@ public class FilteringAllocationIT extends ESIntegTestCase { logger.info("--> decommission the second node"); client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(settingsBuilder().put("cluster.routing.allocation.exclude._name", node_1)) + .setTransientSettings(Settings.builder().put("cluster.routing.allocation.exclude._name", node_1)) .execute().actionGet(); waitForRelocation(); @@ -89,7 +89,7 @@ public class FilteringAllocationIT extends ESIntegTestCase { logger.info("--> creating an index with no replicas"); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_replicas", 0)) + .setSettings(Settings.builder().put("index.number_of_replicas", 0)) .execute().actionGet(); ensureGreen(); @@ -113,13 +113,13 @@ public class FilteringAllocationIT extends ESIntegTestCase { if (numShardsOnNode1 > ThrottlingAllocationDecider.DEFAULT_CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES) { client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", numShardsOnNode1)).execute().actionGet(); + .setTransientSettings(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", numShardsOnNode1)).execute().actionGet(); // make sure we can recover all the nodes at once otherwise we might run into a state where one of the shards has not yet started relocating // but we already fired up the request to wait for 0 relocating shards. } logger.info("--> remove index from the first node"); client().admin().indices().prepareUpdateSettings("test") - .setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", node_0)) + .setSettings(Settings.builder().put("index.routing.allocation.exclude._name", node_0)) .execute().actionGet(); client().admin().cluster().prepareReroute().get(); ensureGreen(); @@ -135,7 +135,7 @@ public class FilteringAllocationIT extends ESIntegTestCase { logger.info("--> disable allocation filtering "); client().admin().indices().prepareUpdateSettings("test") - .setSettings(settingsBuilder().put("index.routing.allocation.exclude._name", "")) + .setSettings(Settings.builder().put("index.routing.allocation.exclude._name", "")) .execute().actionGet(); client().admin().cluster().prepareReroute().get(); ensureGreen(); diff --git a/core/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationIT.java b/core/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationIT.java index 565104b08eb..28aad61367d 100644 --- a/core/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationIT.java @@ -20,10 +20,10 @@ package org.elasticsearch.cluster.allocation; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.RoutingNode; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -54,7 +54,7 @@ public class SimpleAllocationIT extends ESIntegTestCase { assertThat(node.size(), equalTo(2)); } } - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, 0)).execute().actionGet(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, 0)).execute().actionGet(); ensureGreen(); state = client().admin().cluster().prepareState().execute().actionGet().getState(); @@ -69,7 +69,7 @@ public class SimpleAllocationIT extends ESIntegTestCase { assertAcked(prepareCreate("test2", 3)); ensureGreen(); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, 1)).execute().actionGet(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, 1)).execute().actionGet(); ensureGreen(); state = client().admin().cluster().prepareState().execute().actionGet().getState(); diff --git a/core/src/test/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeServiceTests.java b/core/src/test/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeServiceTests.java index 0d8784834fa..52c52242c0f 100644 --- a/core/src/test/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeServiceTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeServiceTests.java @@ -78,7 +78,7 @@ public class MetaDataIndexUpgradeServiceTests extends ESTestCase { } public static IndexMetaData newIndexMeta(String name, Settings indexSettings) { - Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_CREATION_DATE, 1) diff --git a/core/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java b/core/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java index f7e8b18196f..8ad86818614 100644 --- a/core/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java @@ -20,6 +20,7 @@ package org.elasticsearch.cluster.metadata; import org.elasticsearch.Version; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.test.ESTestCase; @@ -27,7 +28,6 @@ import org.elasticsearch.test.ESTestCase; import java.io.IOException; import static org.elasticsearch.cluster.metadata.AliasMetaData.newAliasMetaDataBuilder; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; @@ -118,7 +118,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase { .put(IndexTemplateMetaData.builder("foo") .template("bar") .order(1) - .settings(settingsBuilder() + .settings(Settings.builder() .put("setting1", "value1") .put("setting2", "value2")) .putAlias(newAliasMetaDataBuilder("alias-bar1")) @@ -139,7 +139,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase { .put(IndexTemplateMetaData.builder("foo") .template("bar") .order(1) - .settings(settingsBuilder() + .settings(Settings.builder() .put("setting1", "value1") .put("setting2", "value2")) .putAlias(newAliasMetaDataBuilder("alias-bar1")) diff --git a/core/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java b/core/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java index 888b340b23a..38aa73a9935 100644 --- a/core/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java @@ -59,7 +59,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testNameMatch() { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("xxx.name", "name1") .build(); DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings); @@ -72,7 +72,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIdMatch() { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("xxx._id", "id1") .build(); DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings); @@ -85,7 +85,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIdOrNameMatch() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx._id", "id1,blah") .put("xxx.name", "blah,name2") .build()); @@ -102,7 +102,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testTagAndGroupMatch() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "A") .put("xxx.group", "B") .build()); @@ -136,7 +136,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testStarMatch() { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("xxx.name", "*") .build(); DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings); @@ -146,7 +146,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpBindFilteringMatchingAnd() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "A") .put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54") .build()); @@ -157,7 +157,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpBindFilteringNotMatching() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "B") .put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54") .build()); @@ -168,7 +168,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpBindFilteringNotMatchingAnd() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "A") .put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "8.8.8.8") .build()); @@ -179,7 +179,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpBindFilteringMatchingOr() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "192.1.1.54") .put("xxx.tag", "A") .build()); @@ -190,7 +190,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpBindFilteringNotMatchingOr() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "A") .put("xxx." + randomFrom("_ip", "_host_ip", "_publish_ip"), "8.8.8.8") .build()); @@ -201,7 +201,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpPublishFilteringMatchingAnd() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "A") .put("xxx._publish_ip", "192.1.1.54") .build()); @@ -212,7 +212,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpPublishFilteringNotMatchingAnd() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "A") .put("xxx._publish_ip", "8.8.8.8") .build()); @@ -223,7 +223,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpPublishFilteringMatchingOr() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx._publish_ip", "192.1.1.54") .put("xxx.tag", "A") .build()); @@ -234,7 +234,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } public void testIpPublishFilteringNotMatchingOr() { - Settings settings = shuffleSettings(Settings.settingsBuilder() + Settings settings = shuffleSettings(Settings.builder() .put("xxx.tag", "A") .put("xxx._publish_ip", "8.8.8.8") .build()); @@ -245,7 +245,7 @@ public class DiscoveryNodeFiltersTests extends ESTestCase { } private Settings shuffleSettings(Settings source) { - Settings.Builder settings = Settings.settingsBuilder(); + Settings.Builder settings = Settings.builder(); List keys = new ArrayList<>(source.getAsMap().keySet()); Collections.shuffle(keys, random()); for (String o : keys) { diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/PrimaryTermsTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/PrimaryTermsTests.java index d9b74621cc5..c78b1f9c815 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/PrimaryTermsTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/PrimaryTermsTests.java @@ -40,7 +40,6 @@ import java.util.Map; import java.util.Set; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -60,7 +59,7 @@ public class PrimaryTermsTests extends ESAllocationTestCase { @Override public void setUp() throws Exception { super.setUp(); - this.allocationService = createAllocationService(settingsBuilder() + this.allocationService = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", Integer.MAX_VALUE) // don't limit recoveries .put("cluster.routing.allocation.node_initial_primaries_recoveries", Integer.MAX_VALUE) .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTests.java index 40e24338f00..fccbb6a8425 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTests.java @@ -33,7 +33,6 @@ import org.elasticsearch.test.ESAllocationTestCase; import org.junit.Before; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; @@ -49,7 +48,7 @@ public class RoutingTableTests extends ESAllocationTestCase { private int shardsPerIndex; private int totalNumberOfShards; private final static Settings DEFAULT_SETTINGS = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); - private final AllocationService ALLOCATION_SERVICE = createAllocationService(settingsBuilder() + private final AllocationService ALLOCATION_SERVICE = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", Integer.MAX_VALUE) // don't limit recoveries .put("cluster.routing.allocation.node_initial_primaries_recoveries", Integer.MAX_VALUE) .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java index c579752d681..cfc0f506d09 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java @@ -43,13 +43,12 @@ import java.util.Collections; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class AddIncrementallyTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(AddIncrementallyTests.class); public void testAddNodesAndIndices() { - Settings.Builder settings = settingsBuilder(); + Settings.Builder settings = Settings.builder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()); AllocationService service = createAllocationService(settings.build()); @@ -92,7 +91,7 @@ public class AddIncrementallyTests extends ESAllocationTestCase { } public void testMinimalRelocations() { - Settings.Builder settings = settingsBuilder(); + Settings.Builder settings = Settings.builder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()) .put("cluster.routing.allocation.node_concurrent_recoveries", 2); AllocationService service = createAllocationService(settings.build()); @@ -160,7 +159,7 @@ public class AddIncrementallyTests extends ESAllocationTestCase { } public void testMinimalRelocationsNoLimit() { - Settings.Builder settings = settingsBuilder(); + Settings.Builder settings = Settings.builder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()) .put("cluster.routing.allocation.node_concurrent_recoveries", 100) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 100); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java index ed2c46de89a..ec3392a7e7e 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java @@ -39,6 +39,7 @@ import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; @@ -51,7 +52,6 @@ import static java.util.Collections.singleton; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -61,7 +61,7 @@ public class AllocationCommandsTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(AllocationCommandsTests.class); public void testMoveShardCommand() { - AllocationService allocation = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService allocation = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("creating an index with 1 shard, no replica"); MetaData metaData = MetaData.builder() @@ -112,7 +112,7 @@ public class AllocationCommandsTests extends ESAllocationTestCase { } public void testAllocateCommand() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none") .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none") .build()); @@ -238,7 +238,7 @@ public class AllocationCommandsTests extends ESAllocationTestCase { } public void testCancelCommand() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none") .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), "none") .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationPriorityTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationPriorityTests.java index 925258636c6..f12ed123dc5 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationPriorityTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationPriorityTests.java @@ -25,10 +25,10 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class AllocationPriorityTests extends ESAllocationTestCase { @@ -37,7 +37,7 @@ public class AllocationPriorityTests extends ESAllocationTestCase { * See https://github.com/elastic/elasticsearch/issues/13249 for details */ public void testPrioritizedIndicesAllocatedFirst() { - AllocationService allocation = createAllocationService(settingsBuilder(). + AllocationService allocation = createAllocationService(Settings.builder(). put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING.getKey(), 1) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 10) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING.getKey(), 1) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java index 18f24504619..ee993bf3ebd 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java @@ -33,7 +33,7 @@ import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationComman import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.index.shard.ShardId; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static java.util.Collections.singletonMap; @@ -41,7 +41,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.sameInstance; @@ -53,7 +52,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class); public void testMoveShardOnceNewNodeWithAttributeAdded1() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.attributes", "rack_id") @@ -121,7 +120,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testMoveShardOnceNewNodeWithAttributeAdded2() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.attributes", "rack_id") @@ -190,7 +189,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testMoveShardOnceNewNodeWithAttributeAdded3() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") @@ -282,7 +281,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testMoveShardOnceNewNodeWithAttributeAdded4() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") @@ -377,7 +376,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testMoveShardOnceNewNodeWithAttributeAdded5() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.attributes", "rack_id") @@ -455,7 +454,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testMoveShardOnceNewNodeWithAttributeAdded6() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.attributes", "rack_id") @@ -535,7 +534,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testFullAwareness1() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.force.rack_id.values", "1,2") @@ -602,7 +601,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testFullAwareness2() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.force.rack_id.values", "1,2") @@ -670,7 +669,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testFullAwareness3() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") @@ -754,7 +753,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testUnbalancedZones() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.awareness.force.zone.values", "a,b") .put("cluster.routing.allocation.awareness.attributes", "zone") .put("cluster.routing.allocation.node_concurrent_recoveries", 10) @@ -818,7 +817,7 @@ public class AwarenessAllocationTests extends ESAllocationTestCase { } public void testUnassignedShardsWithUnbalancedZones() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.attributes", "zone") diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java index 53a88d333c0..37c5c4d4f45 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java @@ -49,7 +49,6 @@ import java.util.HashMap; import java.util.Map; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class BalanceConfigurationTests extends ESAllocationTestCase { @@ -66,7 +65,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase { final float replicaBalance = 0.0f; final float balanceTreshold = 1.0f; - Settings.Builder settings = settingsBuilder(); + Settings.Builder settings = Settings.builder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()); settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), indexBalance); settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), replicaBalance); @@ -91,7 +90,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase { final float replicaBalance = 1.0f; final float balanceTreshold = 1.0f; - Settings.Builder settings = settingsBuilder(); + Settings.Builder settings = Settings.builder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()); settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), indexBalance); settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), replicaBalance); @@ -280,17 +279,17 @@ public class BalanceConfigurationTests extends ESAllocationTestCase { } public void testPersistedSettings() { - Settings.Builder settings = settingsBuilder(); + Settings.Builder settings = Settings.builder(); settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.2); settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 0.3); settings.put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 2.0); - ClusterSettings service = new ClusterSettings(settingsBuilder().build(), ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); + ClusterSettings service = new ClusterSettings(Settings.builder().build(), ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); BalancedShardsAllocator allocator = new BalancedShardsAllocator(settings.build(), service); assertThat(allocator.getIndexBalance(), Matchers.equalTo(0.2f)); assertThat(allocator.getShardBalance(), Matchers.equalTo(0.3f)); assertThat(allocator.getThreshold(), Matchers.equalTo(2.0f)); - settings = settingsBuilder(); + settings = Settings.builder(); settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.2); settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 0.3); settings.put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 2.0); @@ -300,7 +299,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase { assertThat(allocator.getShardBalance(), Matchers.equalTo(0.3f)); assertThat(allocator.getThreshold(), Matchers.equalTo(2.0f)); - settings = settingsBuilder(); + settings = Settings.builder(); settings.put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), 0.5); settings.put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 0.1); settings.put(BalancedShardsAllocator.THRESHOLD_SETTING.getKey(), 3.0); @@ -311,7 +310,7 @@ public class BalanceConfigurationTests extends ESAllocationTestCase { } public void testNoRebalanceOnPrimaryOverload() { - Settings.Builder settings = settingsBuilder(); + Settings.Builder settings = Settings.builder(); AllocationService strategy = new AllocationService(settings.build(), randomAllocationDeciders(settings.build(), new ClusterSettings(Settings.Builder.EMPTY_SETTINGS, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), random()), NoopGatewayAllocator.INSTANCE, new ShardsAllocator() { diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTests.java index fa8afc84876..bcefe46884e 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTests.java @@ -26,6 +26,7 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.common.settings.Settings; import java.io.IOException; import java.io.InputStream; @@ -35,7 +36,6 @@ import java.util.HashMap; import java.util.Map; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * see issue #9023 @@ -54,7 +54,7 @@ public class BalanceUnbalancedClusterTests extends CatAllocationTestCase { @Override protected ClusterState allocateNew(ClusterState state) { String index = "tweets-2014-12-29:00"; - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .build()); MetaData metaData = MetaData.builder(state.metaData()) .put(IndexMetaData.builder(index).settings(settings(Version.CURRENT)).numberOfShards(5).numberOfReplicas(1)) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestCase.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestCase.java index 0bd84413125..2483832ef71 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestCase.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestCase.java @@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.routing.TestShardRouting; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import java.io.BufferedReader; @@ -47,7 +48,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * A base testcase that allows to run tests based on the output of the CAT API @@ -134,7 +134,7 @@ public abstract class CatAllocationTestCase extends ESAllocationTestCase { } private ClusterState rebalance(ClusterState clusterState) { - RoutingTable routingTable;AllocationService strategy = createAllocationService(settingsBuilder() + RoutingTable routingTable;AllocationService strategy = createAllocationService(Settings.builder() .build()); RoutingAllocation.Result reroute = strategy.reroute(clusterState, "reroute"); routingTable = reroute.routingTable(); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java index b5ce103aeed..88fad86794e 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java @@ -40,7 +40,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; @@ -48,7 +47,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(ClusterRebalanceRoutingTests.class); public void testAlways() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build()); MetaData metaData = MetaData.builder() @@ -134,7 +133,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase { public void testClusterPrimariesActive1() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_PRIMARIES_ACTIVE.toString()).build()); MetaData metaData = MetaData.builder() @@ -238,7 +237,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase { } public void testClusterPrimariesActive2() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_PRIMARIES_ACTIVE.toString()).build()); MetaData metaData = MetaData.builder() @@ -322,7 +321,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase { } public void testClusterAllActive1() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_ALL_ACTIVE.toString()).build()); MetaData metaData = MetaData.builder() @@ -445,7 +444,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase { } public void testClusterAllActive2() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_ALL_ACTIVE.toString()).build()); MetaData metaData = MetaData.builder() @@ -529,7 +528,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase { } public void testClusterAllActive3() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.INDICES_ALL_ACTIVE.toString()).build()); MetaData metaData = MetaData.builder() @@ -739,7 +738,7 @@ public class ClusterRebalanceRoutingTests extends ESAllocationTestCase { public void testRebalanceWhileShardFetching() { final AtomicBoolean hasFetches = new AtomicBoolean(true); - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build(), new NoopGatewayAllocator() { @Override public boolean allocateUnassigned(RoutingAllocation allocation) { diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java index 886462610ca..0fcffb8afe3 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java @@ -28,13 +28,13 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -42,7 +42,7 @@ public class ConcurrentRebalanceRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(ConcurrentRebalanceRoutingTests.class); public void testClusterConcurrentRebalance() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.cluster_concurrent_rebalance", 3) .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java index 82496f31bd2..f6539a167ff 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java @@ -30,12 +30,12 @@ import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationComman import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -44,7 +44,7 @@ public class DeadNodesAllocationTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(DeadNodesAllocationTests.class); public void testSimpleDeadNodeOnStartedPrimaryShard() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -95,7 +95,7 @@ public class DeadNodesAllocationTests extends ESAllocationTestCase { } public void testDeadNodeWhileRelocatingOnToNode() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -169,7 +169,7 @@ public class DeadNodesAllocationTests extends ESAllocationTestCase { } public void testDeadNodeWhileRelocatingOnFromNode() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java index fc686f0bb5a..0bf3ca93676 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java @@ -29,11 +29,11 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -43,7 +43,7 @@ public class ElectReplicaAsPrimaryDuringRelocationTests extends ESAllocationTest private final ESLogger logger = Loggers.getLogger(ElectReplicaAsPrimaryDuringRelocationTests.class); public void testElectReplicaAsPrimaryDuringRelocation() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java index affab78521c..ecf7ca741b4 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java @@ -30,18 +30,18 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; public class FailedNodeRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(FailedNodeRoutingTests.class); public void testSimpleFailedNodeTest() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build()); MetaData metaData = MetaData.builder() diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java index 0c687bc6658..37a46fe4c10 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java @@ -32,6 +32,7 @@ import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationComman import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import java.util.ArrayList; @@ -41,7 +42,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.lessThan; @@ -55,7 +55,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(FailedShardsRoutingTests.class); public void testFailedShardPrimaryRelocatingToAndFrom() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -143,7 +143,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { } public void testFailPrimaryStartedCheckReplicaElected() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -224,7 +224,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { } public void testFirstAllocationFailureSingleNode() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -280,7 +280,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { } public void testSingleShardMultipleAllocationFailures() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -336,7 +336,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { } public void testFirstAllocationFailureTwoNodes() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -396,7 +396,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { } public void testRebalanceFailure() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -491,7 +491,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { } public void testFailAllReplicasInitializingOnPrimaryFail() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .build()); MetaData metaData = MetaData.builder() @@ -537,7 +537,7 @@ public class FailedShardsRoutingTests extends ESAllocationTestCase { } public void testFailAllReplicasInitializingOnPrimaryFailWhileHavingAReplicaToElect() { - AllocationService allocation = createAllocationService(settingsBuilder() + AllocationService allocation = createAllocationService(Settings.builder() .build()); MetaData metaData = MetaData.builder() diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java index 6b55d743204..a00ce20c728 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java @@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import org.hamcrest.Matchers; @@ -38,7 +39,6 @@ import java.util.List; import static java.util.Collections.singletonMap; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -47,7 +47,7 @@ public class FilterRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(FilterRoutingTests.class); public void testClusterFilters() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.include.tag1", "value1,value2") .put("cluster.routing.allocation.exclude.tag1", "value3,value4") .build()); @@ -92,7 +92,7 @@ public class FilterRoutingTests extends ESAllocationTestCase { } public void testIndexFilters() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .build()); logger.info("Building initial routing table"); @@ -166,7 +166,7 @@ public class FilterRoutingTests extends ESAllocationTestCase { } public void testRebalanceAfterShardsCannotRemainOnNode() { - AllocationService strategy = createAllocationService(settingsBuilder().build()); + AllocationService strategy = createAllocationService(Settings.builder().build()); logger.info("Building initial routing table"); MetaData metaData = MetaData.builder() @@ -198,7 +198,7 @@ public class FilterRoutingTests extends ESAllocationTestCase { assertThat(clusterState.getRoutingNodes().shardsWithState(STARTED).size(), equalTo(4)); logger.info("--> disable allocation for node1 and reroute"); - strategy = createAllocationService(settingsBuilder() + strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.cluster_concurrent_rebalance", "1") .put("cluster.routing.allocation.exclude.tag1", "value1") .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java index d5f8134d95f..874509d5cf1 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java @@ -29,12 +29,12 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -45,7 +45,7 @@ public class IndexBalanceTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(IndexBalanceTests.class); public void testBalanceAllNodesStarted() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") @@ -175,7 +175,7 @@ public class IndexBalanceTests extends ESAllocationTestCase { } public void testBalanceIncrementallyStartNodes() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") @@ -337,7 +337,7 @@ public class IndexBalanceTests extends ESAllocationTestCase { } public void testBalanceAllNodesStartedAddIndex() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java index 49e38d7adba..97a3003ab2f 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java @@ -60,7 +60,6 @@ import static java.util.Collections.shuffle; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.VersionUtils.randomVersion; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -74,7 +73,7 @@ public class NodeVersionAllocationDeciderTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(NodeVersionAllocationDeciderTests.class); public void testDoNotAllocateFromPrimary() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -188,7 +187,7 @@ public class NodeVersionAllocationDeciderTests extends ESAllocationTestCase { } public void testRandom() { - AllocationService service = createAllocationService(settingsBuilder() + AllocationService service = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -237,7 +236,7 @@ public class NodeVersionAllocationDeciderTests extends ESAllocationTestCase { } public void testRollingRestart() { - AllocationService service = createAllocationService(settingsBuilder() + AllocationService service = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java index 2e37a3a11b9..79c59b33b8e 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java @@ -25,6 +25,7 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static java.util.Collections.singletonMap; @@ -32,7 +33,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -45,7 +45,7 @@ public class PreferLocalPrimariesToRelocatingPrimariesTests extends ESAllocation int totalNumberOfShards = numberOfShards * 2; logger.info("create an allocation with [{}] initial primary recoveries and [{}] concurrent recoveries", primaryRecoveries, concurrentRecoveries); - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", concurrentRecoveries) .put("cluster.routing.allocation.node_initial_primaries_recoveries", primaryRecoveries) .build()); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java index d4beb7190e3..7067009a19e 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java @@ -28,10 +28,10 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -41,7 +41,7 @@ public class PreferPrimaryAllocationTests extends ESAllocationTestCase { public void testPreferPrimaryAllocationOverReplicas() { logger.info("create an allocation with 1 initial recoveries"); - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 1) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 1) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java index b18ee32ff5e..3c60a51f4fb 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java @@ -28,11 +28,11 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -43,7 +43,7 @@ public class PrimaryElectionRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(PrimaryElectionRoutingTests.class); public void testBackupElectionToPrimaryWhenPrimaryCanBeAllocatedToAnotherNode() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); @@ -96,7 +96,7 @@ public class PrimaryElectionRoutingTests extends ESAllocationTestCase { } public void testRemovingInitializingReplicasIfPrimariesFails() { - AllocationService allocation = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService allocation = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java index 371624484ff..a636334b5d3 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java @@ -28,11 +28,11 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -42,7 +42,7 @@ public class PrimaryNotRelocatedWhileBeingRecoveredTests extends ESAllocationTes private final ESLogger logger = Loggers.getLogger(PrimaryNotRelocatedWhileBeingRecoveredTests.class); public void testPrimaryNotRelocatedWhileBeingRecoveredFrom() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.concurrent_source_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java index c9b59e1403c..307df91c302 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java @@ -46,7 +46,6 @@ import java.util.HashSet; import java.util.Random; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; public class RandomAllocationDeciderTests extends ESAllocationTestCase { @@ -57,7 +56,7 @@ public class RandomAllocationDeciderTests extends ESAllocationTestCase { * balance.*/ public void testRandomDecisions() { RandomAllocationDecider randomAllocationDecider = new RandomAllocationDecider(random()); - AllocationService strategy = new AllocationService(settingsBuilder().build(), new AllocationDeciders(Settings.EMPTY, + AllocationService strategy = new AllocationService(Settings.builder().build(), new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList(new SameShardAllocationDecider(Settings.EMPTY), new ReplicaAfterPrimaryActiveAllocationDecider(Settings.EMPTY), randomAllocationDecider))), NoopGatewayAllocator.INSTANCE, new BalancedShardsAllocator(Settings.EMPTY), EmptyClusterInfoService.INSTANCE); int indices = scaledRandomIntBetween(1, 20); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java index a4cd47bd24b..035f6d3efff 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java @@ -33,13 +33,13 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -55,7 +55,7 @@ public class RebalanceAfterActiveTests extends ESAllocationTestCase { sizes[i] = randomIntBetween(0, Integer.MAX_VALUE); } - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java index 1b8bea26dbe..e4b423c3f8f 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java @@ -28,12 +28,12 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.nullValue; @@ -45,7 +45,7 @@ public class ReplicaAllocatedAfterPrimaryTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(ReplicaAllocatedAfterPrimaryTests.class); public void testBackupIsAllocatedAfterPrimary() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java index 9a4e56a26b2..c23ab86b497 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java @@ -31,11 +31,11 @@ import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllo import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -45,7 +45,7 @@ public class RoutingNodesIntegrityTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(IndexBalanceTests.class); public void testBalanceAllNodesStarted() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") @@ -117,7 +117,7 @@ public class RoutingNodesIntegrityTests extends ESAllocationTestCase { } public void testBalanceIncrementallyStartNodes() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") @@ -209,7 +209,7 @@ public class RoutingNodesIntegrityTests extends ESAllocationTestCase { } public void testBalanceAllNodesStartedAddIndex() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 1) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 3) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 10) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java index 2522991086b..9984890e8a4 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java @@ -31,13 +31,13 @@ import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.test.ESAllocationTestCase; import static java.util.Collections.emptyMap; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -46,7 +46,7 @@ public class SameShardRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(SameShardRoutingTests.class); public void testSameHost() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put(SameShardAllocationDecider.SAME_HOST_SETTING, true).build()); MetaData metaData = MetaData.builder() diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java index b66e27b9951..1298bda30f9 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java @@ -29,19 +29,19 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; public class ShardVersioningTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(ShardVersioningTests.class); public void testSimple() { - AllocationService strategy = createAllocationService(settingsBuilder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), + AllocationService strategy = createAllocationService(Settings.builder().put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()).build()); MetaData metaData = MetaData.builder() diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java index e220c8eb0f6..26aa88a74a1 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java @@ -31,13 +31,13 @@ import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.routing.allocation.decider.ShardsLimitAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -46,7 +46,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(ShardsLimitAllocationTests.class); public void testIndexLevelShardsLimitAllocate() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); @@ -88,7 +88,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase { } public void testClusterLevelShardsLimitAllocate() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ShardsLimitAllocationDecider.CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), 1) .build()); @@ -124,7 +124,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase { assertThat(clusterState.getRoutingNodes().unassigned().size(), equalTo(2)); // Bump the cluster total shards to 2 - strategy = createAllocationService(settingsBuilder() + strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ShardsLimitAllocationDecider.CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), 2) .build()); @@ -146,7 +146,7 @@ public class ShardsLimitAllocationTests extends ESAllocationTestCase { } public void testIndexLevelShardsLimitRemain() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java index 90263acb13a..4aaf05cc99f 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java @@ -32,6 +32,7 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import java.util.ArrayList; @@ -44,7 +45,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; @@ -59,7 +59,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(SingleShardNoReplicasRoutingTests.class); public void testSingleIndexStartedShard() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); @@ -160,7 +160,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase { } public void testSingleIndexShardFailed() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); @@ -209,7 +209,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase { } public void testMultiIndexEvenDistribution() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -321,7 +321,7 @@ public class SingleShardNoReplicasRoutingTests extends ESAllocationTestCase { } public void testMultiIndexUnevenNodes() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java index f7033ec2596..64a7b2abcf0 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java @@ -28,12 +28,12 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -44,7 +44,7 @@ public class SingleShardOneReplicaRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(SingleShardOneReplicaRoutingTests.class); public void testSingleIndexFirstStartPrimaryThenBackups() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java index aec81a6e063..fa1e9c34576 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java @@ -29,13 +29,13 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.nullValue; @@ -47,7 +47,7 @@ public class TenShardsOneReplicaRoutingTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(TenShardsOneReplicaRoutingTests.class); public void testSingleIndexFirstStartPrimaryThenBackups() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java index 5573780e2e1..4749e5666d8 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java @@ -37,7 +37,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -47,7 +46,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(ThrottlingAllocationTests.class); public void testPrimaryRecoveryThrottling() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 3) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 3) .build()); @@ -107,7 +106,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase { } public void testReplicaAndPrimaryRecoveryThrottling() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 3) .put("cluster.routing.allocation.concurrent_source_recoveries", 3) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 3) @@ -177,7 +176,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase { } public void testThrottleIncomingAndOutgoing() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 5) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 5) .put("cluster.routing.allocation.cluster_concurrent_rebalance", 5) @@ -244,7 +243,7 @@ public class ThrottlingAllocationTests extends ESAllocationTestCase { } public void testOutgoingThrottlesAllocaiton() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 1) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 1) .put("cluster.routing.allocation.cluster_concurrent_rebalance", 1) diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java index 5ff5af4e4cd..7d90e5ee2f2 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java @@ -28,12 +28,12 @@ import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; @@ -46,7 +46,7 @@ public class UpdateNumberOfReplicasTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(UpdateNumberOfReplicasTests.class); public void testUpdateNumberOfReplicas() { - AllocationService strategy = createAllocationService(settingsBuilder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); + AllocationService strategy = createAllocationService(Settings.builder().put("cluster.routing.allocation.node_concurrent_recoveries", 10).build()); logger.info("Building initial routing table"); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java index 66f3364458d..1d1a88e1db9 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java @@ -60,7 +60,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -69,7 +68,7 @@ import static org.hamcrest.Matchers.nullValue; public class DiskThresholdDeciderTests extends ESAllocationTestCase { public void testDiskThreshold() { - Settings diskSettings = settingsBuilder() + Settings diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.8).build(); @@ -104,7 +103,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { // noop } }; - AllocationService strategy = new AllocationService(settingsBuilder() + AllocationService strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -183,7 +182,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { // Set the low threshold to 60 instead of 70 // Set the high threshold to 70 instead of 80 // node2 now should not have new shards allocated to it, but shards can remain - diskSettings = settingsBuilder() + diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "60%") .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.7).build(); @@ -193,7 +192,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); - strategy = new AllocationService(settingsBuilder() + strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -214,7 +213,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { // Set the low threshold to 50 instead of 60 // Set the high threshold to 60 instead of 70 // node2 now should not have new shards allocated to it, and shards cannot remain - diskSettings = settingsBuilder() + diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.5) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.6).build(); @@ -224,7 +223,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); - strategy = new AllocationService(settingsBuilder() + strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -268,7 +267,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } public void testDiskThresholdWithAbsoluteSizes() { - Settings diskSettings = settingsBuilder() + Settings diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "30b") .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "9b").build(); @@ -305,7 +304,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } }; - AllocationService strategy = new AllocationService(settingsBuilder() + AllocationService strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -363,7 +362,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { // noop } }; - strategy = new AllocationService(settingsBuilder() + strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -422,7 +421,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { // Set the low threshold to 60 instead of 70 // Set the high threshold to 70 instead of 80 // node2 now should not have new shards allocated to it, but shards can remain - diskSettings = settingsBuilder() + diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "40b") .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "30b").build(); @@ -432,7 +431,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); - strategy = new AllocationService(settingsBuilder() + strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -453,7 +452,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { // Set the low threshold to 50 instead of 60 // Set the high threshold to 60 instead of 70 // node2 now should not have new shards allocated to it, and shards cannot remain - diskSettings = settingsBuilder() + diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "50b") .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "40b").build(); @@ -463,7 +462,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); - strategy = new AllocationService(settingsBuilder() + strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -541,7 +540,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } public void testDiskThresholdWithShardSizes() { - Settings diskSettings = settingsBuilder() + Settings diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), "71%").build(); @@ -574,7 +573,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } }; - AllocationService strategy = new AllocationService(settingsBuilder() + AllocationService strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -610,7 +609,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } public void testUnknownDiskUsage() { - Settings diskSettings = settingsBuilder() + Settings diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), 0.85).build(); @@ -644,7 +643,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } }; - AllocationService strategy = new AllocationService(settingsBuilder() + AllocationService strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -711,7 +710,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } public void testShardRelocationsTakenIntoAccount() { - Settings diskSettings = settingsBuilder() + Settings diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), 0.7) @@ -749,7 +748,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } }; - AllocationService strategy = new AllocationService(settingsBuilder() + AllocationService strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -820,7 +819,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } public void testCanRemainWithShardRelocatingAway() { - Settings diskSettings = settingsBuilder() + Settings diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "60%") @@ -917,7 +916,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( new SameShardAllocationDecider(Settings.EMPTY), diskThresholdDecider ))); - AllocationService strategy = new AllocationService(settingsBuilder() + AllocationService strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", -1) @@ -935,7 +934,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { } public void testForSingleDataNode() { - Settings diskSettings = settingsBuilder() + Settings diskSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS_SETTING.getKey(), true) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "60%") @@ -1014,7 +1013,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase { new SameShardAllocationDecider(Settings.EMPTY), diskThresholdDecider ))); - AllocationService strategy = new AllocationService(settingsBuilder() + AllocationService strategy = new AllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIT.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIT.java index ae840abd1a8..66391dc7b31 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIT.java @@ -19,11 +19,11 @@ package org.elasticsearch.cluster.routing.allocation.decider; import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase; import java.util.Set; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -37,26 +37,26 @@ public class EnableAllocationDeciderIT extends ESIntegTestCase { public void testEnableRebalance() throws InterruptedException { final String firstNode = internalCluster().startNode(); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)).get(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)).get(); // we test with 2 shards since otherwise it's pretty fragile if there are difference in the num or shards such that // all shards are relocated to the second node which is not what we want here. It's solely a test for the settings to take effect final int numShards = 2; - assertAcked(prepareCreate("test").setSettings(settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards))); - assertAcked(prepareCreate("test_1").setSettings(settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards))); + assertAcked(prepareCreate("test_1").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards))); ensureGreen(); assertAllShardsOnNodes("test", firstNode); assertAllShardsOnNodes("test_1", firstNode); final String secondNode = internalCluster().startNode(); // prevent via index setting but only on index test - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)).get(); client().admin().cluster().prepareReroute().get(); ensureGreen(); assertAllShardsOnNodes("test", firstNode); assertAllShardsOnNodes("test_1", firstNode); // now enable the index test to relocate since index settings override cluster settings - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), randomBoolean() ? EnableAllocationDecider.Rebalance.PRIMARIES : EnableAllocationDecider.Rebalance.ALL)).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), randomBoolean() ? EnableAllocationDecider.Rebalance.PRIMARIES : EnableAllocationDecider.Rebalance.ALL)).get(); logger.info("--> balance index [test]"); client().admin().cluster().prepareReroute().get(); ensureGreen("test"); @@ -64,7 +64,7 @@ public class EnableAllocationDeciderIT extends ESIntegTestCase { assertThat("index: [test] expected to be rebalanced on both nodes", test.size(), equalTo(2)); // flip the cluster wide setting such that we can also balance for index test_1 eventually we should have one shard of each index on each node - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), randomBoolean() ? EnableAllocationDecider.Rebalance.PRIMARIES : EnableAllocationDecider.Rebalance.ALL)).get(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), randomBoolean() ? EnableAllocationDecider.Rebalance.PRIMARIES : EnableAllocationDecider.Rebalance.ALL)).get(); logger.info("--> balance index [test_1]"); client().admin().cluster().prepareReroute().get(); ensureGreen("test_1"); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java index f42920551ff..f2260aecfcb 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java @@ -45,7 +45,6 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE_SETTING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -55,7 +54,7 @@ public class EnableAllocationTests extends ESAllocationTestCase { private final ESLogger logger = Loggers.getLogger(EnableAllocationTests.class); public void testClusterEnableNone() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.NONE.name()) .build()); @@ -83,7 +82,7 @@ public class EnableAllocationTests extends ESAllocationTestCase { } public void testClusterEnableOnlyPrimaries() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put(CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), Allocation.PRIMARIES.name()) .build()); @@ -116,7 +115,7 @@ public class EnableAllocationTests extends ESAllocationTestCase { } public void testIndexEnableNone() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .build()); MetaData metaData = MetaData.builder() @@ -156,14 +155,14 @@ public class EnableAllocationTests extends ESAllocationTestCase { public void testEnableClusterBalance() { final boolean useClusterSetting = randomBoolean(); final Rebalance allowedOnes = RandomPicks.randomFrom(random(), EnumSet.of(Rebalance.PRIMARIES, Rebalance.REPLICAS, Rebalance.ALL)); - Settings build = settingsBuilder() + Settings build = Settings.builder() .put(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), useClusterSetting ? Rebalance.NONE: RandomPicks.randomFrom(random(), Rebalance.values())) // index settings override cluster settings .put(ConcurrentRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING.getKey(), 3) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 10) .build(); ClusterSettings clusterSettings = new ClusterSettings(build, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); AllocationService strategy = createAllocationService(build, clusterSettings, random()); - Settings indexSettings = useClusterSetting ? Settings.EMPTY : settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), Rebalance.NONE).build(); + Settings indexSettings = useClusterSetting ? Settings.EMPTY : Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), Rebalance.NONE).build(); logger.info("Building initial routing table"); MetaData metaData = MetaData.builder() @@ -211,7 +210,7 @@ public class EnableAllocationTests extends ESAllocationTestCase { if (useClusterSetting) { prevState = clusterState; - clusterState = ClusterState.builder(clusterState).metaData(MetaData.builder(metaData).transientSettings(settingsBuilder() + clusterState = ClusterState.builder(clusterState).metaData(MetaData.builder(metaData).transientSettings(Settings.builder() .put(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), allowedOnes) .build())).build(); } else { @@ -219,7 +218,7 @@ public class EnableAllocationTests extends ESAllocationTestCase { IndexMetaData meta = clusterState.getMetaData().index("test"); IndexMetaData meta1 = clusterState.getMetaData().index("always_disabled"); clusterState = ClusterState.builder(clusterState).metaData(MetaData.builder(metaData).removeAllIndices().put(IndexMetaData.builder(meta1)) - .put(IndexMetaData.builder(meta).settings(settingsBuilder().put(meta.getSettings()).put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), allowedOnes).build()))) + .put(IndexMetaData.builder(meta).settings(Settings.builder().put(meta.getSettings()).put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), allowedOnes).build()))) .build(); } @@ -259,13 +258,13 @@ public class EnableAllocationTests extends ESAllocationTestCase { public void testEnableClusterBalanceNoReplicas() { final boolean useClusterSetting = randomBoolean(); - Settings build = settingsBuilder() + Settings build = Settings.builder() .put(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), useClusterSetting ? Rebalance.NONE: RandomPicks.randomFrom(random(), Rebalance.values())) // index settings override cluster settings .put(ConcurrentRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE_SETTING.getKey(), 3) .build(); ClusterSettings clusterSettings = new ClusterSettings(build, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); AllocationService strategy = createAllocationService(build, clusterSettings, random()); - Settings indexSettings = useClusterSetting ? Settings.EMPTY : settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), Rebalance.NONE).build(); + Settings indexSettings = useClusterSetting ? Settings.EMPTY : Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), Rebalance.NONE).build(); logger.info("Building initial routing table"); MetaData metaData = MetaData.builder() @@ -305,14 +304,14 @@ public class EnableAllocationTests extends ESAllocationTestCase { assertThat(clusterState.getRoutingNodes().shardsWithState(RELOCATING).size(), equalTo(0)); if (useClusterSetting) { prevState = clusterState; - clusterState = ClusterState.builder(clusterState).metaData(MetaData.builder(metaData).transientSettings(settingsBuilder() + clusterState = ClusterState.builder(clusterState).metaData(MetaData.builder(metaData).transientSettings(Settings.builder() .put(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), randomBoolean() ? Rebalance.PRIMARIES : Rebalance.ALL) .build())).build(); } else { prevState = clusterState; IndexMetaData meta = clusterState.getMetaData().index("test"); clusterState = ClusterState.builder(clusterState).metaData(MetaData.builder(metaData).removeAllIndices() - .put(IndexMetaData.builder(meta).settings(settingsBuilder().put(meta.getSettings()).put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), randomBoolean() ? Rebalance.PRIMARIES : Rebalance.ALL).build()))).build(); + .put(IndexMetaData.builder(meta).settings(Settings.builder().put(meta.getSettings()).put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), randomBoolean() ? Rebalance.PRIMARIES : Rebalance.ALL).build()))).build(); } clusterSettings.applySettings(clusterState.metaData().settings()); routingTable = strategy.reroute(clusterState, "reroute").routingTable(); diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java index 5d673e8d60c..81a28adee2d 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java @@ -26,6 +26,7 @@ import org.elasticsearch.cluster.ClusterInfoService; import org.elasticsearch.cluster.DiskUsage; import org.elasticsearch.cluster.MockInternalClusterInfoService; import org.elasticsearch.cluster.routing.RoutingNode; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; @@ -37,7 +38,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -72,12 +72,12 @@ public class MockDiskUsagesIT extends ESIntegTestCase { cis.setN2Usage(nodes.get(1), new DiskUsage(nodes.get(1), "n2", "/dev/null", 100, 50)); cis.setN3Usage(nodes.get(2), new DiskUsage(nodes.get(2), "n3", "/dev/null", 100, 50)); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder() + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), randomFrom("20b", "80%")) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), randomFrom("10b", "90%")) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.getKey(), "1ms")).get(); // Create an index with 10 shards so we can check allocation for it - prepareCreate("test").setSettings(settingsBuilder() + prepareCreate("test").setSettings(Settings.builder() .put("number_of_shards", 10) .put("number_of_replicas", 0) .put("index.routing.allocation.exclude._name", "")).get(); diff --git a/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceIT.java b/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceIT.java index a2a25ceafd2..9db548e2f3f 100644 --- a/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceIT.java @@ -51,7 +51,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -71,7 +70,7 @@ public class ClusterServiceIT extends ESIntegTestCase { } public void testAckedUpdateTask() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "local") .build(); internalCluster().startNode(settings); @@ -147,7 +146,7 @@ public class ClusterServiceIT extends ESIntegTestCase { } public void testAckedUpdateTaskSameClusterState() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "local") .build(); internalCluster().startNode(settings); @@ -218,7 +217,7 @@ public class ClusterServiceIT extends ESIntegTestCase { } public void testAckedUpdateTaskNoAckExpected() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "local") .build(); internalCluster().startNode(settings); @@ -290,7 +289,7 @@ public class ClusterServiceIT extends ESIntegTestCase { } public void testAckedUpdateTaskTimeoutZero() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "local") .build(); internalCluster().startNode(settings); @@ -367,7 +366,7 @@ public class ClusterServiceIT extends ESIntegTestCase { @TestLogging("_root:debug,action.admin.cluster.tasks:trace") public void testPendingUpdateTask() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "local") .build(); String node_0 = internalCluster().startNode(settings); @@ -502,7 +501,7 @@ public class ClusterServiceIT extends ESIntegTestCase { } public void testLocalNodeMasterListenerCallbacks() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .put("discovery.zen.minimum_master_nodes", 1) .put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "400ms") @@ -545,7 +544,7 @@ public class ClusterServiceIT extends ESIntegTestCase { internalCluster().startNode(Settings.builder().put(settings)); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); - Settings transientSettings = settingsBuilder() + Settings transientSettings = Settings.builder() .put("discovery.zen.minimum_master_nodes", 2) .build(); client().admin().cluster().prepareUpdateSettings().setTransientSettings(transientSettings).get(); diff --git a/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceTests.java b/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceTests.java index 94b54b771e6..7303d5a67df 100644 --- a/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/service/ClusterServiceTests.java @@ -65,7 +65,6 @@ import java.util.concurrent.atomic.AtomicInteger; import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -506,7 +505,7 @@ public class ClusterServiceTests extends ESTestCase { * Note, this test can only work as long as we have a single thread executor executing the state update tasks! */ public void testPrioritizedTasks() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("discovery.type", "local") .build(); BlockingTask block = new BlockingTask(Priority.IMMEDIATE); diff --git a/core/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsIT.java b/core/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsIT.java index d2516e11e97..1c25659d2cf 100644 --- a/core/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsIT.java @@ -32,7 +32,6 @@ import org.elasticsearch.index.store.IndexStoreConfig; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked; @@ -301,7 +300,7 @@ public class ClusterSettingsIT extends ESIntegTestCase { assertBlocked(request, MetaData.CLUSTER_READ_ONLY_BLOCK); // But it's possible to update the settings to update the "cluster.blocks.read_only" setting - Settings settings = settingsBuilder().put(MetaData.SETTING_READ_ONLY_SETTING.getKey(), false).build(); + Settings settings = Settings.builder().put(MetaData.SETTING_READ_ONLY_SETTING.getKey(), false).build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings).get()); } finally { diff --git a/core/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsIT.java b/core/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsIT.java index 2878204b680..84cd23a7f09 100644 --- a/core/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsIT.java @@ -33,7 +33,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_ME import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_READ; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_WRITE; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked; import static org.hamcrest.Matchers.equalTo; @@ -46,15 +45,15 @@ public class ClusterSearchShardsIT extends ESIntegTestCase { protected Settings nodeSettings(int nodeOrdinal) { switch(nodeOrdinal) { case 1: - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("node.attr.tag", "B").build(); + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put("node.attr.tag", "B").build(); case 0: - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("node.attr.tag", "A").build(); + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put("node.attr.tag", "A").build(); } return super.nodeSettings(nodeOrdinal); } public void testSingleShardAllocation() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(settingsBuilder() + client().admin().indices().prepareCreate("test").setSettings(Settings.builder() .put("index.number_of_shards", "1").put("index.number_of_replicas", 0).put("index.routing.allocation.include.tag", "A")).execute().actionGet(); ensureGreen(); ClusterSearchShardsResponse response = client().admin().cluster().prepareSearchShards("test").execute().actionGet(); @@ -76,7 +75,7 @@ public class ClusterSearchShardsIT extends ESIntegTestCase { } public void testMultipleShardsSingleNodeAllocation() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(settingsBuilder() + client().admin().indices().prepareCreate("test").setSettings(Settings.builder() .put("index.number_of_shards", "4").put("index.number_of_replicas", 0).put("index.routing.allocation.include.tag", "A")).execute().actionGet(); ensureGreen(); @@ -95,9 +94,9 @@ public class ClusterSearchShardsIT extends ESIntegTestCase { } public void testMultipleIndicesAllocation() throws Exception { - client().admin().indices().prepareCreate("test1").setSettings(settingsBuilder() + client().admin().indices().prepareCreate("test1").setSettings(Settings.builder() .put("index.number_of_shards", "4").put("index.number_of_replicas", 1)).execute().actionGet(); - client().admin().indices().prepareCreate("test2").setSettings(settingsBuilder() + client().admin().indices().prepareCreate("test2").setSettings(Settings.builder() .put("index.number_of_shards", "4").put("index.number_of_replicas", 1)).execute().actionGet(); client().admin().indices().prepareAliases() .addAliasAction(AliasAction.newAddAliasAction("test1", "routing_alias").routing("ABC")) diff --git a/core/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java b/core/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java index 03ab18e33fc..255693669c1 100644 --- a/core/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java @@ -48,7 +48,6 @@ import java.util.Map; import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; @@ -223,7 +222,7 @@ public class RoutingIteratorTests extends ESAllocationTestCase { } public void testAttributePreferenceRouting() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.awareness.attributes", "rack_id,zone") @@ -278,7 +277,7 @@ public class RoutingIteratorTests extends ESAllocationTestCase { } public void testNodeSelectorRouting(){ - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .build()); @@ -335,7 +334,7 @@ public class RoutingIteratorTests extends ESAllocationTestCase { public void testShardsAndPreferNodeRouting() { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .build()); @@ -396,7 +395,7 @@ public class RoutingIteratorTests extends ESAllocationTestCase { } public void testReplicaShardPreferenceIters() throws Exception { - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 10) .build()); diff --git a/core/src/test/java/org/elasticsearch/common/settings/ScopedSettingsTests.java b/core/src/test/java/org/elasticsearch/common/settings/ScopedSettingsTests.java index d78f0dd033c..ae5342513ca 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/ScopedSettingsTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/ScopedSettingsTests.java @@ -240,7 +240,7 @@ public class ScopedSettingsTests extends ESTestCase { public static IndexMetaData newIndexMeta(String name, Settings indexSettings) { - Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(indexSettings) diff --git a/core/src/test/java/org/elasticsearch/common/settings/SettingsTests.java b/core/src/test/java/org/elasticsearch/common/settings/SettingsTests.java index eb6cc56816f..a15b250913e 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/SettingsTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/SettingsTests.java @@ -28,7 +28,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.contains; @@ -41,7 +40,7 @@ import static org.hamcrest.Matchers.nullValue; */ public class SettingsTests extends ESTestCase { public void testCamelCaseSupport() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("test.camelCase", "bar") .build(); assertThat(settings.get("test.camelCase"), equalTo("bar")); @@ -49,7 +48,7 @@ public class SettingsTests extends ESTestCase { } public void testLoadFromDelimitedString() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .loadFromDelimitedString("key1=value1;key2=value2", ';') .build(); assertThat(settings.get("key1"), equalTo("value1")); @@ -57,7 +56,7 @@ public class SettingsTests extends ESTestCase { assertThat(settings.getAsMap().size(), equalTo(2)); assertThat(settings.toDelimitedString(';'), equalTo("key1=value1;key2=value2;")); - settings = settingsBuilder() + settings = Settings.builder() .loadFromDelimitedString("key1=value1;key2=value2;", ';') .build(); assertThat(settings.get("key1"), equalTo("value1")); @@ -69,20 +68,20 @@ public class SettingsTests extends ESTestCase { public void testReplacePropertiesPlaceholderSystemProperty() { String value = System.getProperty("java.home"); assertFalse(value.isEmpty()); - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("setting1", "${java.home}") .replacePropertyPlaceholders() .build(); assertThat(settings.get("setting1"), equalTo(value)); assertNull(System.getProperty("_test_property_should_not_exist")); - settings = settingsBuilder() + settings = Settings.builder() .put("setting1", "${_test_property_should_not_exist:defaultVal1}") .replacePropertyPlaceholders() .build(); assertThat(settings.get("setting1"), equalTo("defaultVal1")); - settings = settingsBuilder() + settings = Settings.builder() .put("setting1", "${_test_property_should_not_exist:}") .replacePropertyPlaceholders() .build(); @@ -90,7 +89,7 @@ public class SettingsTests extends ESTestCase { } public void testReplacePropertiesPlaceholderIgnoreEnvUnset() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("setting1", "${env.UNSET_ENV_VAR}") .replacePropertyPlaceholders() .build(); @@ -98,7 +97,7 @@ public class SettingsTests extends ESTestCase { } public void testReplacePropertiesPlaceholderIgnoresPrompt() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("setting1", "${prompt.text}") .put("setting2", "${prompt.secret}") .replacePropertyPlaceholders() @@ -108,7 +107,7 @@ public class SettingsTests extends ESTestCase { } public void testUnFlattenedSettings() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("foo", "abc") .put("bar", "def") .put("baz.foo", "ghi") @@ -132,7 +131,7 @@ public class SettingsTests extends ESTestCase { } public void testFallbackToFlattenedSettings() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("foo", "abc") .put("foo.bar", "def") .put("foo.baz", "ghi").build(); @@ -143,7 +142,7 @@ public class SettingsTests extends ESTestCase { Matchers.hasEntry("foo.bar", "def"), Matchers.hasEntry("foo.baz", "ghi"))); - settings = settingsBuilder() + settings = Settings.builder() .put("foo.bar", "def") .put("foo", "abc") .put("foo.baz", "ghi") @@ -157,7 +156,7 @@ public class SettingsTests extends ESTestCase { } public void testGetAsSettings() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("foo", "abc") .put("foo.bar", "def") .put("foo.baz", "ghi").build(); @@ -168,7 +167,7 @@ public class SettingsTests extends ESTestCase { } public void testNames() { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("bar", "baz") .put("foo", "abc") .put("foo.bar", "def") @@ -188,114 +187,114 @@ public class SettingsTests extends ESTestCase { public void testThatArraysAreOverriddenCorrectly() throws IOException { // overriding a single value with an array - Settings settings = settingsBuilder() - .put(settingsBuilder().putArray("value", "1").build()) - .put(settingsBuilder().putArray("value", "2", "3").build()) + Settings settings = Settings.builder() + .put(Settings.builder().putArray("value", "1").build()) + .put(Settings.builder().putArray("value", "2", "3").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("2", "3")); - settings = settingsBuilder() - .put(settingsBuilder().put("value", "1").build()) - .put(settingsBuilder().putArray("value", "2", "3").build()) + settings = Settings.builder() + .put(Settings.builder().put("value", "1").build()) + .put(Settings.builder().putArray("value", "2", "3").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("2", "3")); - settings = settingsBuilder() + settings = Settings.builder() .put(new YamlSettingsLoader(false).load("value: 1")) .put(new YamlSettingsLoader(false).load("value: [ 2, 3 ]")) .build(); assertThat(settings.getAsArray("value"), arrayContaining("2", "3")); - settings = settingsBuilder() - .put(settingsBuilder().put("value.with.deep.key", "1").build()) - .put(settingsBuilder().putArray("value.with.deep.key", "2", "3").build()) + settings = Settings.builder() + .put(Settings.builder().put("value.with.deep.key", "1").build()) + .put(Settings.builder().putArray("value.with.deep.key", "2", "3").build()) .build(); assertThat(settings.getAsArray("value.with.deep.key"), arrayContaining("2", "3")); // overriding an array with a shorter array - settings = settingsBuilder() - .put(settingsBuilder().putArray("value", "1", "2").build()) - .put(settingsBuilder().putArray("value", "3").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value", "1", "2").build()) + .put(Settings.builder().putArray("value", "3").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("3")); - settings = settingsBuilder() - .put(settingsBuilder().putArray("value", "1", "2", "3").build()) - .put(settingsBuilder().putArray("value", "4", "5").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value", "1", "2", "3").build()) + .put(Settings.builder().putArray("value", "4", "5").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("4", "5")); - settings = settingsBuilder() - .put(settingsBuilder().putArray("value.deep.key", "1", "2", "3").build()) - .put(settingsBuilder().putArray("value.deep.key", "4", "5").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value.deep.key", "1", "2", "3").build()) + .put(Settings.builder().putArray("value.deep.key", "4", "5").build()) .build(); assertThat(settings.getAsArray("value.deep.key"), arrayContaining("4", "5")); // overriding an array with a longer array - settings = settingsBuilder() - .put(settingsBuilder().putArray("value", "1", "2").build()) - .put(settingsBuilder().putArray("value", "3", "4", "5").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value", "1", "2").build()) + .put(Settings.builder().putArray("value", "3", "4", "5").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("3", "4", "5")); - settings = settingsBuilder() - .put(settingsBuilder().putArray("value.deep.key", "1", "2", "3").build()) - .put(settingsBuilder().putArray("value.deep.key", "4", "5").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value.deep.key", "1", "2", "3").build()) + .put(Settings.builder().putArray("value.deep.key", "4", "5").build()) .build(); assertThat(settings.getAsArray("value.deep.key"), arrayContaining("4", "5")); // overriding an array with a single value - settings = settingsBuilder() - .put(settingsBuilder().putArray("value", "1", "2").build()) - .put(settingsBuilder().put("value", "3").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value", "1", "2").build()) + .put(Settings.builder().put("value", "3").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("3")); - settings = settingsBuilder() - .put(settingsBuilder().putArray("value.deep.key", "1", "2").build()) - .put(settingsBuilder().put("value.deep.key", "3").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value.deep.key", "1", "2").build()) + .put(Settings.builder().put("value.deep.key", "3").build()) .build(); assertThat(settings.getAsArray("value.deep.key"), arrayContaining("3")); // test that other arrays are not overridden - settings = settingsBuilder() - .put(settingsBuilder().putArray("value", "1", "2", "3").putArray("a", "b", "c").build()) - .put(settingsBuilder().putArray("value", "4", "5").putArray("d", "e", "f").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value", "1", "2", "3").putArray("a", "b", "c").build()) + .put(Settings.builder().putArray("value", "4", "5").putArray("d", "e", "f").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("4", "5")); assertThat(settings.getAsArray("a"), arrayContaining("b", "c")); assertThat(settings.getAsArray("d"), arrayContaining("e", "f")); - settings = settingsBuilder() - .put(settingsBuilder().putArray("value.deep.key", "1", "2", "3").putArray("a", "b", "c").build()) - .put(settingsBuilder().putArray("value.deep.key", "4", "5").putArray("d", "e", "f").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value.deep.key", "1", "2", "3").putArray("a", "b", "c").build()) + .put(Settings.builder().putArray("value.deep.key", "4", "5").putArray("d", "e", "f").build()) .build(); assertThat(settings.getAsArray("value.deep.key"), arrayContaining("4", "5")); assertThat(settings.getAsArray("a"), notNullValue()); assertThat(settings.getAsArray("d"), notNullValue()); // overriding a deeper structure with an array - settings = settingsBuilder() - .put(settingsBuilder().put("value.data", "1").build()) - .put(settingsBuilder().putArray("value", "4", "5").build()) + settings = Settings.builder() + .put(Settings.builder().put("value.data", "1").build()) + .put(Settings.builder().putArray("value", "4", "5").build()) .build(); assertThat(settings.getAsArray("value"), arrayContaining("4", "5")); // overriding an array with a deeper structure - settings = settingsBuilder() - .put(settingsBuilder().putArray("value", "4", "5").build()) - .put(settingsBuilder().put("value.data", "1").build()) + settings = Settings.builder() + .put(Settings.builder().putArray("value", "4", "5").build()) + .put(Settings.builder().put("value.data", "1").build()) .build(); assertThat(settings.get("value.data"), is("1")); assertThat(settings.get("value"), is(nullValue())); } public void testPrefixNormalization() { - Settings settings = settingsBuilder().normalizePrefix("foo.").build(); + Settings settings = Settings.builder().normalizePrefix("foo.").build(); assertThat(settings.names().size(), equalTo(0)); - settings = settingsBuilder() + settings = Settings.builder() .put("bar", "baz") .normalizePrefix("foo.") .build(); @@ -305,7 +304,7 @@ public class SettingsTests extends ESTestCase { assertThat(settings.get("foo.bar"), equalTo("baz")); - settings = settingsBuilder() + settings = Settings.builder() .put("bar", "baz") .put("foo.test", "test") .normalizePrefix("foo.") @@ -316,7 +315,7 @@ public class SettingsTests extends ESTestCase { assertThat(settings.get("foo.bar"), equalTo("baz")); assertThat(settings.get("foo.test"), equalTo("test")); - settings = settingsBuilder() + settings = Settings.builder() .put("foo.test", "test") .normalizePrefix("foo.") .build(); diff --git a/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java b/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java index 154ef8ee039..e6c134ca5f6 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -32,7 +31,7 @@ public class JsonSettingsLoaderTests extends ESTestCase { public void testSimpleJsonSettings() throws Exception { final String json = "/org/elasticsearch/common/settings/loader/test-settings.json"; - final Settings settings = settingsBuilder() + final Settings settings = Settings.builder() .loadFromStream(json, getClass().getResourceAsStream(json)) .build(); @@ -50,7 +49,7 @@ public class JsonSettingsLoaderTests extends ESTestCase { public void testDuplicateKeysThrowsException() { final String json = "{\"foo\":\"bar\",\"foo\":\"baz\"}"; - final SettingsException e = expectThrows(SettingsException.class, () -> settingsBuilder().loadFromSource(json).build()); + final SettingsException e = expectThrows(SettingsException.class, () -> Settings.builder().loadFromSource(json).build()); assertEquals(e.getCause().getClass(), ElasticsearchParseException.class); assertThat( e.toString(), diff --git a/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java b/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java index 2e2a187da0b..e06b7589423 100644 --- a/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java +++ b/core/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -32,7 +31,7 @@ public class YamlSettingsLoaderTests extends ESTestCase { public void testSimpleYamlSettings() throws Exception { final String yaml = "/org/elasticsearch/common/settings/loader/test-settings.yml"; - final Settings settings = settingsBuilder() + final Settings settings = Settings.builder() .loadFromStream(yaml, getClass().getResourceAsStream(yaml)) .build(); @@ -53,7 +52,7 @@ public class YamlSettingsLoaderTests extends ESTestCase { final SettingsException e = expectThrows( SettingsException.class, - () -> settingsBuilder().loadFromStream(yaml, getClass().getResourceAsStream(yaml)).build()); + () -> Settings.builder().loadFromStream(yaml, getClass().getResourceAsStream(yaml)).build()); assertThat(e.getMessage(), containsString("Failed to load settings")); } @@ -62,13 +61,13 @@ public class YamlSettingsLoaderTests extends ESTestCase { final SettingsException e = expectThrows( SettingsException.class, - () -> settingsBuilder().loadFromStream(yaml, getClass().getResourceAsStream(yaml)).build()); + () -> Settings.builder().loadFromStream(yaml, getClass().getResourceAsStream(yaml)).build()); assertThat(e.getMessage(), containsString("Failed to load settings")); } public void testDuplicateKeysThrowsException() { final String yaml = "foo: bar\nfoo: baz"; - final SettingsException e = expectThrows(SettingsException.class, () -> settingsBuilder().loadFromSource(yaml).build()); + final SettingsException e = expectThrows(SettingsException.class, () -> Settings.builder().loadFromSource(yaml).build()); assertEquals(e.getCause().getClass(), ElasticsearchParseException.class); assertThat( e.toString(), diff --git a/core/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelIT.java b/core/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelIT.java index aac715b6013..fb54e9b6f52 100644 --- a/core/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelIT.java +++ b/core/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelIT.java @@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.equalTo; */ public class WriteConsistencyLevelIT extends ESIntegTestCase { public void testWriteConsistencyLevelReplication2() throws Exception { - prepareCreate("test", 1, Settings.settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 2)).execute().actionGet(); + prepareCreate("test", 1, Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 2)).execute().actionGet(); ClusterHealthResponse clusterHealth = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForActiveShards(1).setWaitForYellowStatus().execute().actionGet(); logger.info("Done Cluster Health, status {}", clusterHealth.getStatus()); diff --git a/core/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryIT.java b/core/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryIT.java index e3c11a6e322..95ad650cd16 100644 --- a/core/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryIT.java +++ b/core/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryIT.java @@ -79,7 +79,7 @@ public class ZenUnicastDiscoveryIT extends ESIntegTestCase { int currentNumNodes = randomIntBetween(3, 5); final int min_master_nodes = currentNumNodes / 2 + 1; int currentNumOfUnicastHosts = randomIntBetween(min_master_nodes, currentNumNodes); - final Settings settings = Settings.settingsBuilder() + final Settings settings = Settings.builder() .put("discovery.zen.join_timeout", TimeValue.timeValueSeconds(10)) .put("discovery.zen.minimum_master_nodes", min_master_nodes) .build(); diff --git a/core/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryIT.java b/core/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryIT.java index 6ea3967c46f..54cfc8b456f 100644 --- a/core/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryIT.java +++ b/core/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryIT.java @@ -222,7 +222,7 @@ public class ZenDiscoveryIT extends ESIntegTestCase { } public void testHandleNodeJoin_incompatibleClusterState() throws UnknownHostException { - Settings nodeSettings = Settings.settingsBuilder() + Settings nodeSettings = Settings.builder() .put("discovery.type", "zen") // <-- To override the local setting if set externally .build(); String masterOnlyNode = internalCluster().startMasterOnlyNode(nodeSettings); @@ -275,7 +275,7 @@ public class ZenDiscoveryIT extends ESIntegTestCase { } public void testHandleNodeJoin_incompatibleMinVersion() throws UnknownHostException { - Settings nodeSettings = Settings.settingsBuilder() + Settings nodeSettings = Settings.builder() .put("discovery.type", "zen") // <-- To override the local setting if set externally .build(); String nodeName = internalCluster().startNode(nodeSettings, Version.V_5_0_0_alpha1); @@ -320,7 +320,7 @@ public class ZenDiscoveryIT extends ESIntegTestCase { " }\n" + "}"; - Settings nodeSettings = Settings.settingsBuilder() + Settings nodeSettings = Settings.builder() .put("discovery.type", "zen") // <-- To override the local setting if set externally .build(); internalCluster().startNode(nodeSettings); diff --git a/core/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingIT.java b/core/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingIT.java index f1259dd9700..e788943348c 100644 --- a/core/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingIT.java +++ b/core/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingIT.java @@ -73,7 +73,7 @@ public class UnicastZenPingIT extends ESTestCase { InetSocketTransportAddress addressB = (InetSocketTransportAddress) transportB.boundAddress().publishAddress(); - Settings hostsSettings = Settings.settingsBuilder().putArray("discovery.zen.ping.unicast.hosts", + Settings hostsSettings = Settings.builder().putArray("discovery.zen.ping.unicast.hosts", NetworkAddress.format(new InetSocketAddress(addressA.address().getAddress(), addressA.address().getPort())), NetworkAddress.format(new InetSocketAddress(addressB.address().getAddress(), addressB.address().getPort()))) .build(); diff --git a/core/src/test/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateActionTests.java b/core/src/test/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateActionTests.java index ceb125deda2..335d1b3e8fd 100644 --- a/core/src/test/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateActionTests.java +++ b/core/src/test/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateActionTests.java @@ -295,7 +295,7 @@ public class PublishClusterStateActionTests extends ESTestCase { // cluster state update 4 - update settings previousClusterState = clusterState; - MetaData metaData = MetaData.builder(clusterState.metaData()).transientSettings(Settings.settingsBuilder().put("foo", "bar").build()).build(); + MetaData metaData = MetaData.builder(clusterState.metaData()).transientSettings(Settings.builder().put("foo", "bar").build()).build(); clusterState = ClusterState.builder(clusterState).metaData(metaData).incrementVersion().build(); publishStateAndWait(nodeA.action, clusterState, previousClusterState); assertSameStateFromDiff(nodeB.clusterState, clusterState); diff --git a/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java b/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java index 0a62d2829d3..855ce83343b 100644 --- a/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java +++ b/core/src/test/java/org/elasticsearch/env/EnvironmentTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.test.ESTestCase; import java.io.IOException; import java.net.URL; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; @@ -49,7 +48,7 @@ public class EnvironmentTests extends ESTestCase { Environment environment = newEnvironment(); assertThat(environment.resolveRepoFile("/test/repos/repo1"), nullValue()); assertThat(environment.resolveRepoFile("test/repos/repo1"), nullValue()); - environment = newEnvironment(settingsBuilder().putArray(Environment.PATH_REPO_SETTING.getKey(), "/test/repos", "/another/repos", "/test/repos/../other").build()); + environment = newEnvironment(Settings.builder().putArray(Environment.PATH_REPO_SETTING.getKey(), "/test/repos", "/another/repos", "/test/repos/../other").build()); assertThat(environment.resolveRepoFile("/test/repos/repo1"), notNullValue()); assertThat(environment.resolveRepoFile("test/repos/repo1"), notNullValue()); assertThat(environment.resolveRepoFile("/another/repos/repo1"), notNullValue()); diff --git a/core/src/test/java/org/elasticsearch/explain/ExplainActionIT.java b/core/src/test/java/org/elasticsearch/explain/ExplainActionIT.java index efe0b547416..20d8846528c 100644 --- a/core/src/test/java/org/elasticsearch/explain/ExplainActionIT.java +++ b/core/src/test/java/org/elasticsearch/explain/ExplainActionIT.java @@ -52,7 +52,7 @@ public class ExplainActionIT extends ESIntegTestCase { public void testSimple() throws Exception { assertAcked(prepareCreate("test") .addAlias(new Alias("alias")) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen("test"); client().prepareIndex("test", "test", "1").setSource("field", "value1").get(); diff --git a/core/src/test/java/org/elasticsearch/gateway/GatewayIndexStateIT.java b/core/src/test/java/org/elasticsearch/gateway/GatewayIndexStateIT.java index 55955ba269d..9572f06b3e2 100644 --- a/core/src/test/java/org/elasticsearch/gateway/GatewayIndexStateIT.java +++ b/core/src/test/java/org/elasticsearch/gateway/GatewayIndexStateIT.java @@ -38,19 +38,14 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.discovery.zen.elect.ElectMasterService; import org.elasticsearch.env.NodeEnvironment; -import org.elasticsearch.index.IndexService; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.indices.IndexClosedException; -import org.elasticsearch.indices.IndicesService; import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; import org.elasticsearch.test.InternalTestCluster.RestartCallback; -import java.io.IOException; - -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -199,7 +194,7 @@ public class GatewayIndexStateIT extends ESIntegTestCase { logger.info("--> cleaning nodes"); logger.info("--> starting 1 master node non data"); - internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); + internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); logger.info("--> create an index"); client().admin().indices().prepareCreate("test").execute().actionGet(); @@ -208,7 +203,7 @@ public class GatewayIndexStateIT extends ESIntegTestCase { internalCluster().closeNonSharedNodes(false); logger.info("--> starting 1 master node non data again"); - internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); + internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); logger.info("--> waiting for test index to be created"); ClusterHealthResponse health = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setIndices("test") @@ -224,8 +219,8 @@ public class GatewayIndexStateIT extends ESIntegTestCase { logger.info("--> cleaning nodes"); logger.info("--> starting 1 master node non data"); - internalCluster().startNode(settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); - internalCluster().startNode(settingsBuilder().put(Node.NODE_MASTER_SETTING.getKey(), false).build()); + internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); + internalCluster().startNode(Settings.builder().put(Node.NODE_MASTER_SETTING.getKey(), false).build()); logger.info("--> create an index"); client().admin().indices().prepareCreate("test").execute().actionGet(); diff --git a/core/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java b/core/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java index 5a223c7d53c..b7d8a916315 100644 --- a/core/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java +++ b/core/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java @@ -29,6 +29,7 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.test.ESAllocationTestCase; @@ -38,7 +39,6 @@ import java.util.Set; import static java.util.Collections.emptySet; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -56,7 +56,7 @@ public class GatewayMetaStateTests extends ESAllocationTestCase { ClusterChangedEvent generateEvent(boolean initializing, boolean versionChanged, boolean masterEligible) { //ridiculous settings to make sure we don't run into uninitialized because fo default - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 100) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", 100) @@ -113,7 +113,7 @@ public class GatewayMetaStateTests extends ESAllocationTestCase { ClusterChangedEvent generateCloseEvent(boolean masterEligible) { //ridiculous settings to make sure we don't run into uninitialized because fo default - AllocationService strategy = createAllocationService(settingsBuilder() + AllocationService strategy = createAllocationService(Settings.builder() .put("cluster.routing.allocation.node_concurrent_recoveries", 100) .put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), "always") .put("cluster.routing.allocation.cluster_concurrent_rebalance", 100) diff --git a/core/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesIT.java b/core/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesIT.java index 59f7dd24644..d6e8d61a7a6 100644 --- a/core/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesIT.java +++ b/core/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesIT.java @@ -31,7 +31,6 @@ import org.elasticsearch.test.ESIntegTestCase.Scope; import java.util.Set; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; @@ -57,13 +56,13 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { public void testRecoverAfterNodes() throws Exception { logger.info("--> start node (1)"); - Client clientNode1 = startNode(settingsBuilder().put("gateway.recover_after_nodes", 3)); + Client clientNode1 = startNode(Settings.builder().put("gateway.recover_after_nodes", 3)); assertThat(clientNode1.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start node (2)"); - Client clientNode2 = startNode(settingsBuilder().put("gateway.recover_after_nodes", 3)); + Client clientNode2 = startNode(Settings.builder().put("gateway.recover_after_nodes", 3)); Thread.sleep(BLOCK_WAIT_TIMEOUT.millis()); assertThat(clientNode1.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), @@ -73,7 +72,7 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start node (3)"); - Client clientNode3 = startNode(settingsBuilder().put("gateway.recover_after_nodes", 3)); + Client clientNode3 = startNode(Settings.builder().put("gateway.recover_after_nodes", 3)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clientNode1).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clientNode2).isEmpty(), equalTo(true)); @@ -82,13 +81,13 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { public void testRecoverAfterMasterNodes() throws Exception { logger.info("--> start master_node (1)"); - Client master1 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); + Client master1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start data_node (1)"); - Client data1 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); + Client data1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); @@ -97,7 +96,7 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start data_node (2)"); - Client data2 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); + Client data2 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); @@ -109,7 +108,7 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start master_node (2)"); - Client master2 = startNode(settingsBuilder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); + Client master2 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master1).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master2).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data1).isEmpty(), equalTo(true)); @@ -118,13 +117,13 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { public void testRecoverAfterDataNodes() throws Exception { logger.info("--> start master_node (1)"); - Client master1 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); + Client master1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start data_node (1)"); - Client data1 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); + Client data1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); @@ -133,7 +132,7 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start master_node (2)"); - Client master2 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); + Client master2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), true)); assertThat(master2.admin().cluster().prepareState().setLocal(true).execute().actionGet() .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); @@ -145,7 +144,7 @@ public class RecoverAfterNodesIT extends ESIntegTestCase { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); logger.info("--> start data_node (2)"); - Client data2 = startNode(settingsBuilder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); + Client data2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master1).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master2).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data1).isEmpty(), equalTo(true)); diff --git a/core/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityIT.java b/core/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityIT.java index 5146c7dc917..93a6b96bf00 100644 --- a/core/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityIT.java +++ b/core/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityIT.java @@ -81,9 +81,9 @@ public class RecoveryBackwardsCompatibilityIT extends ESBackcompatTestCase { SearchResponse countResponse = client().prepareSearch().setSize(0).get(); assertHitCount(countResponse, numDocs); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none")).execute().actionGet(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none")).execute().actionGet(); backwardsCluster().upgradeAllNodes(); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "all")).execute().actionGet(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "all")).execute().actionGet(); ensureGreen(); countResponse = client().prepareSearch().setSize(0).get(); diff --git a/core/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayIT.java b/core/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayIT.java index 9a85f404bf7..ae4c6f4f5c1 100644 --- a/core/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayIT.java +++ b/core/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayIT.java @@ -49,7 +49,6 @@ import java.util.stream.IntStream; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; @@ -283,7 +282,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase { internalCluster().fullRestart(new RestartCallback() { @Override public Settings onNodeStopped(String nodeName) throws Exception { - return settingsBuilder().put("gateway.recover_after_nodes", 2).build(); + return Settings.builder().put("gateway.recover_after_nodes", 2).build(); } @Override @@ -304,7 +303,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase { public void testLatestVersionLoaded() throws Exception { // clean two nodes - internalCluster().startNodesAsync(2, settingsBuilder().put("gateway.recover_after_nodes", 2).build()).get(); + internalCluster().startNodesAsync(2, Settings.builder().put("gateway.recover_after_nodes", 2).build()).get(); client().prepareIndex("test", "type1", "1").setSource(jsonBuilder().startObject().field("field", "value1").endObject()).execute().actionGet(); client().admin().indices().prepareFlush().execute().actionGet(); @@ -378,7 +377,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase { } public void testReusePeerRecovery() throws Exception { - final Settings settings = settingsBuilder() + final Settings settings = Settings.builder() .put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false) .put("gateway.recover_after_nodes", 4) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING.getKey(), 4) @@ -414,7 +413,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase { // Disable allocations while we are closing nodes client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(settingsBuilder() + .setTransientSettings(Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), EnableAllocationDecider.Allocation.NONE)) .get(); logger.info("--> full cluster restart"); @@ -431,7 +430,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase { logger.info("--> disabling allocation while the cluster is shut down{}", useSyncIds ? "" : " a second time"); // Disable allocations while we are closing nodes client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(settingsBuilder() + .setTransientSettings(Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), EnableAllocationDecider.Allocation.NONE)) .get(); @@ -490,11 +489,11 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase { public void testRecoveryDifferentNodeOrderStartup() throws Exception { // we need different data paths so we make sure we start the second node fresh - final String node_1 = internalCluster().startNode(settingsBuilder().put(Environment.PATH_DATA_SETTING.getKey(), createTempDir()).build()); + final String node_1 = internalCluster().startNode(Settings.builder().put(Environment.PATH_DATA_SETTING.getKey(), createTempDir()).build()); client().prepareIndex("test", "type1", "1").setSource("field", "value").execute().actionGet(); - internalCluster().startNode(settingsBuilder().put(Environment.PATH_DATA_SETTING.getKey(), createTempDir()).build()); + internalCluster().startNode(Settings.builder().put(Environment.PATH_DATA_SETTING.getKey(), createTempDir()).build()); ensureGreen(); Map primaryTerms = assertAndCapturePrimaryTerms(null); diff --git a/core/src/test/java/org/elasticsearch/gateway/ReusePeerRecoverySharedTest.java b/core/src/test/java/org/elasticsearch/gateway/ReusePeerRecoverySharedTest.java index c82e60bf933..a6f4e6db23b 100644 --- a/core/src/test/java/org/elasticsearch/gateway/ReusePeerRecoverySharedTest.java +++ b/core/src/test/java/org/elasticsearch/gateway/ReusePeerRecoverySharedTest.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.indices.recovery.RecoveryState; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ESIntegTestCase.client; import static org.elasticsearch.test.ESTestCase.randomBoolean; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -87,7 +86,7 @@ public class ReusePeerRecoverySharedTest { logger.info("--> disabling allocation while the cluster is shut down"); // Disable allocations while we are closing nodes - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder() + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), EnableAllocationDecider.Allocation.NONE)).get(); logger.info("--> full cluster restart"); restartCluster.run(); @@ -103,7 +102,7 @@ public class ReusePeerRecoverySharedTest { logger.info("--> disabling allocation while the cluster is shut down{}", useSyncIds ? "" : " a second time"); // Disable allocations while we are closing nodes client().admin().cluster().prepareUpdateSettings().setTransientSettings( - settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), EnableAllocationDecider.Allocation.NONE)) + Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), EnableAllocationDecider.Allocation.NONE)) .get(); logger.info("--> full cluster restart"); restartCluster.run(); diff --git a/core/src/test/java/org/elasticsearch/get/GetActionIT.java b/core/src/test/java/org/elasticsearch/get/GetActionIT.java index 64d293e8bd0..53f55048316 100644 --- a/core/src/test/java/org/elasticsearch/get/GetActionIT.java +++ b/core/src/test/java/org/elasticsearch/get/GetActionIT.java @@ -67,7 +67,7 @@ public class GetActionIT extends ESIntegTestCase { public void testSimpleGet() { assertAcked(prepareCreate("test") - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1)) + .setSettings(Settings.builder().put("index.refresh_interval", -1)) .addAlias(new Alias("alias"))); ensureGreen(); @@ -195,7 +195,7 @@ public class GetActionIT extends ESIntegTestCase { public void testSimpleMultiGet() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen(); MultiGetResponse response = client().prepareMultiGet().add(indexOrAlias(), "type1", "1").get(); @@ -259,7 +259,7 @@ public class GetActionIT extends ESIntegTestCase { assertAcked(prepareCreate("test") .addMapping("type1", mapping1) .addMapping("type2", mapping2) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen(); GetResponse response = client().prepareGet("test", "type1", "1").get(); @@ -321,7 +321,7 @@ public class GetActionIT extends ESIntegTestCase { public void testGetWithVersion() { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen(); GetResponse response = client().prepareGet("test", "type1", "1").get(); @@ -420,7 +420,7 @@ public class GetActionIT extends ESIntegTestCase { public void testMultiGetWithVersion() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen(); MultiGetResponse response = client().prepareMultiGet().add(indexOrAlias(), "type1", "1").get(); @@ -538,7 +538,7 @@ public class GetActionIT extends ESIntegTestCase { .addMapping("parent") .addMapping("my-type1", "_timestamp", "enabled=true", "_ttl", "enabled=true", "_parent", "type=parent") .addAlias(new Alias("alias")) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); client().prepareIndex("test", "my-type1", "1") .setRouting("1") @@ -594,7 +594,7 @@ public class GetActionIT extends ESIntegTestCase { .startObject("field2").field("type", "text").endObject() .endObject().endObject() .endObject().endObject().endObject()) - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.builder().put("index.refresh_interval", -1))); client().prepareIndex("test", "my-type1", "1") .setSource(jsonBuilder().startObject().startObject("field1").field("field2", "value1").endObject().endObject()) @@ -619,7 +619,7 @@ public class GetActionIT extends ESIntegTestCase { public void testGetFieldsComplexField() throws Exception { assertAcked(prepareCreate("my-index") - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1)) + .setSettings(Settings.builder().put("index.refresh_interval", -1)) .addMapping("my-type2", jsonBuilder().startObject().startObject("my-type2").startObject("properties") .startObject("field1").field("type", "object").startObject("properties") .startObject("field2").field("type", "object").startObject("properties") diff --git a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTests.java b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTests.java index 5d4330ec5c3..e63d45734ee 100644 --- a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTests.java +++ b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTests.java @@ -54,7 +54,6 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.http.netty.NettyHttpClient.returnHttpResponseBodies; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.hasSize; @@ -92,7 +91,7 @@ public class NettyHttpServerPipeliningTests extends ESTestCase { } public void testThatHttpPipeliningWorksWhenEnabled() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("http.pipelining", true) .put("http.port", "0") .build(); @@ -109,7 +108,7 @@ public class NettyHttpServerPipeliningTests extends ESTestCase { } public void testThatHttpPipeliningCanBeDisabled() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("http.pipelining", false) .put("http.port", "0") .build(); diff --git a/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIT.java b/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIT.java index 8f7765dcc87..0097ddf2c24 100644 --- a/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIT.java +++ b/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIT.java @@ -22,7 +22,6 @@ import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.http.HttpServerTransport; -import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; @@ -34,7 +33,6 @@ import java.util.Collection; import java.util.List; import java.util.Locale; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.http.netty.NettyHttpClient.returnOpaqueIds; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.hasSize; @@ -46,7 +44,7 @@ import static org.hamcrest.Matchers.hasSize; public class NettyPipeliningDisabledIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put(NetworkModule.HTTP_ENABLED.getKey(), true).put("http.pipelining", false).build(); + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(NetworkModule.HTTP_ENABLED.getKey(), true).put("http.pipelining", false).build(); } public void testThatNettyHttpServerDoesNotSupportPipelining() throws Exception { diff --git a/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIT.java b/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIT.java index 93f54cb7628..b2f1b8cb592 100644 --- a/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIT.java +++ b/core/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIT.java @@ -22,7 +22,6 @@ import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.http.HttpServerTransport; -import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; @@ -33,7 +32,6 @@ import java.util.Collection; import java.util.List; import java.util.Locale; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.http.netty.NettyHttpClient.returnOpaqueIds; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; @@ -43,7 +41,7 @@ import static org.hamcrest.Matchers.is; public class NettyPipeliningEnabledIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put(NetworkModule.HTTP_ENABLED.getKey(), true).put("http.pipelining", true).build(); + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(NetworkModule.HTTP_ENABLED.getKey(), true).put("http.pipelining", true).build(); } public void testThatNettyHttpServerSupportsPipelining() throws Exception { diff --git a/core/src/test/java/org/elasticsearch/index/IndexModuleTests.java b/core/src/test/java/org/elasticsearch/index/IndexModuleTests.java index b59a54bc4b8..303d36cf084 100644 --- a/core/src/test/java/org/elasticsearch/index/IndexModuleTests.java +++ b/core/src/test/java/org/elasticsearch/index/IndexModuleTests.java @@ -282,7 +282,7 @@ public class IndexModuleTests extends ESTestCase { } public void testAddSimilarity() throws IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.similarity.my_similarity.type", "test_similarity") .put("index.similarity.my_similarity.key", "there is a key") @@ -326,7 +326,7 @@ public class IndexModuleTests extends ESTestCase { } public void testSetupUnknownSimilarity() throws IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "test_similarity") .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) @@ -341,7 +341,7 @@ public class IndexModuleTests extends ESTestCase { } public void testSetupWithoutType() throws IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.foo", "bar") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) @@ -356,7 +356,7 @@ public class IndexModuleTests extends ESTestCase { } public void testCannotRegisterProvidedImplementations() { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexModule module = new IndexModule(IndexSettingsModule.newIndexSettings("foo", indexSettings), null, new AnalysisRegistry(null, environment)); @@ -383,7 +383,7 @@ public class IndexModuleTests extends ESTestCase { } public void testRegisterCustomQueryCache() throws IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), "custom") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); @@ -403,7 +403,7 @@ public class IndexModuleTests extends ESTestCase { } public void testDefaultQueryCacheImplIsSelected() throws IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexModule module = new IndexModule(IndexSettingsModule.newIndexSettings("foo", indexSettings), null, new AnalysisRegistry(null, environment)); @@ -414,7 +414,7 @@ public class IndexModuleTests extends ESTestCase { } public void testForceCacheType() throws IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), "none") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); diff --git a/core/src/test/java/org/elasticsearch/index/IndexSettingsTests.java b/core/src/test/java/org/elasticsearch/index/IndexSettingsTests.java index 9d74b1ce429..07962153d13 100644 --- a/core/src/test/java/org/elasticsearch/index/IndexSettingsTests.java +++ b/core/src/test/java/org/elasticsearch/index/IndexSettingsTests.java @@ -45,7 +45,7 @@ public class IndexSettingsTests extends ESTestCase { public void testRunListener() { Version version = VersionUtils.getPreviousVersion(); - Settings theSettings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version) + Settings theSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version) .put(IndexMetaData.SETTING_INDEX_UUID, "0xdeadbeef").build(); final AtomicInteger integer = new AtomicInteger(0); Setting integerSetting = Setting.intSetting("index.test.setting.int", -1, @@ -67,7 +67,7 @@ public class IndexSettingsTests extends ESTestCase { public void testMergedSettingsArePassed() { Version version = VersionUtils.getPreviousVersion(); - Settings theSettings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version) + Settings theSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version) .put(IndexMetaData.SETTING_INDEX_UUID, "0xdeadbeef").build(); final AtomicInteger integer = new AtomicInteger(0); final StringBuilder builder = new StringBuilder(); @@ -97,7 +97,7 @@ public class IndexSettingsTests extends ESTestCase { public void testSettingsConsistency() { Version version = VersionUtils.getPreviousVersion(); - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version) + IndexMetaData metaData = newIndexMeta("index", Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version) .build()); IndexSettings settings = new IndexSettings(metaData, Settings.EMPTY); assertEquals(version, settings.getIndexVersionCreated()); @@ -110,7 +110,7 @@ public class IndexSettingsTests extends ESTestCase { assertTrue(ex.getMessage(), ex.getMessage().startsWith("version mismatch on settings update expected: ")); } - metaData = newIndexMeta("index", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + metaData = newIndexMeta("index", Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_INDEX_UUID, "0xdeadbeef").build()); settings = new IndexSettings(metaData, Settings.EMPTY); try { @@ -136,12 +136,12 @@ public class IndexSettingsTests extends ESTestCase { public void testNodeSettingsAreContained() { final int numShards = randomIntBetween(1, 10); final int numReplicas = randomIntBetween(0, 10); - Settings theSettings = Settings.settingsBuilder(). + Settings theSettings = Settings.builder(). put("index.foo.bar", 0) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, numReplicas) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards).build(); - Settings nodeSettings = Settings.settingsBuilder().put("index.foo.bar", 43).build(); + Settings nodeSettings = Settings.builder().put("index.foo.bar", 43).build(); final AtomicInteger indexValue = new AtomicInteger(0); Setting integerSetting = Setting.intSetting("index.foo.bar", -1, Property.Dynamic, Property.IndexScope); IndexSettings settings = newIndexSettings(newIndexMeta("index", theSettings), nodeSettings, integerSetting); @@ -150,7 +150,7 @@ public class IndexSettingsTests extends ESTestCase { assertEquals(numShards, settings.getNumberOfShards()); assertEquals(0, indexValue.get()); - assertTrue(settings.updateIndexMetaData(newIndexMeta("index", Settings.settingsBuilder(). + assertTrue(settings.updateIndexMetaData(newIndexMeta("index", Settings.builder(). put("index.foo.bar", 42) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, numReplicas + 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards).build()))); @@ -158,7 +158,7 @@ public class IndexSettingsTests extends ESTestCase { assertEquals(42, indexValue.get()); assertSame(nodeSettings, settings.getNodeSettings()); - assertTrue(settings.updateIndexMetaData(newIndexMeta("index", Settings.settingsBuilder() + assertTrue(settings.updateIndexMetaData(newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, numReplicas + 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards).build()))); assertEquals(43, indexValue.get()); @@ -166,7 +166,7 @@ public class IndexSettingsTests extends ESTestCase { } public static IndexMetaData newIndexMeta(String name, Settings indexSettings) { - Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(indexSettings) @@ -177,7 +177,7 @@ public class IndexSettingsTests extends ESTestCase { public void testUpdateDurability() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), "async") .build()); @@ -187,7 +187,7 @@ public class IndexSettingsTests extends ESTestCase { "request").build())); assertEquals(Translog.Durability.REQUEST, settings.getTranslogDurability()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -195,7 +195,7 @@ public class IndexSettingsTests extends ESTestCase { } public void testIsWarmerEnabled() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexSettings.INDEX_WARMER_ENABLED_SETTING.getKey(), false) .build()); @@ -204,7 +204,7 @@ public class IndexSettingsTests extends ESTestCase { settings.updateIndexMetaData(newIndexMeta("index", Settings.builder().put(IndexSettings.INDEX_WARMER_ENABLED_SETTING.getKey(), "true").build())); assertTrue(settings.isWarmerEnabled()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -213,7 +213,7 @@ public class IndexSettingsTests extends ESTestCase { public void testRefreshInterval() { String refreshInterval = getRandomTimeString(); - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexSettings.INDEX_REFRESH_INTERVAL_SETTING.getKey(), refreshInterval) .build()); @@ -237,7 +237,7 @@ public class IndexSettingsTests extends ESTestCase { } public void testMaxResultWindow() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexSettings.MAX_RESULT_WINDOW_SETTING.getKey(), 15) .build()); @@ -249,7 +249,7 @@ public class IndexSettingsTests extends ESTestCase { settings.updateIndexMetaData(newIndexMeta("index", Settings.EMPTY)); assertEquals(IndexSettings.MAX_RESULT_WINDOW_SETTING.get(Settings.EMPTY).intValue(), settings.getMaxResultWindow()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -258,7 +258,7 @@ public class IndexSettingsTests extends ESTestCase { public void testGCDeletesSetting() { TimeValue gcDeleteSetting = new TimeValue(Math.abs(randomInt()), TimeUnit.MILLISECONDS); - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), gcDeleteSetting.getStringRep()) .build()); @@ -276,7 +276,7 @@ public class IndexSettingsTests extends ESTestCase { } public void testIsTTLPurgeDisabled() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexSettings.INDEX_TTL_DISABLE_PURGE_SETTING.getKey(), false) .build()); @@ -289,7 +289,7 @@ public class IndexSettingsTests extends ESTestCase { settings.updateIndexMetaData(newIndexMeta("index", Settings.EMPTY)); assertFalse("reset to default", settings.isTTLPurgeDisabled()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -300,7 +300,7 @@ public class IndexSettingsTests extends ESTestCase { ByteSizeValue translogFlushThresholdSize = new ByteSizeValue(Math.abs(randomInt())); ByteSizeValue actualValue = ByteSizeValue.parseBytesSizeValue(translogFlushThresholdSize.toString(), IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey()); - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), translogFlushThresholdSize.toString()) .build()); diff --git a/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java b/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java index ada7fc950fd..57db042164f 100644 --- a/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java +++ b/core/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasIT.java @@ -135,7 +135,7 @@ public class IndexWithShadowReplicasIT extends ESIntegTestCase { assertNoFailures(client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).execute().actionGet()); assertAcked(client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()))); CreateSnapshotResponse createSnapshotResponse = client().admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("foo").get(); assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0)); diff --git a/core/src/test/java/org/elasticsearch/index/IndexingSlowLogTests.java b/core/src/test/java/org/elasticsearch/index/IndexingSlowLogTests.java index 9e05122322a..0c202ee71be 100644 --- a/core/src/test/java/org/elasticsearch/index/IndexingSlowLogTests.java +++ b/core/src/test/java/org/elasticsearch/index/IndexingSlowLogTests.java @@ -63,7 +63,7 @@ public class IndexingSlowLogTests extends ESTestCase { } public void testReformatSetting() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_REFORMAT_SETTING.getKey(), false) .build()); @@ -79,7 +79,7 @@ public class IndexingSlowLogTests extends ESTestCase { settings.updateIndexMetaData(newIndexMeta("index", Settings.EMPTY)); assertTrue(log.isReformat()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -96,7 +96,7 @@ public class IndexingSlowLogTests extends ESTestCase { public void testLevelSetting() { SlowLogLevel level = randomFrom(SlowLogLevel.values()); - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_LEVEL_SETTING.getKey(), level) .build()); @@ -117,7 +117,7 @@ public class IndexingSlowLogTests extends ESTestCase { settings.updateIndexMetaData(newIndexMeta("index", Settings.EMPTY)); assertEquals(SlowLogLevel.TRACE, log.getLevel()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -133,7 +133,7 @@ public class IndexingSlowLogTests extends ESTestCase { } public void testSetLevels() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_TRACE_SETTING.getKey(), "100ms") .put(IndexingSlowLog.INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG_SETTING.getKey(), "200ms") @@ -158,7 +158,7 @@ public class IndexingSlowLogTests extends ESTestCase { assertEquals(TimeValue.timeValueMillis(320).nanos(), log.getIndexInfoThreshold()); assertEquals(TimeValue.timeValueMillis(420).nanos(), log.getIndexWarnThreshold()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings.updateIndexMetaData(metaData); @@ -204,7 +204,7 @@ public class IndexingSlowLogTests extends ESTestCase { } private IndexMetaData newIndexMeta(String name, Settings indexSettings) { - Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(indexSettings) diff --git a/core/src/test/java/org/elasticsearch/index/SearchSlowLogTests.java b/core/src/test/java/org/elasticsearch/index/SearchSlowLogTests.java index 15bf60baab4..855291ace6c 100644 --- a/core/src/test/java/org/elasticsearch/index/SearchSlowLogTests.java +++ b/core/src/test/java/org/elasticsearch/index/SearchSlowLogTests.java @@ -29,7 +29,7 @@ import org.elasticsearch.test.ESTestCase; public class SearchSlowLogTests extends ESTestCase { public void testReformatSetting() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(SearchSlowLog.INDEX_SEARCH_SLOWLOG_REFORMAT.getKey(), false) .build()); @@ -45,7 +45,7 @@ public class SearchSlowLogTests extends ESTestCase { settings.updateIndexMetaData(newIndexMeta("index", Settings.EMPTY)); assertTrue(log.isReformat()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -62,7 +62,7 @@ public class SearchSlowLogTests extends ESTestCase { public void testLevelSetting() { SlowLogLevel level = randomFrom(SlowLogLevel.values()); - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(SearchSlowLog.INDEX_SEARCH_SLOWLOG_LEVEL.getKey(), level) .build()); @@ -83,7 +83,7 @@ public class SearchSlowLogTests extends ESTestCase { settings.updateIndexMetaData(newIndexMeta("index", Settings.EMPTY)); assertEquals(SlowLogLevel.TRACE, log.getLevel()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings = new IndexSettings(metaData, Settings.EMPTY); @@ -99,7 +99,7 @@ public class SearchSlowLogTests extends ESTestCase { } public void testSetQueryLevels() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(SearchSlowLog.INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_TRACE_SETTING.getKey(), "100ms") .put(SearchSlowLog.INDEX_SEARCH_SLOWLOG_THRESHOLD_QUERY_DEBUG_SETTING.getKey(), "200ms") @@ -124,7 +124,7 @@ public class SearchSlowLogTests extends ESTestCase { assertEquals(TimeValue.timeValueMillis(320).nanos(), log.getQueryInfoThreshold()); assertEquals(TimeValue.timeValueMillis(420).nanos(), log.getQueryWarnThreshold()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings.updateIndexMetaData(metaData); @@ -170,7 +170,7 @@ public class SearchSlowLogTests extends ESTestCase { } public void testSetFetchLevels() { - IndexMetaData metaData = newIndexMeta("index", Settings.settingsBuilder() + IndexMetaData metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(SearchSlowLog.INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_TRACE_SETTING.getKey(), "100ms") .put(SearchSlowLog.INDEX_SEARCH_SLOWLOG_THRESHOLD_FETCH_DEBUG_SETTING.getKey(), "200ms") @@ -195,7 +195,7 @@ public class SearchSlowLogTests extends ESTestCase { assertEquals(TimeValue.timeValueMillis(320).nanos(), log.getFetchInfoThreshold()); assertEquals(TimeValue.timeValueMillis(420).nanos(), log.getFetchWarnThreshold()); - metaData = newIndexMeta("index", Settings.settingsBuilder() + metaData = newIndexMeta("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build()); settings.updateIndexMetaData(metaData); @@ -242,7 +242,7 @@ public class SearchSlowLogTests extends ESTestCase { private IndexMetaData newIndexMeta(String name, Settings indexSettings) { - Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(indexSettings) diff --git a/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java b/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java index 9dfeb4438ad..c86e8360fe3 100644 --- a/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java +++ b/core/src/test/java/org/elasticsearch/index/TransportIndexFailuresIT.java @@ -51,7 +51,7 @@ import static org.hamcrest.Matchers.equalTo; @ESIntegTestCase.SuppressLocalMode public class TransportIndexFailuresIT extends ESIntegTestCase { - private static final Settings nodeSettings = Settings.settingsBuilder() + private static final Settings nodeSettings = Settings.builder() .put("discovery.type", "zen") // <-- To override the local setting if set externally .put(FaultDetection.PING_TIMEOUT_SETTING.getKey(), "1s") // <-- for hitting simulated network failures quickly .put(FaultDetection.PING_RETRIES_SETTING.getKey(), "1") // <-- for hitting simulated network failures quickly diff --git a/core/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java index ba3f8b2e100..7b6d74a418c 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java @@ -21,17 +21,16 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.test.ESTokenStreamTestCase; import java.io.IOException; import java.io.StringReader; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - public class ASCIIFoldingTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testDefault() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_ascii_folding.type", "asciifolding") .build()); @@ -44,7 +43,7 @@ public class ASCIIFoldingTokenFilterFactoryTests extends ESTokenStreamTestCase { } public void testPreserveOriginal() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_ascii_folding.type", "asciifolding") .put("index.analysis.filter.my_ascii_folding.preserve_original", true) diff --git a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java index 6468fae9397..329396cb6c5 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java @@ -35,13 +35,11 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.ModuleTestCase; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.analysis.filter1.MyFilterTokenFilterFactory; import org.elasticsearch.indices.analysis.AnalysisModule; import org.elasticsearch.indices.analysis.HunspellService; import org.elasticsearch.test.IndexSettingsModule; -import org.elasticsearch.test.VersionUtils; import org.hamcrest.MatcherAssert; import java.io.BufferedWriter; @@ -54,7 +52,6 @@ import java.nio.file.Path; import java.util.Collections; import java.util.Set; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; @@ -80,7 +77,7 @@ public class AnalysisModuleTests extends ModuleTestCase { } private Settings loadFromClasspath(String path) { - return settingsBuilder().loadFromStream(path, getClass().getResourceAsStream(path)) + return Settings.builder().loadFromStream(path, getClass().getResourceAsStream(path)) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); @@ -105,7 +102,7 @@ public class AnalysisModuleTests extends ModuleTestCase { public void testVersionedAnalyzers() throws Exception { String yaml = "/org/elasticsearch/index/analysis/test1.yml"; - Settings settings2 = settingsBuilder() + Settings settings2 = Settings.builder() .loadFromStream(yaml, getClass().getResourceAsStream(yaml)) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_2_0_0) @@ -129,7 +126,7 @@ public class AnalysisModuleTests extends ModuleTestCase { } private void assertTokenFilter(String name, Class clazz) throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build(); AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settings); @@ -222,7 +219,7 @@ public class AnalysisModuleTests extends ModuleTestCase { String[] words = new String[]{"donau", "dampf", "schiff", "spargel", "creme", "suppe"}; Path wordListFile = generateWordList(words); - settings = settingsBuilder().loadFromSource("index: \n word_list_path: " + wordListFile.toAbsolutePath()).build(); + settings = Settings.builder().loadFromSource("index: \n word_list_path: " + wordListFile.toAbsolutePath()).build(); Set wordList = Analysis.getWordSet(env, settings, "index.word_list"); MatcherAssert.assertThat(wordList.size(), equalTo(6)); @@ -271,7 +268,7 @@ public class AnalysisModuleTests extends ModuleTestCase { } public void testDeprecatedPositionOffsetGap() throws IOException { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.analyzer.custom.tokenizer", "standard") .put("index.analysis.analyzer.custom.position_offset_gap", "128") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) @@ -287,7 +284,7 @@ public class AnalysisModuleTests extends ModuleTestCase { } public void testRegisterHunspellDictionary() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build(); diff --git a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisServiceTests.java b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisServiceTests.java index 3c1e167fb2c..ee94f3366b4 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisServiceTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisServiceTests.java @@ -41,7 +41,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.instanceOf; public class AnalysisServiceTests extends ESTestCase { @@ -127,7 +126,7 @@ public class AnalysisServiceTests extends ESTestCase { public void testConfigureCamelCaseTokenFilter() throws IOException { // tests a filter that Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build(); - Settings indexSettings = settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.filter.wordDelimiter.type", "word_delimiter") .put("index.analysis.filter.wordDelimiter.split_on_numerics", false) @@ -173,7 +172,7 @@ public class AnalysisServiceTests extends ESTestCase { public void testCameCaseOverride() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build(); - Settings indexSettings = settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.filter.wordDelimiter.type", "word_delimiter") .put("index.analysis.filter.wordDelimiter.split_on_numerics", false) @@ -191,7 +190,7 @@ public class AnalysisServiceTests extends ESTestCase { assertSame(analysisService.tokenFilter("porterStem"), analysisService.tokenFilter("porter_stem")); //unconfigured - IndexSettings idxSettings1 = IndexSettingsModule.newIndexSettings("index", settingsBuilder() + IndexSettings idxSettings1 = IndexSettingsModule.newIndexSettings("index", Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); AnalysisService analysisService1 = new AnalysisRegistry(null, new Environment(settings)).build(idxSettings1); assertSame(analysisService1.tokenFilter("wordDelimiter"), analysisService1.tokenFilter("word_delimiter")); @@ -200,7 +199,7 @@ public class AnalysisServiceTests extends ESTestCase { public void testBuiltInAnalyzersAreCached() throws IOException { Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build(); - Settings indexSettings = settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", indexSettings); AnalysisService analysisService = new AnalysisRegistry(null, new Environment(settings)).build(idxSettings); diff --git a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java index 37943773cef..b4042164e23 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java @@ -38,20 +38,19 @@ import java.nio.file.Path; import java.util.Arrays; import java.util.List; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; public class AnalysisTests extends ESTestCase { public void testParseStemExclusion() { /* Comma separated list */ - Settings settings = settingsBuilder().put("stem_exclusion", "foo,bar").build(); + Settings settings = Settings.builder().put("stem_exclusion", "foo,bar").build(); CharArraySet set = Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET); assertThat(set.contains("foo"), is(true)); assertThat(set.contains("bar"), is(true)); assertThat(set.contains("baz"), is(false)); /* Array */ - settings = settingsBuilder().putArray("stem_exclusion", "foo","bar").build(); + settings = Settings.builder().putArray("stem_exclusion", "foo","bar").build(); set = Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET); assertThat(set.contains("foo"), is(true)); assertThat(set.contains("bar"), is(true)); diff --git a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java index e1f9e36bbd9..3e33123f932 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java @@ -35,7 +35,7 @@ import java.util.Collections; public class AnalysisTestsHelper { public static AnalysisService createAnalysisServiceFromClassPath(Path baseDir, String resource) throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .loadFromStream(resource, AnalysisTestsHelper.class.getResourceAsStream(resource)) .put(Environment.PATH_HOME_SETTING.getKey(), baseDir.toString()) .build(); diff --git a/core/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java b/core/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java index dd2df7ed550..3c791e72b5f 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java @@ -22,18 +22,15 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.ESTokenStreamTestCase; import org.elasticsearch.test.IndexSettingsModule; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - /** */ public class CharFilterTests extends ESTokenStreamTestCase { public void testMappingCharFilter() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.char_filter.my_mapping.type", "mapping") .putArray("index.analysis.char_filter.my_mapping.mappings", "ph=>f", "qu=>q") @@ -52,7 +49,7 @@ public class CharFilterTests extends ESTokenStreamTestCase { } public void testHtmlStripCharFilter() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("index.analysis.analyzer.custom_with_char_filter.tokenizer", "standard") .putArray("index.analysis.analyzer.custom_with_char_filter.char_filter", "html_strip") diff --git a/core/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java b/core/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java index fbedf42d083..2e922194099 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.lucene.all.AllEntries; import org.elasticsearch.common.lucene.all.AllTokenStream; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.analysis.compound.DictionaryCompoundWordTokenFilterFactory; import org.elasticsearch.index.analysis.filter1.MyFilterTokenFilterFactory; @@ -41,7 +40,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.instanceOf; @@ -93,7 +91,7 @@ public class CompoundAnalysisTests extends ESTestCase { private Settings getJsonSettings() { String json = "/org/elasticsearch/index/analysis/test1.json"; - return settingsBuilder() + return Settings.builder() .loadFromStream(json, getClass().getResourceAsStream(json)) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) @@ -102,7 +100,7 @@ public class CompoundAnalysisTests extends ESTestCase { private Settings getYamlSettings() { String yaml = "/org/elasticsearch/index/analysis/test1.yml"; - return settingsBuilder() + return Settings.builder() .loadFromStream(yaml, getClass().getResourceAsStream(yaml)) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) diff --git a/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java index 51d8b9214ad..45e4dd24f94 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java @@ -24,13 +24,12 @@ import org.elasticsearch.test.ESTestCase; import java.io.IOException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; public class HunspellTokenFilterFactoryTests extends ESTestCase { public void testDedup() throws IOException { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir")) .put("index.analysis.filter.en_US.type", "hunspell") @@ -43,7 +42,7 @@ public class HunspellTokenFilterFactoryTests extends ESTestCase { HunspellTokenFilterFactory hunspellTokenFilter = (HunspellTokenFilterFactory) tokenFilter; assertThat(hunspellTokenFilter.dedup(), is(true)); - settings = settingsBuilder() + settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir")) .put("index.analysis.filter.en_US.type", "hunspell") diff --git a/core/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java index a7179daff2a..35148874e18 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java @@ -41,7 +41,7 @@ public class KeepFilterFactoryTests extends ESTokenStreamTestCase { } public void testLoadOverConfiguredSettings() { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.broken_keep_filter.type", "keep") .put("index.analysis.filter.broken_keep_filter.keep_words_path", "does/not/exists.txt") @@ -57,7 +57,7 @@ public class KeepFilterFactoryTests extends ESTokenStreamTestCase { } public void testKeepWordsPathSettings() { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.non_broken_keep_filter.type", "keep") .put("index.analysis.filter.non_broken_keep_filter.keep_words_path", "does/not/exists.txt") @@ -71,7 +71,7 @@ public class KeepFilterFactoryTests extends ESTokenStreamTestCase { fail("expected IAE"); } - settings = Settings.settingsBuilder().put(settings) + settings = Settings.builder().put(settings) .put("index.analysis.filter.non_broken_keep_filter.keep_words", new String[]{"test"}) .build(); try { diff --git a/core/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java index 9111c929f95..986b79fad20 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java @@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.instanceOf; public class KeepTypesFilterFactoryTests extends ESTokenStreamTestCase { public void testKeepTypes() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.keep_numbers.type", "keep_types") .putArray("index.analysis.filter.keep_numbers.types", new String[] {"", ""}) diff --git a/core/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java index b266be9f2bd..bf17e5c7bf0 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java @@ -30,7 +30,7 @@ import java.io.StringReader; public class LimitTokenCountFilterFactoryTests extends ESTokenStreamTestCase { public void testDefault() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.limit_default.type", "limit") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); @@ -55,7 +55,7 @@ public class LimitTokenCountFilterFactoryTests extends ESTokenStreamTestCase { public void testSettings() throws IOException { { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.limit_1.type", "limit") .put("index.analysis.filter.limit_1.max_token_count", 3) .put("index.analysis.filter.limit_1.consume_all_tokens", true) @@ -70,7 +70,7 @@ public class LimitTokenCountFilterFactoryTests extends ESTokenStreamTestCase { assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.limit_1.type", "limit") .put("index.analysis.filter.limit_1.max_token_count", 3) .put("index.analysis.filter.limit_1.consume_all_tokens", false) @@ -86,7 +86,7 @@ public class LimitTokenCountFilterFactoryTests extends ESTokenStreamTestCase { } { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.limit_1.type", "limit") .put("index.analysis.filter.limit_1.max_token_count", 17) .put("index.analysis.filter.limit_1.consume_all_tokens", true) diff --git a/core/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java b/core/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java index ed307f610bd..3f5ad6fed4f 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java @@ -23,18 +23,16 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.ESTokenStreamTestCase; import org.elasticsearch.test.IndexSettingsModule; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; public class PatternCaptureTokenFilterTests extends ESTokenStreamTestCase { public void testPatternCaptureTokenFilter() throws Exception { String json = "/org/elasticsearch/index/analysis/pattern_capture.json"; - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .loadFromStream(json, getClass().getResourceAsStream(json)) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) @@ -58,7 +56,7 @@ public class PatternCaptureTokenFilterTests extends ESTokenStreamTestCase { public void testNoPatterns() { try { - new PatternCaptureGroupTokenFilterFactory(IndexSettingsModule.newIndexSettings("test", Settings.EMPTY), null, "pattern_capture", settingsBuilder().put("pattern", "foobar").build()); + new PatternCaptureGroupTokenFilterFactory(IndexSettingsModule.newIndexSettings("test", Settings.EMPTY), null, "pattern_capture", Settings.builder().put("pattern", "foobar").build()); fail ("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), containsString("required setting 'patterns' is missing")); diff --git a/core/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java b/core/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java index 06a242c8277..b1dcdec646b 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java @@ -79,7 +79,7 @@ public class PreBuiltAnalyzerTests extends ESSingleNodeTestCase { String analyzerName = randomPreBuiltAnalyzer.name().toLowerCase(Locale.ROOT); Version randomVersion = randomVersion(random()); - Settings indexSettings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, randomVersion).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, randomVersion).build(); NamedAnalyzer namedAnalyzer = new PreBuiltAnalyzerProvider(analyzerName, AnalyzerScope.INDEX, randomPreBuiltAnalyzer.getAnalyzer(randomVersion)).get(); diff --git a/core/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java index f0a6077b497..a414f412767 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java @@ -44,7 +44,7 @@ public class StemmerTokenFilterFactoryTests extends ESTokenStreamTestCase { int iters = scaledRandomIntBetween(20, 100); for (int i = 0; i < iters; i++) { Version v = VersionUtils.randomVersion(random()); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.my_english.type", "stemmer") .put("index.analysis.filter.my_english.language", "english") .put("index.analysis.analyzer.my_english.tokenizer","whitespace") @@ -71,7 +71,7 @@ public class StemmerTokenFilterFactoryTests extends ESTokenStreamTestCase { for (int i = 0; i < iters; i++) { Version v = VersionUtils.randomVersion(random()); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.my_porter2.type", "stemmer") .put("index.analysis.filter.my_porter2.language", "porter2") .put("index.analysis.analyzer.my_porter2.tokenizer","whitespace") diff --git a/core/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java b/core/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java index 4d316424a48..39641c281aa 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java @@ -23,17 +23,14 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.test.ESTokenStreamTestCase; import org.elasticsearch.test.IndexSettingsModule; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - public class StopAnalyzerTests extends ESTokenStreamTestCase { public void testDefaultsCompoundAnalysis() throws Exception { String json = "/org/elasticsearch/index/analysis/stop.json"; - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .loadFromStream(json, getClass().getResourceAsStream(json)) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) diff --git a/core/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java b/core/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java index d319ab44319..191b7ffcdf5 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java @@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.instanceOf; public class StopTokenFilterTests extends ESTokenStreamTestCase { public void testPositionIncrementSetting() throws IOException { - Builder builder = Settings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop") + Builder builder = Settings.builder().put("index.analysis.filter.my_stop.type", "stop") .put("index.analysis.filter.my_stop.enable_position_increments", false); if (random().nextBoolean()) { builder.put("index.analysis.filter.my_stop.version", "5.0"); @@ -55,7 +55,7 @@ public class StopTokenFilterTests extends ESTokenStreamTestCase { } public void testCorrectPositionIncrementSetting() throws IOException { - Builder builder = Settings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop"); + Builder builder = Settings.builder().put("index.analysis.filter.my_stop.type", "stop"); if (random().nextBoolean()) { builder.put("index.analysis.filter.my_stop.version", Version.LATEST); } else { @@ -72,7 +72,7 @@ public class StopTokenFilterTests extends ESTokenStreamTestCase { } public void testThatSuggestStopFilterWorks() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.my_stop.type", "stop") .put("index.analysis.filter.my_stop.remove_trailing", false) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) diff --git a/core/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java index c23875f8a9a..f94252caba4 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java @@ -21,17 +21,16 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.test.ESTokenStreamTestCase; import java.io.IOException; import java.io.StringReader; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testDefault() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .build()); @@ -44,7 +43,7 @@ public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase } public void testCatenateWords() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .put("index.analysis.filter.my_word_delimiter.catenate_words", "true") @@ -59,7 +58,7 @@ public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase } public void testCatenateNumbers() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .put("index.analysis.filter.my_word_delimiter.generate_number_parts", "false") @@ -74,7 +73,7 @@ public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase } public void testCatenateAll() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .put("index.analysis.filter.my_word_delimiter.generate_word_parts", "false") @@ -90,7 +89,7 @@ public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase } public void testSplitOnCaseChange() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .put("index.analysis.filter.my_word_delimiter.split_on_case_change", "false") @@ -104,7 +103,7 @@ public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase } public void testPreserveOriginal() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .put("index.analysis.filter.my_word_delimiter.preserve_original", "true") @@ -118,7 +117,7 @@ public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase } public void testStemEnglishPossessive() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .put("index.analysis.filter.my_word_delimiter.stem_english_possessive", "false") @@ -133,7 +132,7 @@ public class WordDelimiterTokenFilterFactoryTests extends ESTokenStreamTestCase /** Correct offset order when doing both parts and concatenation: PowerShot is a synonym of Power */ public void testPartsAndCatenate() throws IOException { - AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder() + AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put("index.analysis.filter.my_word_delimiter.type", "word_delimiter") .put("index.analysis.filter.my_word_delimiter.catenate_words", "true") diff --git a/core/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java b/core/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java index a9d3c8820fc..3c192052db5 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java @@ -37,7 +37,7 @@ import java.nio.file.Files; import java.nio.file.Path; public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testDefault() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.common_grams_default.type", "common_grams") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); @@ -53,7 +53,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testWithoutCommonWordsMatch() throws IOException { { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_default.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_default.type", "common_grams") .putArray("index.analysis.filter.common_grams_default.common_words", "chromosome", "protein") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); @@ -70,7 +70,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { } { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_default.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_default.type", "common_grams") .put("index.analysis.filter.common_grams_default.query_mode", false) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .putArray("index.analysis.filter.common_grams_default.common_words", "chromosome", "protein") @@ -89,7 +89,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testSettings() throws IOException { { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_1.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_1.type", "common_grams") .put("index.analysis.filter.common_grams_1.ignore_case", true) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .putArray("index.analysis.filter.common_grams_1.common_words", "the", "Or", "Not", "a", "is", "an", "they", "are") @@ -103,7 +103,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_2.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_2.type", "common_grams") .put("index.analysis.filter.common_grams_2.ignore_case", false) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .putArray("index.analysis.filter.common_grams_2.common_words", "the", "Or", "noT", "a", "is", "an", "they", "are") @@ -117,7 +117,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_3.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_3.type", "common_grams") .putArray("index.analysis.filter.common_grams_3.common_words", "the", "or", "not", "a", "is", "an", "they", "are") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); @@ -133,7 +133,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testCommonGramsAnalysis() throws IOException { String json = "/org/elasticsearch/index/analysis/commongrams/commongrams.json"; - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .loadFromStream(json, getClass().getResourceAsStream(json)) .put(Environment.PATH_HOME_SETTING.getKey(), createHome()) .build(); @@ -155,7 +155,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testQueryModeSettings() throws IOException { { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_1.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_1.type", "common_grams") .put("index.analysis.filter.common_grams_1.query_mode", true) .putArray("index.analysis.filter.common_grams_1.common_words", "the", "Or", "Not", "a", "is", "an", "they", "are") .put("index.analysis.filter.common_grams_1.ignore_case", true) @@ -170,7 +170,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_2.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_2.type", "common_grams") .put("index.analysis.filter.common_grams_2.query_mode", true) .putArray("index.analysis.filter.common_grams_2.common_words", "the", "Or", "noT", "a", "is", "an", "they", "are") .put("index.analysis.filter.common_grams_2.ignore_case", false) @@ -185,7 +185,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_3.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_3.type", "common_grams") .put("index.analysis.filter.common_grams_3.query_mode", true) .putArray("index.analysis.filter.common_grams_3.common_words", "the", "Or", "noT", "a", "is", "an", "they", "are") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) @@ -199,7 +199,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_4.type", "common_grams") + Settings settings = Settings.builder().put("index.analysis.filter.common_grams_4.type", "common_grams") .put("index.analysis.filter.common_grams_4.query_mode", true) .putArray("index.analysis.filter.common_grams_4.common_words", "the", "or", "not", "a", "is", "an", "they", "are") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) @@ -216,7 +216,7 @@ public class CommonGramsTokenFilterFactoryTests extends ESTokenStreamTestCase { public void testQueryModeCommonGramsAnalysis() throws IOException { String json = "/org/elasticsearch/index/analysis/commongrams/commongrams_query_mode.json"; - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .loadFromStream(json, getClass().getResourceAsStream(json)) .put(Environment.PATH_HOME_SETTING.getKey(), createHome()) .build(); diff --git a/core/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTests.java b/core/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTests.java index 104d778860c..d7d14d7709a 100644 --- a/core/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTests.java +++ b/core/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTests.java @@ -43,7 +43,6 @@ import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -62,7 +61,7 @@ public class SynonymsAnalysisTests extends ESTestCase { Files.copy(synonymsWordnet, config.resolve("synonyms_wordnet.txt")); String json = "/org/elasticsearch/index/analysis/synonyms/synonyms.json"; - Settings settings = settingsBuilder(). + Settings settings = Settings.builder(). loadFromStream(json, getClass().getResourceAsStream(json)) .put(Environment.PATH_HOME_SETTING.getKey(), home) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); diff --git a/core/src/test/java/org/elasticsearch/index/codec/CodecTests.java b/core/src/test/java/org/elasticsearch/index/codec/CodecTests.java index 4fb31bb4ea9..fdf1411fdf8 100644 --- a/core/src/test/java/org/elasticsearch/index/codec/CodecTests.java +++ b/core/src/test/java/org/elasticsearch/index/codec/CodecTests.java @@ -49,7 +49,6 @@ import org.elasticsearch.test.IndexSettingsModule; import java.io.IOException; import java.util.Collections; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.instanceOf; @SuppressCodecs("*") // we test against default codec so never get a random one here! @@ -93,7 +92,7 @@ public class CodecTests extends ESTestCase { } private static CodecService createCodecService() throws IOException { - Settings nodeSettings = settingsBuilder() + Settings nodeSettings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .build(); IndexSettings settings = IndexSettingsModule.newIndexSettings("_na", nodeSettings); diff --git a/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index f7e07c1d773..afdcb42ae83 100644 --- a/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -1937,7 +1937,7 @@ public class InternalEngineTests extends ESTestCase { public TranslogHandler(String indexName, ESLogger logger) { super(new ShardId("test", "_na_", 0), null, logger); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); RootObjectMapper.Builder rootBuilder = new RootObjectMapper.Builder("test"); Index index = new Index(indexName, "_na_"); IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(index, settings); diff --git a/core/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java index 4f4bbc65699..6eea0e3be3a 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java @@ -62,7 +62,6 @@ import java.util.Locale; import java.util.Map; import static com.carrotsearch.randomizedtesting.RandomizedTest.systemPropertyAsBoolean; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.mapper.string.SimpleStringMappingTests.docValuesType; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasKey; @@ -177,7 +176,7 @@ public class SimpleDateMappingTests extends ESSingleNodeTestCase { if (version.equals(Version.CURRENT)) { index = createIndex(indexName); } else { - index = createIndex(indexName, settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build()); + index = createIndex(indexName, Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build()); } client().admin().indices().preparePutMapping(indexName).setType(type).setSource(mapping).get(); return index.mapperService().documentMapper(type); @@ -337,7 +336,7 @@ public class SimpleDateMappingTests extends ESSingleNodeTestCase { } // Unless the global ignore_malformed option is set to true - Settings indexSettings = settingsBuilder().put("index.mapping.ignore_malformed", true).build(); + Settings indexSettings = Settings.builder().put("index.mapping.ignore_malformed", true).build(); defaultMapper = createIndex("test2", indexSettings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() .startObject() diff --git a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java index 9d6236234af..c38fdddd37d 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java @@ -57,7 +57,7 @@ public class SimpleExternalMappingTests extends ESSingleNodeTestCase { public void testExternalValues() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); IndexService indexService = createIndex("test", settings); MapperRegistry mapperRegistry = new MapperRegistry( Collections.singletonMap(ExternalMapperPlugin.EXTERNAL, new ExternalMapper.TypeParser(ExternalMapperPlugin.EXTERNAL, "foo")), @@ -102,7 +102,7 @@ public class SimpleExternalMappingTests extends ESSingleNodeTestCase { public void testExternalValuesWithMultifield() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); IndexService indexService = createIndex("test", settings); Map mapperParsers = new HashMap<>(); mapperParsers.put(ExternalMapperPlugin.EXTERNAL, new ExternalMapper.TypeParser(ExternalMapperPlugin.EXTERNAL, "foo")); @@ -160,7 +160,7 @@ public class SimpleExternalMappingTests extends ESSingleNodeTestCase { public void testExternalValuesWithMultifieldTwoLevels() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); IndexService indexService = createIndex("test", settings); Map mapperParsers = new HashMap<>(); mapperParsers.put(ExternalMapperPlugin.EXTERNAL, new ExternalMapper.TypeParser(ExternalMapperPlugin.EXTERNAL, "foo")); diff --git a/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java b/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java index a626d07e4c4..4d6e5cb25f7 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java @@ -69,7 +69,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -99,7 +99,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -119,7 +119,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("geohash", true).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -139,7 +139,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("geohash", true).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -159,7 +159,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -183,7 +183,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { } mapping.field("ignore_malformed", true).endObject().endObject().endObject().endObject(); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping.string())); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -232,7 +232,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { } mapping.field("ignore_malformed", false).endObject().endObject().endObject().endObject().string(); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping.string())); defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -331,7 +331,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { } mapping.field("ignore_malformed", true).endObject().endObject().endObject().endObject().string(); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping.string())); defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -389,7 +389,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("store", true).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -416,7 +416,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("store", true).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -452,7 +452,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -476,7 +476,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -502,7 +502,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("store", true).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -538,7 +538,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -563,7 +563,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("lat_lon", true).endObject().endObject().endObject().endArray().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -587,7 +587,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("store", true).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -613,7 +613,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { .field("store", true).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -649,7 +649,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { */ public void testOptionDeprecation() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapperParser parser = createIndex("test", settings).mapperService().documentMapperParser(); // test deprecation exceptions on newly created indexes try { @@ -722,7 +722,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { public void testGeoPointMapperMerge() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); String stage1Mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true) .field("geohash", true).endObject().endObject().endObject().endObject().string(); @@ -756,7 +756,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { // create index and add a test point (dr5regy6rc6z) Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); CreateIndexRequestBuilder mappingRequest = client().admin().indices().prepareCreate("test").setSettings(settings) .addMapping("pin", mapping); mappingRequest.execute().actionGet(); @@ -781,7 +781,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase { // create index and add a test point (dr5regy6rc6z) Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); CreateIndexRequestBuilder mappingRequest = client().admin().indices().prepareCreate("test").setSettings(settings) .addMapping("pin", mapping); mappingRequest.execute().actionGet(); diff --git a/core/src/test/java/org/elasticsearch/index/mapper/geo/GeohashMappingGeoPointTests.java b/core/src/test/java/org/elasticsearch/index/mapper/geo/GeohashMappingGeoPointTests.java index bd23817ba50..35795d43bef 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/geo/GeohashMappingGeoPointTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/geo/GeohashMappingGeoPointTests.java @@ -58,7 +58,7 @@ public class GeohashMappingGeoPointTests extends ESSingleNodeTestCase { .endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -82,7 +82,7 @@ public class GeohashMappingGeoPointTests extends ESSingleNodeTestCase { .endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -106,7 +106,7 @@ public class GeohashMappingGeoPointTests extends ESSingleNodeTestCase { .endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() @@ -127,7 +127,7 @@ public class GeohashMappingGeoPointTests extends ESSingleNodeTestCase { .field("geohash_precision", 10).endObject().endObject().endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); FieldMapper mapper = defaultMapper.mappers().smartNameFieldMapper("point"); assertThat(mapper, instanceOf(BaseGeoPointFieldMapper.class)); @@ -141,7 +141,7 @@ public class GeohashMappingGeoPointTests extends ESSingleNodeTestCase { .endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); FieldMapper mapper = defaultMapper.mappers().smartNameFieldMapper("point"); assertThat(mapper, instanceOf(BaseGeoPointFieldMapper.class)); @@ -155,7 +155,7 @@ public class GeohashMappingGeoPointTests extends ESSingleNodeTestCase { .endObject().endObject().string(); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); DocumentMapper defaultMapper = createIndex("test", settings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); ParsedDocument doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() diff --git a/core/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java index 5886b3e486f..0e6aea56f7e 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java @@ -27,7 +27,6 @@ import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.test.ESSingleNodeTestCase; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; @@ -105,7 +104,7 @@ public class SimpleIpMappingTests extends ESSingleNodeTestCase { } // Unless the global ignore_malformed option is set to true - Settings indexSettings = settingsBuilder().put("index.mapping.ignore_malformed", true).build(); + Settings indexSettings = Settings.builder().put("index.mapping.ignore_malformed", true).build(); defaultMapper = createIndex("test2", indexSettings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder().startObject().field("field3", "").endObject().bytes()); assertThat(doc.rootDoc().getField("field3"), nullValue()); diff --git a/core/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java b/core/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java index c4000553d6c..2ff4799bcb0 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java @@ -34,7 +34,7 @@ import static org.hamcrest.Matchers.equalTo; */ public class NullValueTests extends ESSingleNodeTestCase { public void testNullNullValue() throws Exception { - IndexService indexService = createIndex("test", Settings.settingsBuilder().build()); + IndexService indexService = createIndex("test", Settings.builder().build()); String[] typesToTest = {"integer", "long", "double", "float", "short", "date", "ip", "keyword", "boolean", "byte"}; for (String type : typesToTest) { diff --git a/core/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java b/core/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java index 4c80b74a01d..e48af8ba9ec 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.common.compress.CompressedXContent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.IndexService; -import org.elasticsearch.index.fielddata.IndexNumericFieldData.NumericType; import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.DocumentMapperParser; import org.elasticsearch.index.mapper.FieldMapper; @@ -51,7 +50,6 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.instanceOf; @@ -160,7 +158,7 @@ public class SimpleNumericTests extends ESSingleNodeTestCase { } // Unless the global ignore_malformed option is set to true - Settings indexSettings = settingsBuilder().put("index.mapping.ignore_malformed", true).build(); + Settings indexSettings = Settings.builder().put("index.mapping.ignore_malformed", true).build(); defaultMapper = createIndex("test2", indexSettings).mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); doc = defaultMapper.parse("test", "type", "1", XContentFactory.jsonBuilder() .startObject() diff --git a/core/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java index 0a8d75d42f0..a828d7850f2 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java @@ -50,9 +50,7 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collection; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.VersionUtils.randomVersion; -import static org.elasticsearch.test.VersionUtils.randomVersionBetween; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/core/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java index ca99f74610c..6776ed3a1cc 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java @@ -168,20 +168,20 @@ public class TTLMappingTests extends ESSingleNodeTestCase { } public void testNoConflictIfNothingSetAndDisabledLater() throws Exception { - IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type"); + IndexService indexService = createIndex("testindex", Settings.builder().build(), "type"); XContentBuilder mappingWithTtlDisabled = getMappingWithTtlDisabled("7d"); indexService.mapperService().merge("type", new CompressedXContent(mappingWithTtlDisabled.string()), MapperService.MergeReason.MAPPING_UPDATE, false); } public void testNoConflictIfNothingSetAndEnabledLater() throws Exception { - IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type"); + IndexService indexService = createIndex("testindex", Settings.builder().build(), "type"); XContentBuilder mappingWithTtlEnabled = getMappingWithTtlEnabled("7d"); indexService.mapperService().merge("type", new CompressedXContent(mappingWithTtlEnabled.string()), MapperService.MergeReason.MAPPING_UPDATE, false); } public void testMergeWithOnlyDefaultSet() throws Exception { XContentBuilder mappingWithTtlEnabled = getMappingWithTtlEnabled("7d"); - IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithTtlEnabled); + IndexService indexService = createIndex("testindex", Settings.builder().build(), "type", mappingWithTtlEnabled); XContentBuilder mappingWithOnlyDefaultSet = getMappingWithOnlyTtlDefaultSet("6m"); indexService.mapperService().merge("type", new CompressedXContent(mappingWithOnlyDefaultSet.string()), MapperService.MergeReason.MAPPING_UPDATE, false); CompressedXContent mappingAfterMerge = indexService.mapperService().documentMapper("type").mappingSource(); @@ -190,7 +190,7 @@ public class TTLMappingTests extends ESSingleNodeTestCase { public void testMergeWithOnlyDefaultSetTtlDisabled() throws Exception { XContentBuilder mappingWithTtlEnabled = getMappingWithTtlDisabled("7d"); - IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithTtlEnabled); + IndexService indexService = createIndex("testindex", Settings.builder().build(), "type", mappingWithTtlEnabled); CompressedXContent mappingAfterCreation = indexService.mapperService().documentMapper("type").mappingSource(); assertThat(mappingAfterCreation, equalTo(new CompressedXContent("{\"type\":{\"_ttl\":{\"enabled\":false},\"properties\":{\"field\":{\"type\":\"text\"}}}}"))); XContentBuilder mappingWithOnlyDefaultSet = getMappingWithOnlyTtlDefaultSet("6m"); diff --git a/core/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java index 73f5eae379c..e1b8dc1b4aa 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java @@ -83,7 +83,7 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { } private void testNoConflictWhileMergingAndMappingChanged(XContentBuilder mapping, XContentBuilder mappingUpdate, XContentBuilder expectedMapping) throws IOException { - IndexService indexService = createIndex("test", Settings.settingsBuilder().build(), "type", mapping); + IndexService indexService = createIndex("test", Settings.builder().build(), "type", mapping); // simulate like in MetaDataMappingService#putMapping indexService.mapperService().merge("type", new CompressedXContent(mappingUpdate.bytes()), MapperService.MergeReason.MAPPING_UPDATE, false); // make sure mappings applied @@ -104,7 +104,7 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { } protected void testConflictWhileMergingAndMappingUnchanged(XContentBuilder mapping, XContentBuilder mappingUpdate) throws IOException { - IndexService indexService = createIndex("test", Settings.settingsBuilder().build(), "type", mapping); + IndexService indexService = createIndex("test", Settings.builder().build(), "type", mapping); CompressedXContent mappingBeforeUpdate = indexService.mapperService().documentMapper("type").mappingSource(); // simulate like in MetaDataMappingService#putMapping try { @@ -122,7 +122,7 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("properties").startObject("foo").field("type", "long").endObject() .endObject().endObject().endObject(); - MapperService mapperService = createIndex("test", Settings.settingsBuilder().build(), "type", mapping).mapperService(); + MapperService mapperService = createIndex("test", Settings.builder().build(), "type", mapping).mapperService(); XContentBuilder update = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("properties").startObject("foo").field("type", "double").endObject() @@ -149,7 +149,7 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("properties").startObject("foo").field("type", "long").endObject() .endObject().endObject().endObject(); - MapperService mapperService = createIndex("test", Settings.settingsBuilder().build(), "type1", mapping).mapperService(); + MapperService mapperService = createIndex("test", Settings.builder().build(), "type1", mapping).mapperService(); XContentBuilder update = XContentFactory.jsonBuilder().startObject().startObject("type2") .startObject("properties").startObject("foo").field("type", "double").endObject() @@ -181,7 +181,7 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { .startObject("properties").startObject("foo").field("type", "long").endObject() .endObject().endObject().endObject(); XContentBuilder mapping2 = XContentFactory.jsonBuilder().startObject().startObject("type2").endObject().endObject(); - MapperService mapperService = createIndex("test", Settings.settingsBuilder().build()).mapperService(); + MapperService mapperService = createIndex("test", Settings.builder().build()).mapperService(); mapperService.merge("type1", new CompressedXContent(mapping1.string()), MapperService.MergeReason.MAPPING_UPDATE, false); mapperService.merge("type2", new CompressedXContent(mapping2.string()), MapperService.MergeReason.MAPPING_UPDATE, false); @@ -215,7 +215,7 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("properties").startObject("_id").field("type", "text").endObject() .endObject().endObject().endObject(); - MapperService mapperService = createIndex("test", Settings.settingsBuilder().build()).mapperService(); + MapperService mapperService = createIndex("test", Settings.builder().build()).mapperService(); try { mapperService.merge("type", new CompressedXContent(mapping.string()), MapperService.MergeReason.MAPPING_UPDATE, false); @@ -278,7 +278,7 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { } public void testSizeTimestampIndexParsing() throws IOException { - IndexService indexService = createIndex("test", Settings.settingsBuilder().build()); + IndexService indexService = createIndex("test", Settings.builder().build()); String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/update/default_mapping_with_disabled_root_types.json"); DocumentMapper documentMapper = indexService.mapperService().parse("type", new CompressedXContent(mapping), true); assertThat(documentMapper.mappingSource().string(), equalTo(mapping)); @@ -287,8 +287,8 @@ public class UpdateMappingTests extends ESSingleNodeTestCase { } public void testDefaultApplied() throws IOException { - createIndex("test1", Settings.settingsBuilder().build()); - createIndex("test2", Settings.settingsBuilder().build()); + createIndex("test1", Settings.builder().build()); + createIndex("test2", Settings.builder().build()); XContentBuilder defaultMapping = XContentFactory.jsonBuilder().startObject() .startObject(MapperService.DEFAULT_MAPPING).startObject("_timestamp").field("enabled", true).endObject().endObject() .endObject(); diff --git a/core/src/test/java/org/elasticsearch/index/percolator/PercolatorQueryCacheTests.java b/core/src/test/java/org/elasticsearch/index/percolator/PercolatorQueryCacheTests.java index d3ee7141e92..31b5872506d 100644 --- a/core/src/test/java/org/elasticsearch/index/percolator/PercolatorQueryCacheTests.java +++ b/core/src/test/java/org/elasticsearch/index/percolator/PercolatorQueryCacheTests.java @@ -96,7 +96,7 @@ public class PercolatorQueryCacheTests extends ESTestCase { private PercolatorQueryCache cache; void initialize(Object... fields) throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("node.name", PercolatorQueryCacheTests.class.toString()) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .build(); @@ -110,7 +110,7 @@ public class PercolatorQueryCacheTests extends ESTestCase { queryParsers.put(BoolQueryBuilder.NAME, new Tuple<>(BoolQueryBuilder.QUERY_NAME_FIELD, boolQueryParser)); IndicesQueriesRegistry indicesQueriesRegistry = new IndicesQueriesRegistry(settings, queryParsers); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings(new Index("_index", ClusterState.UNKNOWN_UUID), indexSettings); SimilarityService similarityService = new SimilarityService(idxSettings, Collections.emptyMap()); 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 228eecebe6d..7230bb5a783 100644 --- a/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java +++ b/core/src/test/java/org/elasticsearch/index/query/AbstractQueryTestCase.java @@ -193,12 +193,12 @@ public abstract class AbstractQueryTestCase> public static void init() throws IOException { // we have to prefer CURRENT since with the range of versions we support it's rather unlikely to get the current actually. Version version = randomBoolean() ? Version.CURRENT : VersionUtils.randomVersionBetween(random(), Version.V_2_0_0_beta1, Version.CURRENT); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("node.name", AbstractQueryTestCase.class.toString()) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING.getKey(), false) .build(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); final ThreadPool threadPool = new ThreadPool(settings); index = new Index(randomAsciiOfLengthBetween(1, 10), "_na_"); diff --git a/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java index 509f22249b5..be0dd053c3d 100644 --- a/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java +++ b/core/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java @@ -118,7 +118,6 @@ import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import static java.util.Collections.emptyMap; @@ -127,7 +126,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_CREATED; import static org.elasticsearch.common.lucene.Lucene.cleanLuceneIndex; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.ToXContent.EMPTY_PARAMS; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -489,7 +487,7 @@ public class IndexShardTests extends ESSingleNodeTestCase { } private void setDurability(IndexShard shard, Translog.Durability durability) { - client().admin().indices().prepareUpdateSettings(shard.shardId.getIndexName()).setSettings(settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), durability.name()).build()).get(); + client().admin().indices().prepareUpdateSettings(shard.shardId.getIndexName()).setSettings(Settings.builder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), durability.name()).build()).get(); assertEquals(durability, shard.getTranslogDurability()); } @@ -799,13 +797,13 @@ public class IndexShardTests extends ESSingleNodeTestCase { } public void testMaybeFlush() throws Exception { - createIndex("test", settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.REQUEST).build()); + createIndex("test", Settings.builder().put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.REQUEST).build()); ensureGreen(); IndicesService indicesService = getInstanceFromNode(IndicesService.class); IndexService test = indicesService.indexService(resolveIndex("test")); IndexShard shard = test.getShardOrNull(0); assertFalse(shard.shouldFlush()); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(133 /* size of the operation + header&footer*/, ByteSizeUnit.BYTES)).build()).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(133 /* size of the operation + header&footer*/, ByteSizeUnit.BYTES)).build()).get(); client().prepareIndex("test", "test", "0").setSource("{}").setRefresh(randomBoolean()).get(); assertFalse(shard.shouldFlush()); ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, new ParseContext.Document(), new BytesArray(new byte[]{1}), null); @@ -821,7 +819,7 @@ public class IndexShardTests extends ESSingleNodeTestCase { shard.getEngine().getTranslog().sync(); long size = shard.getEngine().getTranslog().sizeInBytes(); logger.info("--> current translog size: [{}] num_ops [{}] generation [{}]", shard.getEngine().getTranslog().sizeInBytes(), shard.getEngine().getTranslog().totalOperations(), shard.getEngine().getTranslog().getGeneration()); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(size, ByteSizeUnit.BYTES)) + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(size, ByteSizeUnit.BYTES)) .build()).get(); client().prepareDelete("test", "test", "2").get(); logger.info("--> translog size after delete: [{}] num_ops [{}] generation [{}]", shard.getEngine().getTranslog().sizeInBytes(), shard.getEngine().getTranslog().totalOperations(), shard.getEngine().getTranslog().getGeneration()); @@ -839,7 +837,7 @@ public class IndexShardTests extends ESSingleNodeTestCase { IndexService test = indicesService.indexService(resolveIndex("test")); final IndexShard shard = test.getShardOrNull(0); assertFalse(shard.shouldFlush()); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(133/* size of the operation + header&footer*/, ByteSizeUnit.BYTES)).build()).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(133/* size of the operation + header&footer*/, ByteSizeUnit.BYTES)).build()).get(); client().prepareIndex("test", "test", "0").setSource("{}").setRefresh(randomBoolean()).get(); assertFalse(shard.shouldFlush()); final AtomicBoolean running = new AtomicBoolean(true); diff --git a/core/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java b/core/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java index 537ce83d3d2..b2bd7e1f9ff 100644 --- a/core/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java +++ b/core/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.test.IndexSettingsModule; import java.io.IOException; import java.nio.file.Path; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; @@ -39,8 +38,8 @@ import static org.hamcrest.Matchers.is; */ public class ShardPathTests extends ESTestCase { public void testLoadShardPath() throws IOException { - try (final NodeEnvironment env = newNodeEnvironment(settingsBuilder().build())) { - Settings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_INDEX_UUID, "0xDEADBEEF") + try (final NodeEnvironment env = newNodeEnvironment(Settings.builder().build())) { + Settings.Builder builder = Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, "0xDEADBEEF") .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT); Settings settings = builder.build(); ShardId shardId = new ShardId("foo", "0xDEADBEEF", 0); @@ -57,9 +56,9 @@ public class ShardPathTests extends ESTestCase { } public void testFailLoadShardPathOnMultiState() throws IOException { - try (final NodeEnvironment env = newNodeEnvironment(settingsBuilder().build())) { + try (final NodeEnvironment env = newNodeEnvironment(Settings.builder().build())) { final String indexUUID = "0xDEADBEEF"; - Settings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_INDEX_UUID, indexUUID) + Settings.Builder builder = Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, indexUUID) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT); Settings settings = builder.build(); ShardId shardId = new ShardId("foo", indexUUID, 0); @@ -75,8 +74,8 @@ public class ShardPathTests extends ESTestCase { } public void testFailLoadShardPathIndexUUIDMissmatch() throws IOException { - try (final NodeEnvironment env = newNodeEnvironment(settingsBuilder().build())) { - Settings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_INDEX_UUID, "foobar") + try (final NodeEnvironment env = newNodeEnvironment(Settings.builder().build())) { + Settings.Builder builder = Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, "foobar") .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT); Settings settings = builder.build(); ShardId shardId = new ShardId("foo", "foobar", 0); @@ -116,7 +115,7 @@ public class ShardPathTests extends ESTestCase { final Settings indexSettings; final Settings nodeSettings; final String indexUUID = "0xDEADBEEF"; - Settings.Builder indexSettingsBuilder = settingsBuilder() + Settings.Builder indexSettingsBuilder = Settings.builder() .put(IndexMetaData.SETTING_INDEX_UUID, indexUUID) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT); final Path customPath; @@ -124,7 +123,7 @@ public class ShardPathTests extends ESTestCase { final Path path = createTempDir(); final boolean includeNodeId = randomBoolean(); indexSettings = indexSettingsBuilder.put(IndexMetaData.SETTING_DATA_PATH, "custom").build(); - nodeSettings = settingsBuilder().put(Environment.PATH_SHARED_DATA_SETTING.getKey(), path.toAbsolutePath().toAbsolutePath()) + nodeSettings = Settings.builder().put(Environment.PATH_SHARED_DATA_SETTING.getKey(), path.toAbsolutePath().toAbsolutePath()) .put(NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH.getKey(), includeNodeId).build(); if (includeNodeId) { customPath = path.resolve("custom").resolve("0"); diff --git a/core/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java b/core/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java index f26b0aea748..1c7391f670b 100644 --- a/core/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java +++ b/core/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java @@ -74,7 +74,7 @@ public class SimilarityTests extends ESSingleNodeTestCase { .endObject() .endObject().endObject().string(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "classic") .put("index.similarity.my_similarity.discount_overlaps", false) .build(); @@ -93,7 +93,7 @@ public class SimilarityTests extends ESSingleNodeTestCase { .endObject() .endObject().endObject().string(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "BM25") .put("index.similarity.my_similarity.k1", 2.0f) .put("index.similarity.my_similarity.b", 0.5f) @@ -116,7 +116,7 @@ public class SimilarityTests extends ESSingleNodeTestCase { .endObject() .endObject().endObject().string(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "DFR") .put("index.similarity.my_similarity.basic_model", "g") .put("index.similarity.my_similarity.after_effect", "l") @@ -141,7 +141,7 @@ public class SimilarityTests extends ESSingleNodeTestCase { .endObject() .endObject().endObject().string(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "IB") .put("index.similarity.my_similarity.distribution", "spl") .put("index.similarity.my_similarity.lambda", "ttf") @@ -166,7 +166,7 @@ public class SimilarityTests extends ESSingleNodeTestCase { .endObject() .endObject().endObject().string(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "DFI") .put("index.similarity.my_similarity.independence_measure", "chisquared") .build(); @@ -185,7 +185,7 @@ public class SimilarityTests extends ESSingleNodeTestCase { .endObject() .endObject().endObject().string(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "LMDirichlet") .put("index.similarity.my_similarity.mu", 3000f) .build(); @@ -204,7 +204,7 @@ public class SimilarityTests extends ESSingleNodeTestCase { .endObject() .endObject().endObject().string(); - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put("index.similarity.my_similarity.type", "LMJelinekMercer") .put("index.similarity.my_similarity.lambda", 0.7f) .build(); diff --git a/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java b/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java index 6bff253e670..367ecf76768 100644 --- a/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java +++ b/core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java @@ -95,7 +95,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.util.CollectionUtils.iterableAsArrayList; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful; @@ -496,7 +495,7 @@ public class CorruptedFileIT extends ESIntegTestCase { // it snapshots and that will write a new segments.X+1 file logger.info("--> creating repository"); assertAcked(client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath().toAbsolutePath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); diff --git a/core/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java b/core/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java index da5c1f3ecfa..f2d2afd9fc1 100644 --- a/core/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java +++ b/core/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java @@ -51,7 +51,7 @@ public class IndexStoreTests extends ESTestCase { final Path tempDir = createTempDir().resolve(index.getUUID()).resolve("0"); final IndexModule.Type[] values = IndexModule.Type.values(); final IndexModule.Type type = RandomPicks.randomFrom(random(), values); - Settings settings = Settings.settingsBuilder().put(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), type.name().toLowerCase(Locale.ROOT)) + Settings settings = Settings.builder().put(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), type.name().toLowerCase(Locale.ROOT)) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("foo", settings); FsDirectoryService service = new FsDirectoryService(indexSettings, null, new ShardPath(false, tempDir, tempDir, new ShardId(index, 0))); @@ -87,7 +87,7 @@ public class IndexStoreTests extends ESTestCase { public void testStoreDirectoryDefault() throws IOException { Index index = new Index("bar", "foo"); final Path tempDir = createTempDir().resolve(index.getUUID()).resolve("0"); - FsDirectoryService service = new FsDirectoryService(IndexSettingsModule.newIndexSettings("bar", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()), null, new ShardPath(false, tempDir, tempDir, new ShardId(index, 0))); + FsDirectoryService service = new FsDirectoryService(IndexSettingsModule.newIndexSettings("bar", Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()), null, new ShardPath(false, tempDir, tempDir, new ShardId(index, 0))); try (final Directory directory = service.newFSDirectory(tempDir, NoLockFactory.INSTANCE)) { if (Constants.WINDOWS) { assertTrue(directory.toString(), directory instanceof MMapDirectory || directory instanceof SimpleFSDirectory); @@ -100,7 +100,7 @@ public class IndexStoreTests extends ESTestCase { } public void testUpdateThrottleType() throws IOException { - Settings settings = Settings.settingsBuilder().put(IndexStoreConfig.INDICES_STORE_THROTTLE_TYPE_SETTING.getKey(), "all") + Settings settings = Settings.builder().put(IndexStoreConfig.INDICES_STORE_THROTTLE_TYPE_SETTING.getKey(), "all") .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("foo", settings); IndexStoreConfig indexStoreConfig = new IndexStoreConfig(settings); diff --git a/core/src/test/java/org/elasticsearch/index/store/StoreTests.java b/core/src/test/java/org/elasticsearch/index/store/StoreTests.java index eff41dd3ffe..fbb671e36bd 100644 --- a/core/src/test/java/org/elasticsearch/index/store/StoreTests.java +++ b/core/src/test/java/org/elasticsearch/index/store/StoreTests.java @@ -109,7 +109,7 @@ import static org.hamcrest.Matchers.nullValue; public class StoreTests extends ESTestCase { - private static final IndexSettings INDEX_SETTINGS = IndexSettingsModule.newIndexSettings("index", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, org.elasticsearch.Version.CURRENT).build()); + private static final IndexSettings INDEX_SETTINGS = IndexSettingsModule.newIndexSettings("index", Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, org.elasticsearch.Version.CURRENT).build()); public void testRefCount() throws IOException { final ShardId shardId = new ShardId("index", "_na_", 1); diff --git a/core/src/test/java/org/elasticsearch/index/translog/TranslogTests.java b/core/src/test/java/org/elasticsearch/index/translog/TranslogTests.java index ed0fd3f6958..9b6e4670794 100644 --- a/core/src/test/java/org/elasticsearch/index/translog/TranslogTests.java +++ b/core/src/test/java/org/elasticsearch/index/translog/TranslogTests.java @@ -137,7 +137,7 @@ public class TranslogTests extends ESTestCase { } private TranslogConfig getTranslogConfig(Path path) { - Settings build = Settings.settingsBuilder() + Settings build = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, org.elasticsearch.Version.CURRENT) .build(); ByteSizeValue bufferSize = randomBoolean() ? TranslogConfig.DEFAULT_BUFFER_SIZE : new ByteSizeValue(10 + randomInt(128 * 1024), ByteSizeUnit.BYTES); diff --git a/core/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java b/core/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java index 905e45cf9f7..207581022ba 100644 --- a/core/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java +++ b/core/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingNodes; -import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.Priority; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.Discovery; @@ -46,7 +45,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.equalTo; @@ -60,7 +58,7 @@ import static org.hamcrest.Matchers.nullValue; @ClusterScope(scope = Scope.TEST, numDataNodes = 0) public class IndexLifecycleActionIT extends ESIntegTestCase { public void testIndexLifecycleActionsWith11Shards1Backup() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_SHARDS, 11) .put(SETTING_NUMBER_OF_REPLICAS, 1) diff --git a/core/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerIT.java b/core/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerIT.java index b074729cdff..824dceb83f5 100644 --- a/core/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerIT.java +++ b/core/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerIT.java @@ -53,7 +53,6 @@ import java.util.function.BooleanSupplier; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.builder; import static org.elasticsearch.index.shard.IndexShardState.CLOSED; import static org.elasticsearch.index.shard.IndexShardState.CREATED; import static org.elasticsearch.index.shard.IndexShardState.POST_RECOVERY; @@ -171,14 +170,14 @@ public class IndicesLifecycleListenerIT extends ESIntegTestCase { //add a node: 3 out of the 6 shards will be relocated to it //disable allocation before starting a new node, as we need to register the listener first assertAcked(client().admin().cluster().prepareUpdateSettings() - .setPersistentSettings(builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none"))); + .setPersistentSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none"))); String node2 = internalCluster().startNode(); IndexShardStateChangeListener stateChangeListenerNode2 = new IndexShardStateChangeListener(); //add a listener that keeps track of the shard state changes internalCluster().getInstance(MockIndexEventListener.TestEventListener.class, node2).setNewDelegate(stateChangeListenerNode2); //re-enable allocation assertAcked(client().admin().cluster().prepareUpdateSettings() - .setPersistentSettings(builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "all"))); + .setPersistentSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "all"))); ensureGreen(); //the 3 relocated shards get closed on the first node @@ -188,7 +187,7 @@ public class IndicesLifecycleListenerIT extends ESIntegTestCase { //increase replicas from 0 to 1 - assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(builder().put(SETTING_NUMBER_OF_REPLICAS, 1))); + assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, 1))); ensureGreen(); //3 replicas are allocated to the first node diff --git a/core/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java b/core/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java index 046d0b4400f..6fa9d86ac58 100644 --- a/core/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java +++ b/core/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java @@ -294,7 +294,7 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase { waitForRelocation(); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).get(); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); client().admin().cluster().prepareCreateSnapshot("dummy-repo", "snap1").setWaitForCompletion(true).get(); @@ -429,7 +429,7 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase { waitForRelocation(); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).get(); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); client().admin().cluster().prepareCreateSnapshot("dummy-repo", "snap1").setWaitForCompletion(true).get(); diff --git a/core/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionIT.java b/core/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionIT.java index 23a197dbab6..4312dd6105e 100644 --- a/core/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionIT.java +++ b/core/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionIT.java @@ -21,12 +21,12 @@ package org.elasticsearch.indices.analyze; import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequestBuilder; import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase; import org.hamcrest.core.IsNull; import java.io.IOException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; @@ -118,7 +118,7 @@ public class AnalyzeActionIT extends ESIntegTestCase { public void testAnalyzeWithCharFilters() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(settingsBuilder().put(indexSettings()) + .setSettings(Settings.builder().put(indexSettings()) .put("index.analysis.char_filter.custom_mapping.type", "mapping") .putArray("index.analysis.char_filter.custom_mapping.mappings", "ph=>f", "qu=>q") .put("index.analysis.analyzer.custom_with_char_filter.tokenizer", "standard") @@ -221,7 +221,7 @@ public class AnalyzeActionIT extends ESIntegTestCase { public void testDetailAnalyze() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) .setSettings( - settingsBuilder() + Settings.builder() .put("index.analysis.char_filter.my_mapping.type", "mapping") .putArray("index.analysis.char_filter.my_mapping.mappings", "PH=>F") .put("index.analysis.analyzer.test_analyzer.type", "custom") @@ -372,7 +372,7 @@ public class AnalyzeActionIT extends ESIntegTestCase { public void testDetailAnalyzeWithMultiValuesWithCustomAnalyzer() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) .setSettings( - settingsBuilder() + Settings.builder() .put("index.analysis.char_filter.my_mapping.type", "mapping") .putArray("index.analysis.char_filter.my_mapping.mappings", "PH=>F") .put("index.analysis.analyzer.test_analyzer.type", "custom") diff --git a/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceIT.java b/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceIT.java index c539e2a68a0..84ce2c5da50 100644 --- a/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceIT.java +++ b/core/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceIT.java @@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue; @ClusterScope(scope= Scope.TEST, numDataNodes=0) public class HunspellServiceIT extends ESIntegTestCase { public void testLocaleDirectoryWithNodeLevelConfig() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir")) .put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean()) .put(HUNSPELL_IGNORE_CASE.getKey(), true) @@ -52,7 +52,7 @@ public class HunspellServiceIT extends ESIntegTestCase { } public void testLocaleDirectoryWithLocaleSpecificConfig() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/conf_dir")) .put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean()) .put(HUNSPELL_IGNORE_CASE.getKey(), true) @@ -74,7 +74,7 @@ public class HunspellServiceIT extends ESIntegTestCase { } public void testDicWithNoAff() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/no_aff_conf_dir")) .put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean()) .build(); @@ -92,7 +92,7 @@ public class HunspellServiceIT extends ESIntegTestCase { } public void testDicWithTwoAffs() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/indices/analyze/two_aff_conf_dir")) .put(HUNSPELL_LAZY_LOAD.getKey(), randomBoolean()) .build(); diff --git a/core/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java b/core/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java index 1e51133eeb8..81c9d12fbb4 100644 --- a/core/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java +++ b/core/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.junit.Before; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ESIntegTestCase.ClusterScope; import static org.elasticsearch.test.ESIntegTestCase.Scope; @@ -32,7 +31,7 @@ public class DedicatedMasterGetFieldMappingIT extends SimpleGetFieldMappingsIT { @Before public void before1() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(Node.NODE_DATA_SETTING.getKey(), false) .build(); internalCluster().startNodesAsync(settings, Settings.EMPTY).get(); diff --git a/core/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java b/core/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java index 125c4ab4059..68a176e22c3 100644 --- a/core/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java +++ b/core/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java @@ -28,6 +28,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.Priority; import org.elasticsearch.common.collect.ImmutableOpenMap; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.mapper.MapperService; @@ -47,7 +48,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_ME import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_READ; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_BLOCKS_WRITE; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_READ_ONLY; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows; @@ -63,7 +63,7 @@ public class UpdateMappingIntegrationIT extends ESIntegTestCase { public void testDynamicUpdates() throws Exception { client().admin().indices().prepareCreate("test") .setSettings( - settingsBuilder() + Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put(MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), Long.MAX_VALUE) @@ -98,7 +98,7 @@ public class UpdateMappingIntegrationIT extends ESIntegTestCase { public void testUpdateMappingWithoutType() throws Exception { client().admin().indices().prepareCreate("test") .setSettings( - settingsBuilder() + Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) ).addMapping("doc", "{\"doc\":{\"properties\":{\"body\":{\"type\":\"text\"}}}}") @@ -119,7 +119,7 @@ public class UpdateMappingIntegrationIT extends ESIntegTestCase { public void testUpdateMappingWithoutTypeMultiObjects() throws Exception { client().admin().indices().prepareCreate("test") .setSettings( - settingsBuilder() + Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) ).execute().actionGet(); @@ -139,7 +139,7 @@ public class UpdateMappingIntegrationIT extends ESIntegTestCase { public void testUpdateMappingWithConflicts() throws Exception { client().admin().indices().prepareCreate("test") .setSettings( - settingsBuilder() + Settings.builder() .put("index.number_of_shards", 2) .put("index.number_of_replicas", 0) ).addMapping("type", "{\"type\":{\"properties\":{\"body\":{\"type\":\"text\"}}}}") @@ -175,7 +175,7 @@ public class UpdateMappingIntegrationIT extends ESIntegTestCase { public void testUpdateMappingNoChanges() throws Exception { client().admin().indices().prepareCreate("test") .setSettings( - settingsBuilder() + Settings.builder() .put("index.number_of_shards", 2) .put("index.number_of_replicas", 0) ).addMapping("type", "{\"type\":{\"properties\":{\"body\":{\"type\":\"text\"}}}}") diff --git a/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopIT.java b/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopIT.java index b1b56acd8cd..02eab6dc0aa 100644 --- a/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopIT.java +++ b/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopIT.java @@ -30,7 +30,6 @@ import java.util.ArrayList; import java.util.List; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.search.aggregations.AggregationBuilders.cardinality; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -51,7 +50,7 @@ public class CircuitBreakerNoopIT extends ESIntegTestCase { } public void testNoopRequestBreaker() throws Exception { - assertAcked(prepareCreate("cb-test", 1, settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)))); + assertAcked(prepareCreate("cb-test", 1, Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)))); Client client = client(); // index some different terms so we have some field data for loading @@ -68,7 +67,7 @@ public class CircuitBreakerNoopIT extends ESIntegTestCase { } public void testNoopFielddataBreaker() throws Exception { - assertAcked(prepareCreate("cb-test", 1, settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)))); + assertAcked(prepareCreate("cb-test", 1, Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)))); Client client = client(); // index some different terms so we have some field data for loading diff --git a/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceIT.java b/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceIT.java index b6bdbf968ba..c805dd0cc69 100644 --- a/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceIT.java +++ b/core/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceIT.java @@ -44,7 +44,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.search.aggregations.AggregationBuilders.cardinality; import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST; @@ -62,7 +61,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { /** Reset all breaker settings back to their defaults */ private void reset() { logger.info("--> resetting breaker settings"); - Settings resetSettings = settingsBuilder() + Settings resetSettings = Settings.builder() .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING.getKey(), HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING.getDefaultRaw(null)) .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING.getKey(), @@ -103,7 +102,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { logger.info("--> noop breakers used, skipping test"); return; } - assertAcked(prepareCreate("cb-test", 1, settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1))) + assertAcked(prepareCreate("cb-test", 1, Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1))) .addMapping("type", "test", "type=text,fielddata=true")); final Client client = client(); @@ -119,7 +118,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { clearFieldData(); // Update circuit breaker settings - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING.getKey(), "100b") .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING.getKey(), 1.05) .build(); @@ -168,7 +167,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { clearFieldData(); // Update circuit breaker settings - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING.getKey(), "100b") .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING.getKey(), 1.05) .build(); @@ -198,7 +197,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { logger.info("--> noop breakers used, skipping test"); return; } - assertAcked(prepareCreate("cb-test", 1, settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1))) + assertAcked(prepareCreate("cb-test", 1, Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1))) .addMapping("type", "test", "type=text,fielddata=true")); Client client = client(); @@ -214,7 +213,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { long beforeReqLimit = client.admin().cluster().prepareNodesStats().setBreaker(true).get() .getNodes()[0].getBreaker().getStats(CircuitBreaker.REQUEST).getLimit(); - Settings resetSettings = settingsBuilder() + Settings resetSettings = Settings.builder() .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING.getKey(), "10b") .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING.getKey(), 1.0) .build(); @@ -235,7 +234,7 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { containsString("Data too large, data for [test] would be larger than limit of [10/10b]")); // Adjust settings so the parent breaker will fail, but the fielddata breaker doesn't - resetSettings = settingsBuilder() + resetSettings = Settings.builder() .put(HierarchyCircuitBreakerService.TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING.getKey(), "15b") .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING.getKey(), "90%") .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING.getKey(), 1.0) @@ -258,11 +257,11 @@ public class CircuitBreakerServiceIT extends ESIntegTestCase { logger.info("--> noop breakers used, skipping test"); return; } - assertAcked(prepareCreate("cb-test", 1, settingsBuilder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)))); + assertAcked(prepareCreate("cb-test", 1, Settings.builder().put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)))); Client client = client(); // Make request breaker limited to a small amount - Settings resetSettings = settingsBuilder() + Settings resetSettings = Settings.builder() .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING.getKey(), "10b") .build(); assertAcked(client.admin().cluster().prepareUpdateSettings().setTransientSettings(resetSettings)); diff --git a/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java b/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java index 87d6fcb116d..19242b1f90b 100644 --- a/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java +++ b/core/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerIT.java @@ -52,7 +52,6 @@ import java.util.Collection; import java.util.Random; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful; import static org.hamcrest.Matchers.equalTo; @@ -108,7 +107,7 @@ public class RandomExceptionCircuitBreakerIT extends ESIntegTestCase { lowLevelRate = 0d; } - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put(EXCEPTION_TOP_LEVEL_RATIO_KEY, topLevelRate) .put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate) diff --git a/core/src/test/java/org/elasticsearch/indices/recovery/IndexPrimaryRelocationIT.java b/core/src/test/java/org/elasticsearch/indices/recovery/IndexPrimaryRelocationIT.java index 9bc2ce76cc4..8677b9dbd04 100644 --- a/core/src/test/java/org/elasticsearch/indices/recovery/IndexPrimaryRelocationIT.java +++ b/core/src/test/java/org/elasticsearch/indices/recovery/IndexPrimaryRelocationIT.java @@ -44,7 +44,7 @@ public class IndexPrimaryRelocationIT extends ESIntegTestCase { public void testPrimaryRelocationWhileIndexing() throws Exception { internalCluster().ensureAtLeastNumDataNodes(randomIntBetween(2, 3)); client().admin().indices().prepareCreate("test") - .setSettings(Settings.settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) + .setSettings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) .addMapping("type", "field", "type=text") .get(); ensureGreen("test"); diff --git a/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java b/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java index 4549283e656..17b1b8e7d70 100644 --- a/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java +++ b/core/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java @@ -67,7 +67,6 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.hamcrest.Matchers.arrayWithSize; @@ -215,7 +214,7 @@ public class IndexRecoveryIT extends ESIntegTestCase { // force a shard recovery from nodeA to nodeB logger.info("--> bump replica count"); client().admin().indices().prepareUpdateSettings(INDEX_NAME) - .setSettings(settingsBuilder().put("number_of_replicas", 1)).execute().actionGet(); + .setSettings(Settings.builder().put("number_of_replicas", 1)).execute().actionGet(); ensureGreen(); logger.info("--> request recoveries"); @@ -360,7 +359,7 @@ public class IndexRecoveryIT extends ESIntegTestCase { logger.info("--> bump replica count"); client().admin().indices().prepareUpdateSettings(INDEX_NAME) - .setSettings(settingsBuilder().put("number_of_replicas", 1)).execute().actionGet(); + .setSettings(Settings.builder().put("number_of_replicas", 1)).execute().actionGet(); ensureGreen(); statsResponse = client().admin().cluster().prepareNodesStats().clear().setIndices(new CommonStatsFlags(CommonStatsFlags.Flag.Recovery)).get(); @@ -437,7 +436,7 @@ public class IndexRecoveryIT extends ESIntegTestCase { logger.info("--> create repository"); assertAcked(client().admin().cluster().preparePutRepository(REPO_NAME) - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", false) ).get()); @@ -496,7 +495,7 @@ public class IndexRecoveryIT extends ESIntegTestCase { throws ExecutionException, InterruptedException { logger.info("--> creating test index: {}", name); - assertAcked(prepareCreate(name, nodeCount, settingsBuilder().put("number_of_shards", shardCount) + assertAcked(prepareCreate(name, nodeCount, Settings.builder().put("number_of_shards", shardCount) .put("number_of_replicas", replicaCount).put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0))); ensureGreen(); diff --git a/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java b/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java index 818fa28a214..0d6d5122006 100644 --- a/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java +++ b/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java @@ -60,7 +60,7 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; public class RecoverySourceHandlerTests extends ESTestCase { - private static final IndexSettings INDEX_SETTINGS = IndexSettingsModule.newIndexSettings("index", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, org.elasticsearch.Version.CURRENT).build()); + private static final IndexSettings INDEX_SETTINGS = IndexSettingsModule.newIndexSettings("index", Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, org.elasticsearch.Version.CURRENT).build()); private final ShardId shardId = new ShardId(INDEX_SETTINGS.getIndex(), 1); private final ClusterSettings service = new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); diff --git a/core/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksIT.java b/core/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksIT.java index de5bbfbe837..d53230d3a9e 100644 --- a/core/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksIT.java +++ b/core/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksIT.java @@ -38,7 +38,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; public class GetSettingsBlocksIT extends ESIntegTestCase { public void testGetSettingsWithBlocks() throws Exception { assertAcked(prepareCreate("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.refresh_interval", -1) .put("index.merge.policy.expunge_deletes_allowed", "30") .put(MapperService.INDEX_MAPPER_DYNAMIC_SETTING.getKey(), false))); diff --git a/core/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasIT.java b/core/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasIT.java index 1a2f7e4ba18..03dade372c8 100644 --- a/core/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasIT.java +++ b/core/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasIT.java @@ -29,7 +29,6 @@ import org.elasticsearch.test.ESIntegTestCase; import java.io.IOException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -72,7 +71,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase { } logger.info("Increasing the number of replicas from 1 to 2"); - assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.number_of_replicas", 2)).execute().actionGet()); + assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.number_of_replicas", 2)).execute().actionGet()); logger.info("Running Cluster Health"); clusterHealth = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().setWaitForActiveShards(numShards.numPrimaries * 2).execute().actionGet(); logger.info("Done Cluster Health, status {}", clusterHealth.getStatus()); @@ -102,7 +101,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase { } logger.info("Decreasing number of replicas from 2 to 0"); - assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("index.number_of_replicas", 0)).get()); + assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.number_of_replicas", 0)).get()); logger.info("Running Cluster Health"); clusterHealth = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForRelocatingShards(0).setWaitForNodes(">=3").execute().actionGet(); @@ -122,7 +121,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase { public void testAutoExpandNumberOfReplicas0ToData() throws IOException { internalCluster().ensureAtMostNumDataNodes(2); logger.info("--> creating index test with auto expand replicas"); - assertAcked(prepareCreate("test", 2, settingsBuilder().put("auto_expand_replicas", "0-all"))); + assertAcked(prepareCreate("test", 2, Settings.builder().put("auto_expand_replicas", "0-all"))); NumShards numShards = getNumShards("test"); @@ -177,7 +176,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase { public void testAutoExpandNumberReplicas1ToData() throws IOException { logger.info("--> creating index test with auto expand replicas"); internalCluster().ensureAtMostNumDataNodes(2); - assertAcked(prepareCreate("test", 2, settingsBuilder().put("auto_expand_replicas", "1-all"))); + assertAcked(prepareCreate("test", 2, Settings.builder().put("auto_expand_replicas", "1-all"))); NumShards numShards = getNumShards("test"); @@ -231,7 +230,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase { public void testAutoExpandNumberReplicas2() { logger.info("--> creating index test with auto expand replicas set to 0-2"); - assertAcked(prepareCreate("test", 3, settingsBuilder().put("auto_expand_replicas", "0-2"))); + assertAcked(prepareCreate("test", 3, Settings.builder().put("auto_expand_replicas", "0-2"))); NumShards numShards = getNumShards("test"); @@ -249,7 +248,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase { allowNodes("test", 5); logger.info("--> update the auto expand replicas to 0-3"); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("auto_expand_replicas", "0-3")).execute().actionGet(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("auto_expand_replicas", "0-3")).execute().actionGet(); logger.info("--> running cluster health"); clusterHealth = client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().setWaitForActiveShards(numShards.numPrimaries * 4).execute().actionGet(); @@ -266,7 +265,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase { final int value = randomIntBetween(-10, -1); try { client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, value) ) .execute().actionGet(); diff --git a/core/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsIT.java b/core/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsIT.java index 642d646fe9e..e7e3cb32226 100644 --- a/core/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsIT.java +++ b/core/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsIT.java @@ -57,7 +57,7 @@ public class UpdateSettingsIT extends ESIntegTestCase { createIndex("test"); client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.refresh_interval", -1) .put("index.translog.flush_threshold_size", "1024b") ) @@ -72,7 +72,7 @@ public class UpdateSettingsIT extends ESIntegTestCase { } } client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .putNull("index.refresh_interval") ) .execute().actionGet(); @@ -90,7 +90,7 @@ public class UpdateSettingsIT extends ESIntegTestCase { createIndex("test"); try { client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.refresh_interval", -1) // this one can change .put("index.fielddata.cache", "none") // this one can't ) @@ -110,7 +110,7 @@ public class UpdateSettingsIT extends ESIntegTestCase { assertThat(getSettingsResponse.getSetting("test", "index.fielddata.cache"), nullValue()); client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.refresh_interval", -1) // this one can change ) .execute().actionGet(); @@ -131,7 +131,7 @@ public class UpdateSettingsIT extends ESIntegTestCase { try { client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) ) .execute().actionGet(); @@ -142,7 +142,7 @@ public class UpdateSettingsIT extends ESIntegTestCase { // expected } client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.refresh_interval", "1s") // this one can change .put("index.fielddata.cache", "none") // this one can't ) @@ -164,7 +164,7 @@ public class UpdateSettingsIT extends ESIntegTestCase { client().prepareDelete("test", "type", "1").get(); // sets version to 2 client().prepareIndex("test", "type", "1").setSource("f", 2).setVersion(2).get(); // delete is still in cache this should work & set version to 3 client().admin().indices().prepareUpdateSettings("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.gc_deletes", 0) ).get(); diff --git a/core/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java b/core/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java index 6eebc9e1f0c..f3898bc9f3c 100644 --- a/core/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java +++ b/core/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java @@ -30,12 +30,10 @@ import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.indices.IndexClosedException; import org.elasticsearch.test.ESIntegTestCase; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -98,7 +96,7 @@ public class SimpleIndexStateIT extends ESIntegTestCase { public void testFastCloseAfterCreateContinuesCreateAfterOpen() { logger.info("--> creating test index that cannot be allocated"); - client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder() + client().admin().indices().prepareCreate("test").setSettings(Settings.builder() .put("index.routing.allocation.include.tag", "no_such_node").build()).get(); ClusterHealthResponse health = client().admin().cluster().prepareHealth("test").setWaitForNodes(">=2").get(); @@ -108,7 +106,7 @@ public class SimpleIndexStateIT extends ESIntegTestCase { client().admin().indices().prepareClose("test").get(); logger.info("--> updating test index settings to allow allocation"); - client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.settingsBuilder() + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder() .put("index.routing.allocation.include.tag", "").build()).get(); client().admin().indices().prepareOpen("test").get(); @@ -137,7 +135,7 @@ public class SimpleIndexStateIT extends ESIntegTestCase { logger.info("--> creating test index with invalid settings "); try { - client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("number_of_shards", "bad")).get(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("number_of_shards", "bad")).get(); fail(); } catch (IllegalArgumentException ex) { assertEquals("Failed to parse value [bad] for setting [index.number_of_shards]", ex.getMessage()); @@ -145,7 +143,7 @@ public class SimpleIndexStateIT extends ESIntegTestCase { } logger.info("--> creating test index with valid settings "); - CreateIndexResponse response = client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("number_of_shards", 1)).get(); + CreateIndexResponse response = client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("number_of_shards", 1)).get(); assertThat(response.isAcknowledged(), equalTo(true)); } } diff --git a/core/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java b/core/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java index 492c78842b6..e29bfd33a47 100644 --- a/core/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java +++ b/core/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java @@ -76,14 +76,14 @@ public class IndexStatsIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { //Filter/Query cache is cleaned periodically, default is 60s, so make sure it runs often. Thread.sleep for 60s is bad - return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put(IndicesService.INDICES_CACHE_CLEAN_INTERVAL_SETTING.getKey(), "1ms") .build(); } @Override public Settings indexSettings() { - return Settings.settingsBuilder().put(super.indexSettings()) + return Settings.builder().put(super.indexSettings()) .put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), true) .put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), IndexModule.INDEX_QUERY_CACHE) .build(); diff --git a/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java b/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java index 59b0f4c8dd4..b500ffb7dd2 100644 --- a/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java +++ b/core/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationIT.java @@ -71,7 +71,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import static java.lang.Thread.sleep; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -82,7 +81,7 @@ import static org.hamcrest.Matchers.equalTo; public class IndicesStoreIntegrationIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { // simplify this and only use a single data path - return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put(Environment.PATH_DATA_SETTING.getKey(), "") + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(Environment.PATH_DATA_SETTING.getKey(), "") // by default this value is 1 sec in tests (30 sec in practice) but we adding disruption here // which is between 1 and 2 sec can cause each of the shard deletion requests to timeout. // to prevent this we are setting the timeout here to something highish ie. the default in practice @@ -404,7 +403,7 @@ public class IndicesStoreIntegrationIT extends ESIntegTestCase { // disable relocations when we do this, to make sure the shards are not relocated from node2 // due to rebalancing, and delete its content - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)).get(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)).get(); internalCluster().getInstance(ClusterService.class, nonMasterNode).submitStateUpdateTask("test", new ClusterStateUpdateTask(Priority.IMMEDIATE) { @Override public ClusterState execute(ClusterState currentState) throws Exception { diff --git a/core/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java b/core/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java index c979b2f4013..e1397ca47f1 100644 --- a/core/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java +++ b/core/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java @@ -33,7 +33,6 @@ import org.elasticsearch.test.ESTestCase; import org.junit.After; import org.junit.Before; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -43,7 +42,7 @@ public class InternalSettingsPreparerTests extends ESTestCase { @Before public void createBaseEnvSettings() { - baseEnvSettings = settingsBuilder() + baseEnvSettings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .build(); } @@ -81,7 +80,7 @@ public class InternalSettingsPreparerTests extends ESTestCase { terminal.addTextInput("text"); terminal.addSecretInput("replaced"); - Settings.Builder builder = settingsBuilder() + Settings.Builder builder = Settings.builder() .put(baseEnvSettings) .put("password.replace", InternalSettingsPreparer.SECRET_PROMPT_VALUE) .put("dont.replace", "prompt:secret") @@ -104,7 +103,7 @@ public class InternalSettingsPreparerTests extends ESTestCase { } public void testReplaceSecretPromptPlaceholderWithNullTerminal() { - Settings.Builder builder = settingsBuilder() + Settings.Builder builder = Settings.builder() .put(baseEnvSettings) .put("replace_me1", InternalSettingsPreparer.SECRET_PROMPT_VALUE); try { @@ -116,7 +115,7 @@ public class InternalSettingsPreparerTests extends ESTestCase { } public void testReplaceTextPromptPlaceholderWithNullTerminal() { - Settings.Builder builder = settingsBuilder() + Settings.Builder builder = Settings.builder() .put(baseEnvSettings) .put("replace_me1", InternalSettingsPreparer.TEXT_PROMPT_VALUE); try { @@ -134,7 +133,7 @@ public class InternalSettingsPreparerTests extends ESTestCase { Path config = home.resolve("config"); Files.createDirectory(config); Files.copy(garbage, config.resolve("elasticsearch.yml")); - InternalSettingsPreparer.prepareEnvironment(settingsBuilder() + InternalSettingsPreparer.prepareEnvironment(Settings.builder() .put("config.ignore_system_properties", true) .put(baseEnvSettings) .build(), null); @@ -153,7 +152,7 @@ public class InternalSettingsPreparerTests extends ESTestCase { Files.copy(properties, config.resolve("elasticsearch.properties")); try { - InternalSettingsPreparer.prepareEnvironment(settingsBuilder() + InternalSettingsPreparer.prepareEnvironment(Settings.builder() .put("config.ignore_system_properties", true) .put(baseEnvSettings) .build(), null); diff --git a/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledIT.java b/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledIT.java index d1f25a8fb4f..f839cd2583f 100644 --- a/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledIT.java +++ b/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledIT.java @@ -41,7 +41,7 @@ public class DetailedErrorsDisabledIT extends ESIntegTestCase { // Build our cluster settings @Override protected Settings nodeSettings(int nodeOrdinal) { - return Settings.settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(NetworkModule.HTTP_ENABLED.getKey(), true) .put(HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED.getKey(), false) diff --git a/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledIT.java b/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledIT.java index 4333d81b2ea..6b9d78e5468 100644 --- a/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledIT.java +++ b/core/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledIT.java @@ -41,7 +41,7 @@ import static org.hamcrest.Matchers.not; public class DetailedErrorsEnabledIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return Settings.settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(NetworkModule.HTTP_ENABLED.getKey(), true) .build(); diff --git a/core/src/test/java/org/elasticsearch/percolator/MultiPercolatorIT.java b/core/src/test/java/org/elasticsearch/percolator/MultiPercolatorIT.java index f51180f5a5a..654d2b5934f 100644 --- a/core/src/test/java/org/elasticsearch/percolator/MultiPercolatorIT.java +++ b/core/src/test/java/org/elasticsearch/percolator/MultiPercolatorIT.java @@ -19,12 +19,11 @@ package org.elasticsearch.percolator; import org.apache.lucene.search.join.ScoreMode; -import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.percolate.MultiPercolateRequestBuilder; import org.elasticsearch.action.percolate.MultiPercolateResponse; import org.elasticsearch.action.percolate.PercolateSourceBuilder; import org.elasticsearch.client.Requests; -import org.elasticsearch.common.compress.NotXContentException; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.percolator.PercolatorFieldMapper; @@ -35,7 +34,6 @@ import org.elasticsearch.test.ESIntegTestCase; import java.io.IOException; import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.smileBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.yamlBuilder; @@ -51,7 +49,6 @@ import static org.hamcrest.Matchers.arrayContainingInAnyOrder; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; @@ -365,7 +362,7 @@ public class MultiPercolatorIT extends ESIntegTestCase { // See: https://github.com/elastic/elasticsearch/issues/15908 internalCluster().ensureAtLeastNumDataNodes(2); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 1) ) diff --git a/core/src/test/java/org/elasticsearch/percolator/PercolatorIT.java b/core/src/test/java/org/elasticsearch/percolator/PercolatorIT.java index 4fbd8545e32..c0c6532bf94 100644 --- a/core/src/test/java/org/elasticsearch/percolator/PercolatorIT.java +++ b/core/src/test/java/org/elasticsearch/percolator/PercolatorIT.java @@ -62,8 +62,6 @@ import java.util.Set; import java.util.TreeSet; import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder; -import static org.elasticsearch.common.settings.Settings.builder; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.smileBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.yamlBuilder; @@ -227,7 +225,7 @@ public class PercolatorIT extends ESIntegTestCase { public void testPercolateQueriesWithRouting() throws Exception { client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 2)) + .setSettings(Settings.builder().put("index.number_of_shards", 2)) .execute().actionGet(); ensureGreen(); @@ -301,7 +299,7 @@ public class PercolatorIT extends ESIntegTestCase { // see #2814 public void testPercolateCustomAnalyzer() throws Exception { - Builder builder = builder(); + Builder builder = Settings.builder(); builder.put("index.analysis.analyzer.lwhitespacecomma.tokenizer", "whitespacecomma"); builder.putArray("index.analysis.analyzer.lwhitespacecomma.filter", "lowercase"); builder.put("index.analysis.tokenizer.whitespacecomma.type", "pattern"); @@ -1728,7 +1726,7 @@ public class PercolatorIT extends ESIntegTestCase { public void testMapUnmappedFieldAsString() throws IOException{ // If index.percolator.map_unmapped_fields_as_string is set to true, unmapped field is mapped as an analyzed string. - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.percolator.map_unmapped_fields_as_string", true); assertAcked(prepareCreate("test") @@ -1747,7 +1745,7 @@ public class PercolatorIT extends ESIntegTestCase { public void testGeoShapeWithMapUnmappedFieldAsString() throws Exception { // If index.percolator.map_unmapped_fields_as_string is set to true, unmapped field is mapped as an analyzed string. - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(indexSettings()) .put("index.percolator.map_unmapped_fields_as_string", true); assertAcked(prepareCreate("test") diff --git a/core/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginIT.java b/core/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginIT.java index 5d7b8068fe4..85d83e69b75 100644 --- a/core/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginIT.java +++ b/core/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginIT.java @@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo; public class ResponseHeaderPluginIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return Settings.settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("force.http.enabled", true) .build(); diff --git a/core/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadIT.java b/core/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadIT.java index c7b6397b3ba..5f6636a1bd7 100644 --- a/core/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadIT.java +++ b/core/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadIT.java @@ -30,6 +30,7 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Priority; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.shard.DocsStats; @@ -45,7 +46,6 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful; @@ -59,7 +59,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase { public void testRecoverWhileUnderLoadAllocateReplicasTest() throws Exception { logger.info("--> creating test index ..."); int numberOfShards = numberOfShards(); - assertAcked(prepareCreate("test", 1, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); + assertAcked(prepareCreate("test", 1, Settings.builder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); final int totalNumDocs = scaledRandomIntBetween(200, 10000); int waitFor = totalNumDocs / 10; @@ -112,7 +112,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase { public void testRecoverWhileUnderLoadAllocateReplicasRelocatePrimariesTest() throws Exception { logger.info("--> creating test index ..."); int numberOfShards = numberOfShards(); - assertAcked(prepareCreate("test", 1, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); + assertAcked(prepareCreate("test", 1, Settings.builder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); final int totalNumDocs = scaledRandomIntBetween(200, 10000); int waitFor = totalNumDocs / 10; @@ -163,7 +163,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase { public void testRecoverWhileUnderLoadWithReducedAllowedNodes() throws Exception { logger.info("--> creating test index ..."); int numberOfShards = numberOfShards(); - assertAcked(prepareCreate("test", 2, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); + assertAcked(prepareCreate("test", 2, Settings.builder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards).put(SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); final int totalNumDocs = scaledRandomIntBetween(200, 10000); int waitFor = totalNumDocs / 10; @@ -234,7 +234,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase { final int numReplicas = 0; logger.info("--> creating test index ..."); int allowNodes = 2; - assertAcked(prepareCreate("test", 3, settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, numShards).put(SETTING_NUMBER_OF_REPLICAS, numReplicas).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); + assertAcked(prepareCreate("test", 3, Settings.builder().put(SETTING_NUMBER_OF_SHARDS, numShards).put(SETTING_NUMBER_OF_REPLICAS, numReplicas).put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.ASYNC))); final int numDocs = scaledRandomIntBetween(200, 9999); @@ -257,7 +257,7 @@ public class RecoveryWhileUnderLoadIT extends ESIntegTestCase { logger.info("--> indexing threads stopped"); logger.info("--> bump up number of replicas to 1 and allow all nodes to hold the index"); allowNodes("test", 3); - assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("number_of_replicas", 1)).get()); + assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("number_of_replicas", 1)).get()); ensureGreen(TimeValue.timeValueMinutes(5)); logger.info("--> refreshing the index"); diff --git a/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java b/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java index 7e455913151..7783f9cbf83 100644 --- a/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java +++ b/core/src/test/java/org/elasticsearch/recovery/RelocationIT.java @@ -74,7 +74,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; @@ -102,7 +101,7 @@ public class RelocationIT extends ESIntegTestCase { logger.info("--> creating test index ..."); client().admin().indices().prepareCreate("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) ) @@ -156,7 +155,7 @@ public class RelocationIT extends ESIntegTestCase { logger.info("--> creating test index ..."); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", numberOfReplicas) ).execute().actionGet(); @@ -264,7 +263,7 @@ public class RelocationIT extends ESIntegTestCase { logger.info("--> creating test index ..."); client().admin().indices().prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", numberOfReplicas) .put("index.refresh_interval", -1) // we want to control refreshes c diff --git a/core/src/test/java/org/elasticsearch/recovery/SimpleRecoveryIT.java b/core/src/test/java/org/elasticsearch/recovery/SimpleRecoveryIT.java index e5f8e9ce756..6ccdae5e5ec 100644 --- a/core/src/test/java/org/elasticsearch/recovery/SimpleRecoveryIT.java +++ b/core/src/test/java/org/elasticsearch/recovery/SimpleRecoveryIT.java @@ -29,14 +29,13 @@ import static org.elasticsearch.client.Requests.flushRequest; import static org.elasticsearch.client.Requests.getRequest; import static org.elasticsearch.client.Requests.indexRequest; import static org.elasticsearch.client.Requests.refreshRequest; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; public class SimpleRecoveryIT extends ESIntegTestCase { @Override public Settings indexSettings() { - return settingsBuilder().put(super.indexSettings()).put(recoverySettings()).build(); + return Settings.builder().put(super.indexSettings()).put(recoverySettings()).build(); } protected Settings recoverySettings() { diff --git a/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java b/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java index 552ed3da495..c1c7aa5edd1 100644 --- a/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java +++ b/core/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryIT.java @@ -26,6 +26,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.index.query.QueryBuilders; @@ -49,7 +50,6 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -93,7 +93,7 @@ public class TruncatedRecoveryIT extends ESIntegTestCase { // we have no replicas so far and make sure that we allocate the primary on the lucky node assertAcked(prepareCreate("test") .addMapping("type1", "field1", "type=text", "the_id", "type=text") - .setSettings(settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numberOfShards()) + .setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numberOfShards()) .put("index.routing.allocation.include._name", primariesNode.getNode().getName()))); // only allocate on the lucky node // index some docs and check if they are coming back @@ -135,7 +135,7 @@ public class TruncatedRecoveryIT extends ESIntegTestCase { } logger.info("--> bumping replicas to 1"); // - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder() + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put("index.routing.allocation.include._name", // now allow allocation on all nodes primariesNode.getNode().getName() + "," + unluckyNode.getNode().getName())).get(); diff --git a/core/src/test/java/org/elasticsearch/rest/CorsRegexIT.java b/core/src/test/java/org/elasticsearch/rest/CorsRegexIT.java index 688b2a1bd79..837b0523072 100644 --- a/core/src/test/java/org/elasticsearch/rest/CorsRegexIT.java +++ b/core/src/test/java/org/elasticsearch/rest/CorsRegexIT.java @@ -46,7 +46,7 @@ public class CorsRegexIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return Settings.settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(SETTING_CORS_ALLOW_ORIGIN.getKey(), "/https?:\\/\\/localhost(:[0-9]+)?/") .put(SETTING_CORS_ALLOW_CREDENTIALS.getKey(), true) diff --git a/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java b/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java index c16759e1b92..eebd926796e 100644 --- a/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java +++ b/core/src/test/java/org/elasticsearch/script/NativeScriptTests.java @@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.notNullValue; public class NativeScriptTests extends ESTestCase { public void testNativeScript() throws InterruptedException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("node.name", "testNativeScript") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .build(); @@ -68,7 +68,7 @@ public class NativeScriptTests extends ESTestCase { } public void testFineGrainedSettingsDontAffectNativeScripts() throws IOException { - Settings.Builder builder = Settings.settingsBuilder(); + Settings.Builder builder = Settings.builder(); if (randomBoolean()) { ScriptType scriptType = randomFrom(ScriptType.values()); builder.put("script" + "." + scriptType.getScriptType(), randomFrom(ScriptMode.values())); diff --git a/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java b/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java index a369b44e2b1..edc04a8bda5 100644 --- a/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java +++ b/core/src/test/java/org/elasticsearch/script/ScriptServiceTests.java @@ -37,7 +37,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; @@ -68,7 +67,7 @@ public class ScriptServiceTests extends ESTestCase { @Before public void setup() throws IOException { Path genericConfigFolder = createTempDir(); - baseSettings = settingsBuilder() + baseSettings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(Environment.PATH_CONF_SETTING.getKey(), genericConfigFolder) .build(); diff --git a/core/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java b/core/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java index a819317b62d..ef922e84048 100644 --- a/core/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java +++ b/core/src/test/java/org/elasticsearch/search/SearchTimeoutIT.java @@ -51,7 +51,7 @@ public class SearchTimeoutIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).build(); + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).build(); } public void testSimpleTimeout() throws Exception { diff --git a/core/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java b/core/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java index 63cbdb56fd3..68b4d980928 100644 --- a/core/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java +++ b/core/src/test/java/org/elasticsearch/search/SearchWithRejectionsIT.java @@ -28,7 +28,6 @@ import org.elasticsearch.test.ESIntegTestCase; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.hamcrest.Matchers.equalTo; @@ -36,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo; public class SearchWithRejectionsIT extends ESIntegTestCase { @Override public Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put("threadpool.search.size", 1) .put("threadpool.search.queue_size", 1) .build(); diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorParsingTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorParsingTests.java index bb9e2f4b328..ec2d813bc86 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorParsingTests.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorParsingTests.java @@ -104,13 +104,13 @@ public class AggregatorParsingTests extends ESTestCase { // it's rather unlikely to get the current actually. Version version = randomBoolean() ? Version.CURRENT : VersionUtils.randomVersionBetween(random(), Version.V_2_0_0_beta1, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put("node.name", AbstractQueryTestCase.class.toString()) + Settings settings = Settings.builder().put("node.name", AbstractQueryTestCase.class.toString()) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING.getKey(), false).build(); namedWriteableRegistry = new NamedWriteableRegistry(); index = new Index(randomAsciiOfLengthBetween(1, 10), "_na_"); - Settings indexSettings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); final ThreadPool threadPool = new ThreadPool(settings); final ClusterService clusterService = createClusterService(threadPool); setState(clusterService, new ClusterState.Builder(clusterService.state()).metaData(new MetaData.Builder() diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java b/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java index 0a458428391..3502e47ccb0 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/BaseAggregationTestCase.java @@ -115,7 +115,7 @@ public abstract class BaseAggregationTestCase> // we have to prefer CURRENT since with the range of versions we support it's rather unlikely to get the current actually. Version version = randomBoolean() ? Version.CURRENT : VersionUtils.randomVersionBetween(random(), Version.V_2_0_0_beta1, Version.CURRENT); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("node.name", AbstractQueryTestCase.class.toString()) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING.getKey(), false) @@ -123,7 +123,7 @@ public abstract class BaseAggregationTestCase> namedWriteableRegistry = new NamedWriteableRegistry(); index = new Index(randomAsciiOfLengthBetween(1, 10), "_na_"); - Settings indexSettings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); final ThreadPool threadPool = new ThreadPool(settings); final ClusterService clusterService = createClusterService(threadPool); setState(clusterService, new ClusterState.Builder(clusterService.state()).metaData(new MetaData.Builder() diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java b/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java index d63d61ab4ed..389e6886e29 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/BasePipelineAggregationTestCase.java @@ -116,7 +116,7 @@ public abstract class BasePipelineAggregationTestCase indexBuilders = new ArrayList<>(); diff --git a/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java b/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java index 489a604292d..7ddb6413364 100644 --- a/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java +++ b/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsIT.java @@ -48,7 +48,6 @@ import java.util.Collection; import java.util.Random; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; public class SearchWithRandomExceptionsIT extends ESIntegTestCase { @@ -90,7 +89,7 @@ public class SearchWithRandomExceptionsIT extends ESIntegTestCase { lowLevelRate = 0d; } - Builder settings = settingsBuilder() + Builder settings = Settings.builder() .put(indexSettings()) .put(EXCEPTION_TOP_LEVEL_RATIO_KEY, topLevelRate) .put(EXCEPTION_LOW_LEVEL_RATIO_KEY, lowLevelRate) diff --git a/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java b/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java index 36e3a6076d5..4d5dbd0c8c8 100644 --- a/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java +++ b/core/src/test/java/org/elasticsearch/search/basic/SearchWithRandomIOExceptionsIT.java @@ -40,7 +40,6 @@ import java.io.IOException; import java.util.Collection; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; @@ -86,7 +85,7 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { int numInitialDocs = 0; if (createIndexWithoutErrors) { - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put("index.number_of_replicas", numberOfReplicas()); logger.info("creating index: [test] using settings: [{}]", settings.build().getAsMap()); client().admin().indices().prepareCreate("test") @@ -100,12 +99,12 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { client().admin().indices().prepareRefresh("test").execute().get(); client().admin().indices().prepareFlush("test").setWaitIfOngoing(true).execute().get(); client().admin().indices().prepareClose("test").execute().get(); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder() + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder() .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_SETTING.getKey(), exceptionRate) .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_ON_OPEN_SETTING.getKey(), exceptionOnOpenRate)); client().admin().indices().prepareOpen("test").execute().get(); } else { - Settings.Builder settings = settingsBuilder() + Settings.Builder settings = Settings.builder() .put("index.number_of_replicas", randomIntBetween(0, 1)) .put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false) .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_SETTING.getKey(), exceptionRate) @@ -182,7 +181,7 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase { if (createIndexWithoutErrors) { // check the index still contains the records that we indexed without errors client().admin().indices().prepareClose("test").execute().get(); - client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder() + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder() .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_SETTING.getKey(), 0) .put(MockFSDirectoryService.RANDOM_IO_EXCEPTION_RATE_ON_OPEN_SETTING.getKey(), 0)); client().admin().indices().prepareOpen("test").execute().get(); diff --git a/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java b/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java index f54d2dba619..f63fe22c6be 100644 --- a/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java @@ -54,7 +54,6 @@ import static org.elasticsearch.action.search.SearchType.QUERY_THEN_FETCH; import static org.elasticsearch.client.Requests.createIndexRequest; import static org.elasticsearch.client.Requests.searchRequest; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.unit.TimeValue.timeValueMinutes; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -81,7 +80,7 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { private Set prepareData(int numShards) throws Exception { Set fullExpectedIds = new TreeSet<>(); - Settings.Builder settingsBuilder = settingsBuilder() + Settings.Builder settingsBuilder = Settings.builder() .put(indexSettings()); if (numShards > 0) { @@ -120,7 +119,7 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { } public void testDfsQueryThenFetch() throws Exception { - Settings.Builder settingsBuilder = settingsBuilder() + Settings.Builder settingsBuilder = Settings.builder() .put(indexSettings()); client().admin().indices().create(createIndexRequest("test") .settings(settingsBuilder)) 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 b2461ff3578..8b528f3f609 100644 --- a/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java @@ -125,14 +125,14 @@ public class SearchSourceBuilderTests extends ESTestCase { // it's rather unlikely to get the current actually. Version version = randomBoolean() ? Version.CURRENT : VersionUtils.randomVersionBetween(random(), Version.V_2_0_0_beta1, Version.CURRENT); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("node.name", AbstractQueryTestCase.class.toString()) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()) .put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING.getKey(), false).build(); namedWriteableRegistry = new NamedWriteableRegistry(); index = new Index(randomAsciiOfLengthBetween(1, 10), "_na_"); - Settings indexSettings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); final ThreadPool threadPool = new ThreadPool(settings); final ClusterService clusterService = createClusterService(threadPool); setState(clusterService, new ClusterState.Builder(clusterService.state()).metaData(new MetaData.Builder() diff --git a/core/src/test/java/org/elasticsearch/search/child/ChildQuerySearchIT.java b/core/src/test/java/org/elasticsearch/search/child/ChildQuerySearchIT.java index 2cc16ef14cb..503a346aa0e 100644 --- a/core/src/test/java/org/elasticsearch/search/child/ChildQuerySearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/child/ChildQuerySearchIT.java @@ -58,7 +58,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.constantScoreQuery; @@ -96,7 +95,7 @@ public class ChildQuerySearchIT extends ESIntegTestCase { @Override public Settings indexSettings() { - return Settings.settingsBuilder().put(super.indexSettings()) + return Settings.builder().put(super.indexSettings()) // aggressive filter caching so that we can assert on the filter cache size .put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), IndexModule.INDEX_QUERY_CACHE) .put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), true) @@ -957,7 +956,7 @@ public class ChildQuerySearchIT extends ESIntegTestCase { public void testParentFieldQuery() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder().put(indexSettings()) + .setSettings(Settings.builder().put(indexSettings()) .put("index.refresh_interval", -1)) .addMapping("parent") .addMapping("child", "_parent", "type=parent")); @@ -991,7 +990,7 @@ public class ChildQuerySearchIT extends ESIntegTestCase { public void testParentIdQuery() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder().put(indexSettings()) + .setSettings(Settings.builder().put(indexSettings()) .put("index.refresh_interval", -1)) .addMapping("parent") .addMapping("child", "_parent", "type=parent")); @@ -1254,7 +1253,7 @@ public class ChildQuerySearchIT extends ESIntegTestCase { public void testParentChildQueriesNoParentType() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("index.refresh_interval", -1))); ensureGreen(); @@ -1311,7 +1310,7 @@ public class ChildQuerySearchIT extends ESIntegTestCase { public void testAddParentFieldAfterIndexingParentDocButBeforeIndexingChildDoc() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("index.refresh_interval", -1))); ensureGreen(); @@ -1335,7 +1334,7 @@ public class ChildQuerySearchIT extends ESIntegTestCase { public void testParentChildCaching() throws Exception { assertAcked(prepareCreate("test") .setSettings( - settingsBuilder() + Settings.builder() .put(indexSettings()) .put("index.refresh_interval", -1) ) diff --git a/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java b/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java index e340d56c1ed..23860883186 100644 --- a/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java +++ b/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreIT.java @@ -599,7 +599,7 @@ public class DecayFunctionScoreIT extends ESIntegTestCase { public void testManyDocsLin() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = jsonBuilder().startObject().startObject("type").startObject("properties") .startObject("test").field("type", "text").endObject().startObject("date").field("type", "date") .field("doc_values", true).endObject().startObject("num").field("type", "double") diff --git a/core/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java b/core/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java index dc8d90b2b84..f6ef6175530 100644 --- a/core/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java +++ b/core/src/test/java/org/elasticsearch/search/functionscore/QueryRescorerIT.java @@ -112,7 +112,7 @@ public class QueryRescorerIT extends ESIntegTestCase { "type1", jsonBuilder().startObject().startObject("type1").startObject("properties").startObject("field1") .field("analyzer", "whitespace").field("type", "text").endObject().endObject().endObject().endObject()) - .setSettings(Settings.settingsBuilder().put(indexSettings()).put("index.number_of_shards", 1))); + .setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1))); client().prepareIndex("test", "type1", "1").setSource("field1", "the quick brown fox").execute().actionGet(); client().prepareIndex("test", "type1", "2").setSource("field1", "the quick lazy huge brown fox jumps over the tree ").get(); @@ -691,7 +691,7 @@ public class QueryRescorerIT extends ESIntegTestCase { } private int indexRandomNumbers(String analyzer, int shards, boolean dummyDocs) throws Exception { - Builder builder = Settings.settingsBuilder().put(indexSettings()); + Builder builder = Settings.builder().put(indexSettings()); if (shards > 0) { builder.put(SETTING_NUMBER_OF_SHARDS, shards); diff --git a/core/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java b/core/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java index 651e1a8d1a5..46704410bd5 100644 --- a/core/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java +++ b/core/src/test/java/org/elasticsearch/search/geo/GeoBoundingBoxIT.java @@ -53,7 +53,7 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { public void testSimpleBoundingBoxTest() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("properties").startObject("location").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { @@ -127,7 +127,7 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { public void testLimitsBoundingBox() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("properties").startObject("location").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { @@ -234,7 +234,7 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { public void testLimit2BoundingBox() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("properties").startObject("location").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { @@ -289,7 +289,7 @@ public class GeoBoundingBoxIT extends ESIntegTestCase { public void testCompleteLonRange() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("properties").startObject("location").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { diff --git a/core/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java b/core/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java index ccc4909155c..173ed1b0617 100644 --- a/core/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java +++ b/core/src/test/java/org/elasticsearch/search/geo/GeoFilterIT.java @@ -375,7 +375,7 @@ public class GeoFilterIT extends ESIntegTestCase { public void testBulk() throws Exception { byte[] bulkAction = unZipData("/org/elasticsearch/search/geo/gzippedmap.gz"); Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder() .startObject() .startObject("country") diff --git a/core/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java b/core/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java index 4d097ec87ab..a7dfe3531c9 100644 --- a/core/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java +++ b/core/src/test/java/org/elasticsearch/search/geo/GeoPolygonIT.java @@ -55,7 +55,7 @@ public class GeoPolygonIT extends ESIntegTestCase { @Override protected void setupSuiteScopeCluster() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("properties").startObject("location").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { diff --git a/core/src/test/java/org/elasticsearch/search/highlight/HighlightBuilderTests.java b/core/src/test/java/org/elasticsearch/search/highlight/HighlightBuilderTests.java index b85af30cf37..90d2b2af3f7 100644 --- a/core/src/test/java/org/elasticsearch/search/highlight/HighlightBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/search/highlight/HighlightBuilderTests.java @@ -287,7 +287,7 @@ public class HighlightBuilderTests extends ESTestCase { * than what we have in the random {@link HighlightBuilder} */ public void testBuildSearchContextHighlight() throws IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); Index index = new Index(randomAsciiOfLengthBetween(1, 10), "_na_"); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings(index, indexSettings); diff --git a/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java b/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java index 6839188ca4a..1a81d5aec02 100644 --- a/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java @@ -23,6 +23,7 @@ import com.carrotsearch.randomizedtesting.generators.RandomPicks; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -48,7 +49,6 @@ import java.util.HashMap; import java.util.Map; import static org.elasticsearch.client.Requests.searchRequest; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.boostingQuery; @@ -190,7 +190,7 @@ public class HighlighterSearchIT extends ESIntegTestCase { .endObject() .endObject() .endObject()) - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("analysis.tokenizer.autocomplete.max_gram", 20) .put("analysis.tokenizer.autocomplete.min_gram", 1) @@ -233,7 +233,7 @@ public class HighlighterSearchIT extends ESIntegTestCase { assertAcked(prepareCreate("test") .addMapping("test", "body", "type=text,analyzer=custom_analyzer,search_analyzer=custom_analyzer,term_vector=with_positions_offsets") .setSettings( - settingsBuilder().put(indexSettings()) + Settings.builder().put(indexSettings()) .put("analysis.filter.wordDelimiter.type", "word_delimiter") .put("analysis.filter.wordDelimiter.type.split_on_numerics", false) .put("analysis.filter.wordDelimiter.generate_word_parts", true) @@ -273,7 +273,7 @@ public class HighlighterSearchIT extends ESIntegTestCase { .addMapping("test", "name", "type=text,analyzer=name_index_analyzer,search_analyzer=name_search_analyzer,term_vector=with_positions_offsets", "name2", "type=text,analyzer=name2_index_analyzer,search_analyzer=name_search_analyzer,term_vector=with_positions_offsets") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("analysis.filter.my_ngram.max_gram", 20) .put("analysis.filter.my_ngram.min_gram", 1) @@ -1357,7 +1357,7 @@ public class HighlighterSearchIT extends ESIntegTestCase { } public void testPhrasePrefix() throws IOException { - Builder builder = settingsBuilder() + Builder builder = Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.synonym.tokenizer", "whitespace") .putArray("index.analysis.analyzer.synonym.filter", "synonym", "lowercase") @@ -1545,7 +1545,7 @@ public class HighlighterSearchIT extends ESIntegTestCase { // Issue #3200 public void testResetTwice() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("analysis.analyzer.my_analyzer.type", "pattern") .put("analysis.analyzer.my_analyzer.pattern", "\\s+") diff --git a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java index b5658adff39..2b235b1b3fc 100644 --- a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java +++ b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java @@ -38,7 +38,6 @@ import org.elasticsearch.search.sort.SortMode; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.test.ESIntegTestCase; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -236,7 +235,7 @@ public class SimpleNestedIT extends ESIntegTestCase { // This IncludeNestedDocsQuery also needs to be aware of the filter from alias public void testDeleteNestedDocsWithAlias() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder().put(indexSettings()).put("index.refresh_interval", -1).build()) + .setSettings(Settings.builder().put(indexSettings()).put("index.refresh_interval", -1).build()) .addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties") .startObject("field1") .field("type", "text") @@ -329,7 +328,7 @@ public class SimpleNestedIT extends ESIntegTestCase { public void testSimpleNestedSorting() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("index.refresh_interval", -1)) .addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties") @@ -411,7 +410,7 @@ public class SimpleNestedIT extends ESIntegTestCase { public void testSimpleNestedSortingWithNestedFilterMissing() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put("index.refresh_interval", -1)) .addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties") diff --git a/core/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java b/core/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java index 7b34aec9bd0..654712d928e 100644 --- a/core/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java +++ b/core/src/test/java/org/elasticsearch/search/preference/SearchPreferenceIT.java @@ -22,13 +22,13 @@ package org.elasticsearch.search.preference; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.health.ClusterHealthStatus; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ESIntegTestCase; import java.io.IOException; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.not; public class SearchPreferenceIT extends ESIntegTestCase { // see #2896 public void testStopOneNodePreferenceWithRedState() throws InterruptedException, IOException { - assertAcked(prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", cluster().numDataNodes()+2).put("index.number_of_replicas", 0))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", cluster().numDataNodes()+2).put("index.number_of_replicas", 0))); ensureGreen(); for (int i = 0; i < 10; i++) { client().prepareIndex("test", "type1", ""+i).setSource("field1", "value1").execute().actionGet(); @@ -71,7 +71,7 @@ public class SearchPreferenceIT extends ESIntegTestCase { public void testNoPreferenceRandom() throws Exception { assertAcked(prepareCreate("test").setSettings( //this test needs at least a replica to make sure two consecutive searches go to two different copies of the same data - settingsBuilder().put(indexSettings()).put(SETTING_NUMBER_OF_REPLICAS, between(1, maximumNumberOfReplicas())) + Settings.builder().put(indexSettings()).put(SETTING_NUMBER_OF_REPLICAS, between(1, maximumNumberOfReplicas())) )); ensureGreen(); diff --git a/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java b/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java index e480c5369bb..d90e465e0a0 100644 --- a/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java +++ b/core/src/test/java/org/elasticsearch/search/query/MultiMatchQueryIT.java @@ -23,6 +23,7 @@ import com.carrotsearch.randomizedtesting.generators.RandomPicks; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -46,7 +47,6 @@ import java.util.concurrent.ExecutionException; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.disMaxQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -74,7 +74,7 @@ public class MultiMatchQueryIT extends ESIntegTestCase { @Before public void init() throws Exception { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) diff --git a/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java b/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java index 3119a6602b9..fecdf6ff074 100644 --- a/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java +++ b/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java @@ -28,6 +28,7 @@ import org.elasticsearch.action.search.SearchType; import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.MatchQueryBuilder; @@ -54,7 +55,6 @@ import java.util.Random; import java.util.concurrent.ExecutionException; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.commonTermsQuery; @@ -382,7 +382,7 @@ public class SearchQueryIT extends ESIntegTestCase { public void testCommonTermsQueryStackedTokens() throws Exception { assertAcked(prepareCreate("test") - .setSettings(settingsBuilder() + .setSettings(Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_SHARDS,1) .put("index.analysis.filter.syns.type","synonym") @@ -1577,7 +1577,7 @@ public class SearchQueryIT extends ESIntegTestCase { // see #3881 - for extensive description of the issue public void testMatchQueryWithSynonyms() throws IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.index.type", "custom") .put("index.analysis.analyzer.index.tokenizer", "standard") @@ -1607,7 +1607,7 @@ public class SearchQueryIT extends ESIntegTestCase { } public void testMatchQueryWithStackedStems() throws IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.index.type", "custom") .put("index.analysis.analyzer.index.tokenizer", "standard") @@ -1631,7 +1631,7 @@ public class SearchQueryIT extends ESIntegTestCase { } public void testQueryStringWithSynonyms() throws IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.index.type", "custom") .put("index.analysis.analyzer.index.tokenizer", "standard") @@ -2019,7 +2019,7 @@ public class SearchQueryIT extends ESIntegTestCase { // see #5120 public void testNGramCopyField() { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.my_ngram_analyzer.type", "custom") .put("index.analysis.analyzer.my_ngram_analyzer.tokenizer", "my_ngram_tokenizer") diff --git a/core/src/test/java/org/elasticsearch/search/rescore/QueryRescoreBuilderTests.java b/core/src/test/java/org/elasticsearch/search/rescore/QueryRescoreBuilderTests.java index bbb6af1c52d..8ef00e592f0 100644 --- a/core/src/test/java/org/elasticsearch/search/rescore/QueryRescoreBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/search/rescore/QueryRescoreBuilderTests.java @@ -157,7 +157,7 @@ public class QueryRescoreBuilderTests extends ESTestCase { * than the test builder */ public void testBuildRescoreSearchContext() throws ElasticsearchParseException, IOException { - Settings indexSettings = Settings.settingsBuilder() + Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); IndexSettings idxSettings = IndexSettingsModule.newIndexSettings(randomAsciiOfLengthBetween(1, 10), indexSettings); // shard context will only need indicesQueriesRegistry for building Query objects nested in query rescorer diff --git a/core/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java b/core/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java index 4ab11d538fd..ec9e72639d2 100644 --- a/core/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java +++ b/core/src/test/java/org/elasticsearch/search/scroll/SearchScrollIT.java @@ -72,7 +72,7 @@ import static org.hamcrest.Matchers.startsWith; */ public class SearchScrollIT extends ESIntegTestCase { public void testSimpleScrollQueryThenFetch() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); @@ -123,7 +123,7 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testSimpleScrollQueryThenFetchSmallSizeUnevenDistribution() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); @@ -196,7 +196,7 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testScrollAndUpdateIndex() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.number_of_shards", 5)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 5)).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); for (int i = 0; i < 500; i++) { @@ -240,7 +240,7 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testSimpleScrollQueryThenFetch_clearScrollIds() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); @@ -351,7 +351,7 @@ public class SearchScrollIT extends ESIntegTestCase { } public void testSimpleScrollQueryThenFetchClearAllScrollIds() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 3)).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); @@ -464,7 +464,7 @@ public class SearchScrollIT extends ESIntegTestCase { public void testStringSortMissingAscTerminates() throws Exception { assertAcked(prepareCreate("test") - .setSettings(Settings.settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)) + .setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("test", "no_field", "type=keyword", "some_field", "type=keyword")); client().prepareIndex("test", "test", "1").setSource("some_field", "test").get(); refresh(); diff --git a/core/src/test/java/org/elasticsearch/search/searchafter/SearchAfterBuilderTests.java b/core/src/test/java/org/elasticsearch/search/searchafter/SearchAfterBuilderTests.java index 48e62e52a39..5edfb792cc0 100644 --- a/core/src/test/java/org/elasticsearch/search/searchafter/SearchAfterBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/search/searchafter/SearchAfterBuilderTests.java @@ -59,7 +59,7 @@ public class SearchAfterBuilderTests extends ESTestCase { namedWriteableRegistry = new NamedWriteableRegistry(); QueryParser parser = MatchAllQueryBuilder::fromXContent; indicesQueriesRegistry = new IndicesQueriesRegistry( - Settings.settingsBuilder().build(), + Settings.builder().build(), Collections.singletonMap( MatchAllQueryBuilder.NAME, new Tuple<>(MatchAllQueryBuilder.QUERY_NAME_FIELD, parser))); } diff --git a/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java b/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java index ed733fd4cd7..e06b7d693fb 100644 --- a/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java +++ b/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceIT.java @@ -69,7 +69,7 @@ public class GeoDistanceIT extends ESIntegTestCase { public void testSimpleDistance() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties") .startObject("location").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { @@ -212,7 +212,7 @@ public class GeoDistanceIT extends ESIntegTestCase { public void testDistanceSortingMVFields() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties") .startObject("locations").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { @@ -344,7 +344,7 @@ public class GeoDistanceIT extends ESIntegTestCase { // https://github.com/elastic/elasticsearch/issues/2851 public void testDistanceSortingWithMissingGeoPoint() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties") .startObject("locations").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { @@ -391,7 +391,7 @@ public class GeoDistanceIT extends ESIntegTestCase { public void testDistanceSortingNestedFields() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("company").startObject("properties") .startObject("name").field("type", "text").endObject().startObject("branches").field("type", "nested") .startObject("properties").startObject("name").field("type", "text").endObject().startObject("location") @@ -542,7 +542,7 @@ public class GeoDistanceIT extends ESIntegTestCase { */ public void testGeoDistanceFilter() throws IOException { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); double lat = 40.720611; double lon = -73.998776; @@ -577,7 +577,7 @@ public class GeoDistanceIT extends ESIntegTestCase { public void testDuelOptimizations() throws Exception { Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); if (version.before(Version.V_2_2_0)) { assertAcked(prepareCreate("index").setSettings(settings).addMapping("type", "location", "type=geo_point,lat_lon=true")); } else { diff --git a/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java b/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java index 831db7ea3fc..31c1d5793e0 100644 --- a/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java +++ b/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderIT.java @@ -70,7 +70,7 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { * 1 2 3 4 5 6 7 */ Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); assertAcked(prepareCreate("index").setSettings(settings).addMapping("type", LOCATION_FIELD, "type=geo_point")); XContentBuilder d1Builder = jsonBuilder(); GeoPoint[] d1Points = {new GeoPoint(3, 2), new GeoPoint(4, 1)}; @@ -136,7 +136,7 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { * d2 = (0, 1), (0, 5), (0, 6); so avg. distance is 4, median distance is 5 */ Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); assertAcked(prepareCreate("index").setSettings(settings).addMapping("type", LOCATION_FIELD, "type=geo_point")); XContentBuilder d1Builder = jsonBuilder(); GeoPoint[] d1Points = {new GeoPoint(0, 1), new GeoPoint(0, 4), new GeoPoint(0, 10)}; @@ -198,7 +198,7 @@ public class GeoDistanceSortBuilderIT extends ESIntegTestCase { * 1 2 3 4 5 6 */ Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); assertAcked(prepareCreate("index").setSettings(settings).addMapping("type", LOCATION_FIELD, "type=geo_point")); XContentBuilder d1Builder = jsonBuilder(); GeoPoint[] d1Points = {new GeoPoint(2.5, 1), new GeoPoint(2.75, 2), new GeoPoint(3, 3), new GeoPoint(3.25, 4)}; diff --git a/core/src/test/java/org/elasticsearch/search/sort/SortParserTests.java b/core/src/test/java/org/elasticsearch/search/sort/SortParserTests.java index e2c54119623..c3dc8eab745 100644 --- a/core/src/test/java/org/elasticsearch/search/sort/SortParserTests.java +++ b/core/src/test/java/org/elasticsearch/search/sort/SortParserTests.java @@ -36,7 +36,7 @@ public class SortParserTests extends ESSingleNodeTestCase { public void testGeoDistanceSortParserManyPointsNoException() throws Exception { XContentBuilder mapping = jsonBuilder(); mapping.startObject().startObject("type").startObject("properties").startObject("location").field("type", "geo_point").endObject().endObject().endObject().endObject(); - IndexService indexService = createIndex("testidx", Settings.settingsBuilder().build(), "type", mapping); + IndexService indexService = createIndex("testidx", Settings.builder().build(), "type", mapping); TestSearchContext context = (TestSearchContext) createSearchContext(indexService); context.getQueryShardContext().setTypes("type"); diff --git a/core/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java b/core/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java index bf161131afc..a18b15f0fc5 100644 --- a/core/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java @@ -42,7 +42,6 @@ import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.percolator.PercolatorFieldMapper; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; -import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.sort.FieldSortBuilder; import org.elasticsearch.search.suggest.completion.CompletionStats; import org.elasticsearch.search.suggest.completion.CompletionSuggestion; @@ -64,7 +63,6 @@ import java.util.Map; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.util.CollectionUtils.iterableAsArrayList; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -564,7 +562,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { } public void testThatSynonymsWork() throws Exception { - Settings.Builder settingsBuilder = settingsBuilder() + Settings.Builder settingsBuilder = Settings.builder() .put("analysis.analyzer.suggest_analyzer_synonyms.type", "custom") .put("analysis.analyzer.suggest_analyzer_synonyms.tokenizer", "standard") .putArray("analysis.analyzer.suggest_analyzer_synonyms.filter", "standard", "lowercase", "my_synonyms") @@ -776,7 +774,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { public void testThatStatsAreWorking() throws Exception { String otherField = "testOtherField"; client().admin().indices().prepareCreate(INDEX) - .setSettings(Settings.settingsBuilder().put("index.number_of_replicas", 0).put("index.number_of_shards", 2)) + .setSettings(Settings.builder().put("index.number_of_replicas", 0).put("index.number_of_shards", 2)) .execute().actionGet(); ensureGreen(); PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() @@ -841,7 +839,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { } public void testThatSuggestStopFilterWorks() throws Exception { - Settings.Builder settingsBuilder = settingsBuilder() + Settings.Builder settingsBuilder = Settings.builder() .put("index.analysis.analyzer.stoptest.tokenizer", "standard") .putArray("index.analysis.analyzer.stoptest.filter", "standard", "suggest_stop_filter") .put("index.analysis.filter.suggest_stop_filter.type", "stop") @@ -1001,7 +999,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { .endObject(); assertAcked(client().admin().indices().prepareCreate(INDEX) - .setSettings(Settings.settingsBuilder().put(indexSettings()).put(settings)) + .setSettings(Settings.builder().put(indexSettings()).put(settings)) .addMapping(TYPE, mapping) .get()); ensureYellow(); @@ -1013,7 +1011,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase { // see #3555 public void testPrunedSegments() throws IOException { - createIndexAndMappingAndSettings(settingsBuilder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0).build(), completionMappingBuilder); + createIndexAndMappingAndSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0).build(), completionMappingBuilder); client().prepareIndex(INDEX, TYPE, "1").setSource(jsonBuilder() .startObject().startObject(FIELD) diff --git a/core/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java b/core/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java index db5902c70f4..b019eb47630 100644 --- a/core/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/suggest/ContextCompletionSuggestSearchIT.java @@ -683,7 +683,7 @@ public class ContextCompletionSuggestSearchIT extends ESIntegTestCase { .endObject(); assertAcked(client().admin().indices().prepareCreate(INDEX) - .setSettings(Settings.settingsBuilder().put(indexSettings()).put(settings)) + .setSettings(Settings.builder().put(indexSettings()).put(settings)) .addMapping(TYPE, mapping) .get()); ensureYellow(); diff --git a/core/src/test/java/org/elasticsearch/search/suggest/phrase/SmoothingModelTestCase.java b/core/src/test/java/org/elasticsearch/search/suggest/phrase/SmoothingModelTestCase.java index 02c2d56cd07..b0f5ab3e2b1 100644 --- a/core/src/test/java/org/elasticsearch/search/suggest/phrase/SmoothingModelTestCase.java +++ b/core/src/test/java/org/elasticsearch/search/suggest/phrase/SmoothingModelTestCase.java @@ -95,7 +95,7 @@ public abstract class SmoothingModelTestCase extends ESTestCase { */ public void testFromXContent() throws IOException { QueryParseContext context = new QueryParseContext( - new IndicesQueriesRegistry(Settings.settingsBuilder().build(), Collections.emptyMap())); + new IndicesQueriesRegistry(Settings.builder().build(), Collections.emptyMap())); context.parseFieldMatcher(new ParseFieldMatcher(Settings.EMPTY)); SmoothingModel testModel = createTestModel(); diff --git a/core/src/test/java/org/elasticsearch/similarity/SimilarityIT.java b/core/src/test/java/org/elasticsearch/similarity/SimilarityIT.java index 58fc257244f..399aed57526 100644 --- a/core/src/test/java/org/elasticsearch/similarity/SimilarityIT.java +++ b/core/src/test/java/org/elasticsearch/similarity/SimilarityIT.java @@ -50,7 +50,7 @@ public class SimilarityIT extends ESIntegTestCase { .endObject() .endObject() .endObject()) - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("similarity.custom.type", "BM25") diff --git a/core/src/test/java/org/elasticsearch/snapshots/AbstractSnapshotIntegTestCase.java b/core/src/test/java/org/elasticsearch/snapshots/AbstractSnapshotIntegTestCase.java index 43056d1fcb1..7e0bb173e40 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/AbstractSnapshotIntegTestCase.java +++ b/core/src/test/java/org/elasticsearch/snapshots/AbstractSnapshotIntegTestCase.java @@ -50,7 +50,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Predicate; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -58,7 +57,7 @@ public abstract class AbstractSnapshotIntegTestCase extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) // Rebalancing is causing some checks after restore to randomly fail // due to https://github.com/elastic/elasticsearch/issues/9421 .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE) diff --git a/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 0acc32887ef..38a387f370b 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -73,7 +73,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows; @@ -99,7 +98,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest public void testRestorePersistentSettings() throws Exception { logger.info("--> start 2 nodes"); - Settings nodeSettings = settingsBuilder() + Settings nodeSettings = Settings.builder() .put("discovery.type", "zen") .put(ZenDiscovery.PING_TIMEOUT_SETTING.getKey(), "200ms") .put("discovery.initial_state_timeout", "500ms") @@ -114,7 +113,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> set test persistent setting"); client.admin().cluster().prepareUpdateSettings().setPersistentSettings( - Settings.settingsBuilder() + Settings.builder() .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 2) .put(IndicesTTLService.INDICES_TTL_INTERVAL_SETTING.getKey(), random, TimeUnit.MINUTES)) .execute().actionGet(); @@ -126,7 +125,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> create repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> start snapshot"); @@ -137,7 +136,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> clean the test persistent setting"); client.admin().cluster().prepareUpdateSettings().setPersistentSettings( - Settings.settingsBuilder() + Settings.builder() .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 1) .put(IndicesTTLService.INDICES_TTL_INTERVAL_SETTING.getKey(), TimeValue.timeValueMinutes(1))) .execute().actionGet(); @@ -186,7 +185,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> create repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", tempDir)).execute().actionGet(); + .setType("fs").setSettings(Settings.builder().put("location", tempDir)).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> start snapshot"); @@ -224,7 +223,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> create repository"); putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", tempDir)).execute().actionGet(); + .setType("fs").setSettings(Settings.builder().put("location", tempDir)).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> restore snapshot"); @@ -292,7 +291,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> start 2 nodes"); Client client = client(); - assertAcked(prepareCreate("test-idx", 2, settingsBuilder().put("number_of_shards", 2).put("number_of_replicas", 0))); + assertAcked(prepareCreate("test-idx", 2, Settings.builder().put("number_of_shards", 2).put("number_of_replicas", 0))); ensureGreen(); logger.info("--> indexing some data"); @@ -306,7 +305,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", randomRepoPath()) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -340,7 +339,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest nodes.add(internalCluster().startNode()); Client client = client(); - assertAcked(prepareCreate("test-idx", 2, settingsBuilder().put("number_of_shards", 2).put("number_of_replicas", 0))); + assertAcked(prepareCreate("test-idx", 2, Settings.builder().put("number_of_shards", 2).put("number_of_replicas", 0))); ensureGreen(); logger.info("--> indexing some data"); @@ -354,7 +353,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest Path repo = randomRepoPath(); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", repo) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -404,7 +403,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest cluster().wipeIndices("_all"); logger.info("--> create an index that will have some unallocated shards"); - assertAcked(prepareCreate("test-idx-some", 2, settingsBuilder().put("number_of_shards", 6) + assertAcked(prepareCreate("test-idx-some", 2, Settings.builder().put("number_of_shards", 6) .put("number_of_replicas", 0))); ensureGreen(); @@ -420,12 +419,12 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setTimeout("1m").setWaitForNodes("<2").execute().actionGet().isTimedOut(), equalTo(false)); logger.info("--> create an index that will have all allocated shards"); - assertAcked(prepareCreate("test-idx-all", 1, settingsBuilder().put("number_of_shards", 6) + assertAcked(prepareCreate("test-idx-all", 1, Settings.builder().put("number_of_shards", 6) .put("number_of_replicas", 0))); ensureGreen("test-idx-all"); logger.info("--> create an index that will be closed"); - assertAcked(prepareCreate("test-idx-closed", 1, settingsBuilder().put("number_of_shards", 4).put("number_of_replicas", 0))); + assertAcked(prepareCreate("test-idx-closed", 1, Settings.builder().put("number_of_shards", 4).put("number_of_replicas", 0))); ensureGreen("test-idx-closed"); logger.info("--> indexing some data into test-idx-all"); @@ -438,14 +437,14 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest assertAcked(client().admin().indices().prepareClose("test-idx-closed")); logger.info("--> create an index that will have no allocated shards"); - assertAcked(prepareCreate("test-idx-none", 1, settingsBuilder().put("number_of_shards", 6) + assertAcked(prepareCreate("test-idx-none", 1, Settings.builder().put("number_of_shards", 6) .put("index.routing.allocation.include.tag", "nowhere") .put("number_of_replicas", 0))); logger.info("--> create repository"); logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> start snapshot with default settings and closed index - should be blocked"); @@ -548,7 +547,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest public void testRestoreIndexWithShardsMissingInLocalGateway() throws Exception { logger.info("--> start 2 nodes"); - Settings nodeSettings = settingsBuilder() + Settings nodeSettings = Settings.builder() .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE) .build(); @@ -558,11 +557,11 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> create repository"); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); int numberOfShards = 6; logger.info("--> create an index that will have some unallocated shards"); - assertAcked(prepareCreate("test-idx", 2, settingsBuilder().put("number_of_shards", numberOfShards) + assertAcked(prepareCreate("test-idx", 2, Settings.builder().put("number_of_shards", numberOfShards) .put("number_of_replicas", 0))); ensureGreen(); @@ -610,27 +609,27 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest internalCluster().startNode(); logger.info("--> start second node"); // Make sure the first node is elected as master - internalCluster().startNode(settingsBuilder().put(Node.NODE_MASTER_SETTING.getKey(), false)); + internalCluster().startNode(Settings.builder().put(Node.NODE_MASTER_SETTING.getKey(), false)); // Register mock repositories for (int i = 0; i < 5; i++) { client().admin().cluster().preparePutRepository("test-repo" + i) - .setType("mock").setSettings(Settings.settingsBuilder() + .setType("mock").setSettings(Settings.builder() .put("location", randomRepoPath())).setVerify(false).get(); } logger.info("--> make sure that properly setup repository can be registered on all nodes"); client().admin().cluster().preparePutRepository("test-repo-0") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath())).get(); } public void testThatSensitiveRepositorySettingsAreNotExposed() throws Exception { - Settings nodeSettings = settingsBuilder().put().build(); + Settings nodeSettings = Settings.builder().put().build(); logger.info("--> start two nodes"); internalCluster().startNodesAsync(2, nodeSettings).get(); // Register mock repositories client().admin().cluster().preparePutRepository("test-repo") - .setType("mock").setSettings(Settings.settingsBuilder() + .setType("mock").setSettings(Settings.builder() .put("location", randomRepoPath()) .put(MockRepository.Plugin.USERNAME_SETTING.getKey(), "notsecretusername") .put(MockRepository.Plugin.PASSWORD_SETTING.getKey(), "verysecretpassword") @@ -684,7 +683,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/12621") public void testChaosSnapshot() throws Exception { final List indices = new CopyOnWriteArrayList<>(); - Settings settings = settingsBuilder().put("action.write_consistency", "one").build(); + Settings settings = Settings.builder().put("action.write_consistency", "one").build(); int initialNodes = between(1, 3); logger.info("--> start {} nodes", initialNodes); for (int i = 0; i < initialNodes; i++) { @@ -693,7 +692,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> creating repository"); assertAcked(client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -785,8 +784,8 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest } public void testMasterShutdownDuringSnapshot() throws Exception { - Settings masterSettings = settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).build(); - Settings dataSettings = settingsBuilder().put(Node.NODE_MASTER_SETTING.getKey(), false).build(); + Settings masterSettings = Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build(); + Settings dataSettings = Settings.builder().put(Node.NODE_MASTER_SETTING.getKey(), false).build(); logger.info("--> starting two master nodes and two data nodes"); internalCluster().startNode(masterSettings); @@ -798,12 +797,12 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); - assertAcked(prepareCreate("test-idx", 0, settingsBuilder().put("number_of_shards", between(1, 20)) + assertAcked(prepareCreate("test-idx", 0, Settings.builder().put("number_of_shards", between(1, 20)) .put("number_of_replicas", 0))); ensureGreen(); @@ -878,7 +877,7 @@ public class DedicatedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTest } private void createTestIndex(String name) { - assertAcked(prepareCreate(name, 0, settingsBuilder().put("number_of_shards", between(1, 6)) + assertAcked(prepareCreate(name, 0, Settings.builder().put("number_of_shards", between(1, 6)) .put("number_of_replicas", between(1, 6)))); ensureYellow(name); diff --git a/core/src/test/java/org/elasticsearch/snapshots/FsBlobStoreRepositoryIT.java b/core/src/test/java/org/elasticsearch/snapshots/FsBlobStoreRepositoryIT.java index 22a3ecac8e3..fceedff8e70 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/FsBlobStoreRepositoryIT.java +++ b/core/src/test/java/org/elasticsearch/snapshots/FsBlobStoreRepositoryIT.java @@ -28,7 +28,7 @@ public class FsBlobStoreRepositoryIT extends ESBlobStoreRepositoryIntegTestCase @Override protected void createTestRepository(String name) { assertAcked(client().admin().cluster().preparePutRepository(name) - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); diff --git a/core/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java b/core/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java index b0de06138a8..79d1497912a 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java +++ b/core/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java @@ -54,7 +54,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-1") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", location) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -77,7 +77,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { logger.info("--> creating another repository"); putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -137,7 +137,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { String location = invalidRepoPath.toString(); try { client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", location)) + .setType("fs").setSettings(Settings.builder().put("location", location)) .get(); fail("Shouldn't be here"); } catch (RepositoryException ex) { @@ -149,7 +149,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { logger.info("--> trying creating url repository with unsupported url protocol"); try { client().admin().cluster().preparePutRepository("test-repo") - .setType("url").setSettings(Settings.settingsBuilder().put("url", unsupportedUrl)) + .setType("url").setSettings(Settings.builder().put("url", unsupportedUrl)) .get(); fail("Shouldn't be here"); } catch (RepositoryException ex) { @@ -159,7 +159,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { logger.info("--> trying creating url repository with location that is not registered in path.repo setting"); try { client().admin().cluster().preparePutRepository("test-repo") - .setType("url").setSettings(Settings.settingsBuilder().put("url", invalidRepoPath.toUri().toURL())) + .setType("url").setSettings(Settings.builder().put("url", invalidRepoPath.toUri().toURL())) .get(); fail("Shouldn't be here"); } catch (RepositoryException ex) { @@ -170,7 +170,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { public void testRepositoryAckTimeout() throws Exception { logger.info("--> creating repository test-repo-1 with 0s timeout - shouldn't ack"); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo-1") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(5, 100), ByteSizeUnit.BYTES) @@ -180,7 +180,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { logger.info("--> creating repository test-repo-2 with standard timeout - should ack"); putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(5, 100), ByteSizeUnit.BYTES) @@ -200,7 +200,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { public void testRepositoryVerification() throws Exception { Client client = client(); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("location", randomRepoPath()) .put("random_control_io_exception_rate", 1.0).build(); logger.info("--> creating repository that cannot write any files - should fail"); @@ -221,7 +221,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { try { client.admin().cluster().preparePutRepository("test-repo-1") .setType("mock") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("location", location) .put("localize_location", true) ).get(); @@ -234,7 +234,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { public void testRepositoryVerificationTimeout() throws Exception { Client client = client(); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("location", randomRepoPath()) .put("random_control_io_exception_rate", 1.0).build(); logger.info("--> creating repository that cannot write any files - should fail"); @@ -255,7 +255,7 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase { try { client.admin().cluster().preparePutRepository("test-repo-1") .setType("mock") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("location", location) .put("localize_location", true) ).get(); diff --git a/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java b/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java index cc52daad5b0..62d9c2c4120 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java +++ b/core/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java @@ -77,7 +77,6 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.IndexSettings.INDEX_REFRESH_INTERVAL_SETTING; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -106,7 +105,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -218,7 +217,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository(repoName) - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", absolutePath) )); @@ -246,7 +245,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -294,7 +293,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -342,7 +341,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).get(); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> snapshot"); @@ -358,7 +357,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath()))); logger.info("--> create test indices"); createIndex("test-idx-1", "test-idx-2", "test-idx-3"); @@ -413,7 +412,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); + .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath()))); logger.info("--> creating test template"); assertThat(client.admin().indices().preparePutTemplate("test-template").setTemplate("te*").addMapping("test-mapping", "{}").get().isAcknowledged(), equalTo(true)); @@ -446,7 +445,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); Path location = randomRepoPath(); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", location))); + .setType("fs").setSettings(Settings.builder().put("location", location))); logger.info("--> creating test template"); assertThat(client.admin().indices().preparePutTemplate("test-template").setTemplate("te*").addMapping("test-mapping", "{}").get().isAcknowledged(), equalTo(true)); @@ -524,7 +523,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", randomRepoPath()) .put("random", randomAsciiOfLength(10)) .put("random_control_io_exception_rate", 0.2)) @@ -573,7 +572,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", randomRepoPath()) .put("random", randomAsciiOfLength(10)) .put("random_data_file_io_exception_rate", 0.3))); @@ -638,7 +637,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.builder().put("location", repositoryLocation))); createIndex("test-idx"); ensureGreen(); @@ -658,7 +657,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> update repository with mock version"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("random_data_file_io_exception_rate", 0.3))); @@ -679,7 +678,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.builder().put("location", repositoryLocation))); createIndex("test-idx"); ensureGreen(); @@ -699,7 +698,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> update repository with mock version"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("random_data_file_io_exception_rate", 1.0) // Fail completely @@ -726,7 +725,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> restoring working repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.builder().put("location", repositoryLocation))); logger.info("--> trying to restore index again"); restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); @@ -742,7 +741,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()))); logger.info("--> creating index that cannot be allocated"); @@ -763,7 +762,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Path repo = randomRepoPath(); logger.info("--> creating repository at {}", repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -819,7 +818,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Path repo = randomRepoPath(); logger.info("--> creating repository at {}", repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -857,7 +856,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Path repo = randomRepoPath(); logger.info("--> creating repository at {}", repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -891,7 +890,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Path repo = randomRepoPath(); logger.info("--> creating repository at {}", repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -930,7 +929,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()))); createIndex("test-idx", "test-idx-closed"); @@ -958,7 +957,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()))); createIndex("test-idx"); @@ -976,7 +975,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()))); createIndex("test-idx-1", "test-idx-2", "test-idx-3"); @@ -1096,7 +1095,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200))); @@ -1142,7 +1141,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> replace mock repository with real one at the same location"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.builder().put("location", repositoryLocation))); logger.info("--> restore index"); RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); @@ -1157,7 +1156,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -1195,7 +1194,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> trying to move repository to another location"); try { client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation.resolve("test")) + .setType("fs").setSettings(Settings.builder().put("location", repositoryLocation.resolve("test")) ).get(); fail("shouldn't be able to replace in-use repository"); } catch (Exception ex) { @@ -1204,7 +1203,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> trying to create a repository with different name"); assertAcked(client.admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation.resolve("test")))); + .setType("fs").setSettings(Settings.builder().put("location", repositoryLocation.resolve("test")))); logger.info("--> unblocking blocked node"); unblockNode(blockedNode); @@ -1224,7 +1223,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> replace mock repository with real one at the same location"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.builder().put("location", repositoryLocation))); logger.info("--> restore index"); RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); @@ -1239,7 +1238,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); Path repositoryLocation = randomRepoPath(); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repositoryLocation) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -1266,7 +1265,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> create read-only URL repository"); assertAcked(client.admin().cluster().preparePutRepository("url-repo") - .setType("url").setSettings(Settings.settingsBuilder() + .setType("url").setSettings(Settings.builder() .put("url", repositoryLocation.toUri().toURL()) .put("list_directories", randomBoolean()))); logger.info("--> restore index after deletion"); @@ -1296,7 +1295,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); Path repositoryLocation = randomRepoPath(); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repositoryLocation) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -1322,7 +1321,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> create read-only URL repository"); assertAcked(client.admin().cluster().preparePutRepository("readonly-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repositoryLocation) .put("compress", randomBoolean()) .put("readonly", true) @@ -1353,7 +1352,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas boolean throttleSnapshot = randomBoolean(); boolean throttleRestore = randomBoolean(); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repositoryLocation) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) @@ -1409,7 +1408,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( - Settings.settingsBuilder() + Settings.builder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -1505,7 +1504,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -1553,7 +1552,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -1615,7 +1614,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -1729,7 +1728,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -1823,7 +1822,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas boolean initBlocking = allowPartial || randomBoolean(); if (initBlocking) { assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("mock").setSettings(Settings.settingsBuilder() + .setType("mock").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES) @@ -1831,7 +1830,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas )); } else { assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("mock").setSettings(Settings.settingsBuilder() + .setType("mock").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES) @@ -1921,7 +1920,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("mock").setSettings(Settings.settingsBuilder() + .setType("mock").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES) @@ -1985,7 +1984,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("mock").setSettings(Settings.settingsBuilder() + .setType("mock").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES) @@ -2050,12 +2049,12 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); - assertAcked(prepareCreate("test-idx", 0, settingsBuilder().put("number_of_shards", between(1, 10)) + assertAcked(prepareCreate("test-idx", 0, Settings.builder().put("number_of_shards", between(1, 10)) .put("number_of_replicas", 0))); ensureGreen(); @@ -2129,7 +2128,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -2168,7 +2167,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas Path repo = randomRepoPath(); logger.info("--> creating repository at {}", repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", repo) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); diff --git a/core/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityIT.java b/core/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityIT.java index bb95d10f181..e6379468382 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityIT.java +++ b/core/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityIT.java @@ -51,7 +51,7 @@ public class SnapshotBackwardsCompatibilityIT extends ESBackcompatTestCase { public void testSnapshotAndRestore() throws ExecutionException, InterruptedException, IOException { logger.info("--> creating repository"); assertAcked(client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath().toAbsolutePath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); @@ -161,7 +161,7 @@ public class SnapshotBackwardsCompatibilityIT extends ESBackcompatTestCase { final Path tempDir = randomRepoPath().toAbsolutePath(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(Settings.settingsBuilder() + .setType("fs").setSettings(Settings.builder() .put("location", tempDir) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES))); diff --git a/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java b/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java index 426dd2546dd..cbd9bc0e96f 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java +++ b/core/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java @@ -54,8 +54,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - public class MockRepository extends FsRepository { public static class Plugin extends org.elasticsearch.plugins.Plugin { @@ -146,7 +144,7 @@ public class MockRepository extends FsRepository { private static Settings localizeLocation(Settings settings, ClusterService clusterService) { Path location = PathUtils.get(settings.get("location")); location = location.resolve(clusterService.localNode().getId()); - return settingsBuilder().put(settings).put("location", location.toAbsolutePath()).build(); + return Settings.builder().put(settings).put("location", location.toAbsolutePath()).build(); } private long incrementAndGetFailureCount() { diff --git a/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java b/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java index e36ac662342..95a931d1d54 100644 --- a/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java +++ b/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java @@ -34,7 +34,6 @@ import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; -import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.hamcrest.RegexMatcher; import org.elasticsearch.threadpool.ThreadPool.Names; @@ -54,7 +53,6 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; import static org.hamcrest.Matchers.containsString; @@ -68,7 +66,7 @@ import static org.hamcrest.Matchers.sameInstance; public class SimpleThreadPoolIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return Settings.settingsBuilder().build(); + return Settings.builder().build(); } public void testThreadNames() throws Exception { @@ -132,7 +130,7 @@ public class SimpleThreadPoolIT extends ESIntegTestCase { ThreadPool threadPool = internalCluster().getDataNodeInstance(ThreadPool.class); // Check that settings are changed assertThat(((ThreadPoolExecutor) threadPool.executor(Names.SEARCH)).getQueue().remainingCapacity(), equalTo(1000)); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder().put("threadpool.search.queue_size", 2000).build()).execute().actionGet(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put("threadpool.search.queue_size", 2000).build()).execute().actionGet(); assertThat(((ThreadPoolExecutor) threadPool.executor(Names.SEARCH)).getQueue().remainingCapacity(), equalTo(2000)); // Make sure that threads continue executing when executor is replaced @@ -147,7 +145,7 @@ public class SimpleThreadPoolIT extends ESIntegTestCase { // } }); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder().put("threadpool.search.queue_size", 1000).build()).execute().actionGet(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put("threadpool.search.queue_size", 1000).build()).execute().actionGet(); assertThat(threadPool.executor(Names.SEARCH), not(sameInstance(oldExecutor))); assertThat(((ThreadPoolExecutor) oldExecutor).isShutdown(), equalTo(true)); assertThat(((ThreadPoolExecutor) oldExecutor).isTerminating(), equalTo(true)); @@ -165,7 +163,7 @@ public class SimpleThreadPoolIT extends ESIntegTestCase { } } ); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(settingsBuilder().put("threadpool.search.queue_size", 500)).execute().actionGet(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put("threadpool.search.queue_size", 500)).execute().actionGet(); barrier.await(10, TimeUnit.SECONDS); // Check that node info is correct diff --git a/core/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java b/core/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java index 30dd0bd5477..19dd25a7e25 100644 --- a/core/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java +++ b/core/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java @@ -35,7 +35,6 @@ import org.junit.Before; import java.io.IOException; import java.util.Map; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; @@ -97,7 +96,7 @@ public class ThreadPoolSerializationTests extends ESTestCase { } public void testThatNegativeSettingAllowsToStart() throws InterruptedException { - Settings settings = settingsBuilder().put("node.name", "index").put("threadpool.index.queue_size", "-1").build(); + Settings settings = Settings.builder().put("node.name", "index").put("threadpool.index.queue_size", "-1").build(); ThreadPool threadPool = new ThreadPool(settings); assertThat(threadPool.info("index").getQueueSize(), is(nullValue())); terminate(threadPool); diff --git a/core/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java b/core/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java index 67a3f6fd4cf..a3c4e46892d 100644 --- a/core/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java +++ b/core/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java @@ -37,7 +37,6 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; @@ -54,7 +53,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { ThreadPool.ThreadPoolType correctThreadPoolType = ThreadPool.THREAD_POOL_TYPES.get(threadPoolName); ThreadPool threadPool = null; try { - threadPool = new ThreadPool(settingsBuilder() + threadPool = new ThreadPool(Settings.builder() .put("node.name", "testCorrectThreadPoolTypePermittedInSettings") .put("threadpool." + threadPoolName + ".type", correctThreadPoolType.getType()) .build()); @@ -77,7 +76,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { ThreadPool threadPool = null; try { threadPool = new ThreadPool( - settingsBuilder() + Settings.builder() .put("node.name", "testThreadPoolCanNotOverrideThreadPoolType") .put("threadpool." + threadPoolName + ".type", incorrectThreadPoolType.getType()) .build()); @@ -101,7 +100,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { int maxSize = EsExecutors.boundedNumberOfProcessors(Settings.EMPTY); // try to create a too-big (maxSize+1) thread pool - threadPool = new ThreadPool(settingsBuilder() + threadPool = new ThreadPool(Settings.builder() .put("node.name", "testIndexingThreadPoolsMaxSize") .put("threadpool." + name + ".size", maxSize+1) .build()); @@ -114,7 +113,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { // update it to a tiny size: clusterSettings.applySettings( - settingsBuilder() + Settings.builder() .put("threadpool." + name + ".size", 1) .build() ); @@ -124,7 +123,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { // try to update to too-big size: clusterSettings.applySettings( - settingsBuilder() + Settings.builder() .put("threadpool." + name + ".size", maxSize+1) .build() ); @@ -143,12 +142,12 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { ThreadPool.ThreadPoolType validThreadPoolType = ThreadPool.THREAD_POOL_TYPES.get(threadPoolName); ThreadPool threadPool = null; try { - threadPool = new ThreadPool(settingsBuilder().put("node.name", "testUpdateSettingsCanNotChangeThreadPoolType").build()); + threadPool = new ThreadPool(Settings.builder().put("node.name", "testUpdateSettingsCanNotChangeThreadPoolType").build()); ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); threadPool.setClusterSettings(clusterSettings); clusterSettings.applySettings( - settingsBuilder() + Settings.builder() .put("threadpool." + threadPoolName + ".type", invalidThreadPoolType.getType()) .build() ); @@ -167,7 +166,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { String threadPoolName = randomThreadPool(ThreadPool.ThreadPoolType.CACHED); ThreadPool threadPool = null; try { - Settings nodeSettings = Settings.settingsBuilder() + Settings nodeSettings = Settings.builder() .put("node.name", "testCachedExecutorType").build(); threadPool = new ThreadPool(nodeSettings); ClusterSettings clusterSettings = new ClusterSettings(nodeSettings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); @@ -176,7 +175,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { assertEquals(info(threadPool, threadPoolName).getThreadPoolType(), ThreadPool.ThreadPoolType.CACHED); assertThat(threadPool.executor(threadPoolName), instanceOf(EsThreadPoolExecutor.class)); - Settings settings = clusterSettings.applySettings(settingsBuilder() + Settings settings = clusterSettings.applySettings(Settings.builder() .put("threadpool." + threadPoolName + ".keep_alive", "10m") .build()); assertEquals(info(threadPool, threadPoolName).getThreadPoolType(), ThreadPool.ThreadPoolType.CACHED); @@ -192,7 +191,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { // Change keep alive Executor oldExecutor = threadPool.executor(threadPoolName); - settings = clusterSettings.applySettings(settingsBuilder().put(settings).put("threadpool." + threadPoolName + ".keep_alive", "1m").build()); + settings = clusterSettings.applySettings(Settings.builder().put(settings).put("threadpool." + threadPoolName + ".keep_alive", "1m").build()); // Make sure keep alive value changed assertThat(info(threadPool, threadPoolName).getKeepAlive().minutes(), equalTo(1L)); assertThat(((EsThreadPoolExecutor) threadPool.executor(threadPoolName)).getKeepAliveTime(TimeUnit.MINUTES), equalTo(1L)); @@ -201,7 +200,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { assertThat(threadPool.executor(threadPoolName), sameInstance(oldExecutor)); // Set the same keep alive - settings = clusterSettings.applySettings(settingsBuilder().put(settings).put("threadpool." + threadPoolName + ".keep_alive", "1m").build()); + settings = clusterSettings.applySettings(Settings.builder().put(settings).put("threadpool." + threadPoolName + ".keep_alive", "1m").build()); // Make sure keep alive value didn't change assertThat(info(threadPool, threadPoolName).getKeepAlive().minutes(), equalTo(1L)); assertThat(((EsThreadPoolExecutor) threadPool.executor(threadPoolName)).getKeepAliveTime(TimeUnit.MINUTES), equalTo(1L)); @@ -226,13 +225,13 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { ThreadPool threadPool = null; try { - Settings nodeSettings = Settings.settingsBuilder() + Settings nodeSettings = Settings.builder() .put("node.name", "testFixedExecutorType").build(); threadPool = new ThreadPool(nodeSettings); ClusterSettings clusterSettings = new ClusterSettings(nodeSettings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS); threadPool.setClusterSettings(clusterSettings); assertThat(threadPool.executor(threadPoolName), instanceOf(EsThreadPoolExecutor.class)); - Settings settings = clusterSettings.applySettings(settingsBuilder() + Settings settings = clusterSettings.applySettings(Settings.builder() .put("threadpool." + threadPoolName + ".size", "15") .build()); @@ -260,7 +259,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { // Change size Executor oldExecutor = threadPool.executor(threadPoolName); - settings = clusterSettings.applySettings(settingsBuilder().put(settings).put("threadpool." + threadPoolName + ".size", "10").build()); + settings = clusterSettings.applySettings(Settings.builder().put(settings).put("threadpool." + threadPoolName + ".size", "10").build()); expectedSize = getExpectedThreadPoolSize(nodeSettings, threadPoolName, 10); @@ -274,7 +273,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { assertThat(threadPool.executor(threadPoolName), sameInstance(oldExecutor)); // Change queue capacity - settings = clusterSettings.applySettings(settingsBuilder().put(settings).put("threadpool." + threadPoolName + ".queue", "500") + settings = clusterSettings.applySettings(Settings.builder().put(settings).put("threadpool." + threadPoolName + ".queue", "500") .build()); } finally { terminateThreadPoolIfNeeded(threadPool); @@ -285,7 +284,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { String threadPoolName = randomThreadPool(ThreadPool.ThreadPoolType.SCALING); ThreadPool threadPool = null; try { - Settings nodeSettings = settingsBuilder() + Settings nodeSettings = Settings.builder() .put("threadpool." + threadPoolName + ".size", 10) .put("node.name", "testScalingExecutorType").build(); threadPool = new ThreadPool(nodeSettings); @@ -299,7 +298,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { // Change settings that doesn't require pool replacement Executor oldExecutor = threadPool.executor(threadPoolName); - clusterSettings.applySettings(settingsBuilder() + clusterSettings.applySettings(Settings.builder() .put("threadpool." + threadPoolName + ".keep_alive", "10m") .put("threadpool." + threadPoolName + ".min", "2") .put("threadpool." + threadPoolName + ".size", "15") @@ -323,7 +322,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { String threadPoolName = randomThreadPool(ThreadPool.ThreadPoolType.FIXED); ThreadPool threadPool = null; try { - Settings nodeSettings = Settings.settingsBuilder() + Settings nodeSettings = Settings.builder() .put("threadpool." + threadPoolName + ".queue_size", 1000) .put("node.name", "testShutdownNowInterrupts").build(); threadPool = new ThreadPool(nodeSettings); @@ -342,7 +341,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { } } ); - clusterSettings.applySettings(settingsBuilder().put("threadpool." + threadPoolName + ".queue_size", 2000).build()); + clusterSettings.applySettings(Settings.builder().put("threadpool." + threadPoolName + ".queue_size", 2000).build()); assertThat(threadPool.executor(threadPoolName), not(sameInstance(oldExecutor))); assertThat(oldExecutor.isShutdown(), equalTo(true)); assertThat(oldExecutor.isTerminating(), equalTo(true)); @@ -357,7 +356,7 @@ public class UpdateThreadPoolSettingsTests extends ESTestCase { public void testCustomThreadPool() throws Exception { ThreadPool threadPool = null; try { - Settings nodeSettings = Settings.settingsBuilder() + Settings nodeSettings = Settings.builder() .put("threadpool.my_pool1.type", "scaling") .put("threadpool.my_pool2.type", "fixed") .put("threadpool.my_pool2.size", "1") diff --git a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java index 36c75c3a13e..bcae62d693c 100644 --- a/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java +++ b/core/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportIT.java @@ -66,7 +66,6 @@ import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; @@ -88,7 +87,7 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("script.indexed", "true") .put(NetworkModule.HTTP_ENABLED.getKey(), true) @@ -109,7 +108,7 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase { .endObject() .endObject().endObject().string(); - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_SHARDS, 1) // A single shard will help to keep the tests repeatable. .build(); diff --git a/core/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java b/core/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java index 9de8de67ce0..cc1b7869a58 100644 --- a/core/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java +++ b/core/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java @@ -41,7 +41,6 @@ import java.net.InetAddress; import java.net.Socket; import java.nio.charset.StandardCharsets; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; /** @@ -50,7 +49,7 @@ import static org.hamcrest.Matchers.is; */ public class NettySizeHeaderFrameDecoderTests extends ESTestCase { - private final Settings settings = settingsBuilder() + private final Settings settings = Settings.builder() .put("node.name", "NettySizeHeaderFrameDecoderTests") .put(TransportSettings.BIND_HOST.getKey(), "127.0.0.1") .put(TransportSettings.PORT.getKey(), "0") diff --git a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java index d9466d28424..dc0a533707e 100644 --- a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java +++ b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportIT.java @@ -53,7 +53,6 @@ import java.net.InetSocketAddress; import java.util.Collection; import java.util.Collections; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; @@ -67,7 +66,7 @@ public class NettyTransportIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put(Node.NODE_MODE_SETTING.getKey(), "network") .put(NetworkModule.TRANSPORT_TYPE_KEY, "exception-throwing").build(); } diff --git a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationIT.java b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationIT.java index e66fd277aca..51fd3bf7f75 100644 --- a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationIT.java +++ b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationIT.java @@ -38,7 +38,6 @@ import org.elasticsearch.test.junit.annotations.Network; import java.net.InetAddress; import java.util.Locale; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.hasKey; @@ -59,7 +58,7 @@ public class NettyTransportMultiPortIntegrationIT extends ESIntegTestCase { randomPort = randomIntBetween(49152, 65525); randomPortRange = String.format(Locale.ROOT, "%s-%s", randomPort, randomPort+10); } - Settings.Builder builder = settingsBuilder() + Settings.Builder builder = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("network.host", "127.0.0.1") .put(NetworkModule.TRANSPORT_TYPE_KEY, "netty") @@ -72,7 +71,7 @@ public class NettyTransportMultiPortIntegrationIT extends ESIntegTestCase { } public void testThatTransportClientCanConnect() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("cluster.name", internalCluster().getClusterName()) .put(NetworkModule.TRANSPORT_TYPE_KEY, "netty") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) diff --git a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java index 6eaf7387616..0ea059d46fa 100644 --- a/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java +++ b/core/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java @@ -34,7 +34,6 @@ import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportSettings; import org.junit.Before; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; public class NettyTransportMultiPortTests extends ESTestCase { @@ -51,7 +50,7 @@ public class NettyTransportMultiPortTests extends ESTestCase { } public void testThatNettyCanBindToMultiplePorts() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("network.host", host) .put(TransportSettings.PORT.getKey(), 22) // will not actually bind to this .put("transport.profiles.default.port", 0) @@ -68,7 +67,7 @@ public class NettyTransportMultiPortTests extends ESTestCase { } public void testThatDefaultProfileInheritsFromStandardSettings() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("network.host", host) .put(TransportSettings.PORT.getKey(), 0) .put("transport.profiles.client1.port", 0) @@ -85,7 +84,7 @@ public class NettyTransportMultiPortTests extends ESTestCase { public void testThatProfileWithoutPortSettingsFails() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("network.host", host) .put(TransportSettings.PORT.getKey(), 0) .put("transport.profiles.client1.whatever", "foo") @@ -101,7 +100,7 @@ public class NettyTransportMultiPortTests extends ESTestCase { } public void testThatDefaultProfilePortOverridesGeneralConfiguration() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("network.host", host) .put(TransportSettings.PORT.getKey(), 22) // will not actually bind to this .put("transport.profiles.default.port", 0) @@ -117,7 +116,7 @@ public class NettyTransportMultiPortTests extends ESTestCase { } public void testThatProfileWithoutValidNameIsIgnored() throws Exception { - Settings settings = settingsBuilder() + Settings settings = Settings.builder() .put("network.host", host) .put(TransportSettings.PORT.getKey(), 0) // mimics someone trying to define a profile for .local which is the profile for a node request to itself diff --git a/core/src/test/java/org/elasticsearch/ttl/SimpleTTLIT.java b/core/src/test/java/org/elasticsearch/ttl/SimpleTTLIT.java index 9678504f4f3..57e668678e8 100644 --- a/core/src/test/java/org/elasticsearch/ttl/SimpleTTLIT.java +++ b/core/src/test/java/org/elasticsearch/ttl/SimpleTTLIT.java @@ -38,7 +38,6 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.both; @@ -62,7 +61,7 @@ public class SimpleTTLIT extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("indices.ttl.interval", PURGE_INTERVAL, TimeUnit.MILLISECONDS) .build(); diff --git a/core/src/test/java/org/elasticsearch/validate/SimpleValidateQueryIT.java b/core/src/test/java/org/elasticsearch/validate/SimpleValidateQueryIT.java index 5fc24094bd3..2b163a4d7ea 100644 --- a/core/src/test/java/org/elasticsearch/validate/SimpleValidateQueryIT.java +++ b/core/src/test/java/org/elasticsearch/validate/SimpleValidateQueryIT.java @@ -118,7 +118,7 @@ public class SimpleValidateQueryIT extends ESIntegTestCase { // Issue #3629 public void testExplainDateRangeInQueryString() { - assertAcked(prepareCreate("test").setSettings(Settings.settingsBuilder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.number_of_shards", 1))); @@ -178,7 +178,7 @@ public class SimpleValidateQueryIT extends ESIntegTestCase { public void testExplainMatchPhrasePrefix() { assertAcked(prepareCreate("test").setSettings( - Settings.settingsBuilder().put(indexSettings()) + Settings.builder().put(indexSettings()) .put("index.analysis.filter.syns.type", "synonym") .putArray("index.analysis.filter.syns.synonyms", "one,two") .put("index.analysis.analyzer.syns.tokenizer", "standard") diff --git a/core/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationIT.java b/core/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationIT.java index 6b69a038a00..b2cc794ac6c 100644 --- a/core/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationIT.java +++ b/core/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationIT.java @@ -21,13 +21,13 @@ package org.elasticsearch.versioning; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.index.IndexResponse; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicReference; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -39,7 +39,7 @@ public class ConcurrentDocumentOperationIT extends ESIntegTestCase { public void testConcurrentOperationOnSameDoc() throws Exception { logger.info("--> create an index with 1 shard and max replicas based on nodes"); assertAcked(prepareCreate("test") - .setSettings(settingsBuilder().put(indexSettings()).put("index.number_of_shards", 1))); + .setSettings(Settings.builder().put(indexSettings()).put("index.number_of_shards", 1))); logger.info("execute concurrent updates on the same doc"); int numberOfUpdates = 100; diff --git a/core/src/test/java/org/elasticsearch/versioning/SimpleVersioningIT.java b/core/src/test/java/org/elasticsearch/versioning/SimpleVersioningIT.java index 5787df3cd72..2356395219f 100644 --- a/core/src/test/java/org/elasticsearch/versioning/SimpleVersioningIT.java +++ b/core/src/test/java/org/elasticsearch/versioning/SimpleVersioningIT.java @@ -701,7 +701,7 @@ public class SimpleVersioningIT extends ESIntegTestCase { .admin() .indices() .prepareCreate("test") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("index.number_of_shards", 1)) .execute(). actionGet(); diff --git a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/GeoDistanceTests.java b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/GeoDistanceTests.java index a748c3cfd33..e9c4bf6e359 100644 --- a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/GeoDistanceTests.java +++ b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/GeoDistanceTests.java @@ -55,7 +55,7 @@ public class GeoDistanceTests extends ESIntegTestCase { double target_long = -117.21; Version version = VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.CURRENT); - Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build(); XContentBuilder xContentBuilder = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("properties").startObject("location").field("type", "geo_point"); if (version.before(Version.V_2_2_0)) { diff --git a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/IndexLookupTests.java b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/IndexLookupTests.java index 4de3d448d99..1cef890813f 100644 --- a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/IndexLookupTests.java +++ b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/IndexLookupTests.java @@ -139,7 +139,7 @@ public class IndexLookupTests extends ESIntegTestCase { .startObject("int_payload_field").field("type", "text").field("index_options", "offsets") .field("analyzer", "payload_int").endObject().endObject().endObject().endObject(); assertAcked(prepareCreate("test").addMapping("type1", mapping).setSettings( - Settings.settingsBuilder() + Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.payload_int.tokenizer", "whitespace") .putArray("index.analysis.analyzer.payload_int.filter", "delimited_int") @@ -405,7 +405,7 @@ public class IndexLookupTests extends ESIntegTestCase { .startObject("int_payload_field").field("type", "text").field("index_options", "offsets") .field("analyzer", "payload_int").endObject().endObject().endObject().endObject(); assertAcked(prepareCreate("test").addMapping("type1", mapping).setSettings( - Settings.settingsBuilder() + Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.payload_float.tokenizer", "whitespace") .putArray("index.analysis.analyzer.payload_float.filter", "delimited_float") diff --git a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptQuerySearchTests.java b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptQuerySearchTests.java index aa47fe98bb3..bd9f8c3e7ff 100644 --- a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptQuerySearchTests.java +++ b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptQuerySearchTests.java @@ -51,7 +51,7 @@ public class ScriptQuerySearchTests extends ESIntegTestCase { @Override public Settings indexSettings() { - return Settings.settingsBuilder().put(super.indexSettings()) + return Settings.builder().put(super.indexSettings()) // aggressive filter caching so that we can assert on the number of iterations of the script filters .put(IndexModule.INDEX_QUERY_CACHE_TYPE_SETTING.getKey(), IndexModule.INDEX_QUERY_CACHE) .put(IndexModule.INDEX_QUERY_CACHE_EVERYTHING_SETTING.getKey(), true) diff --git a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptedMetricTests.java b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptedMetricTests.java index 6840ce5c6e8..11c7c2ab6d4 100644 --- a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptedMetricTests.java +++ b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptedMetricTests.java @@ -122,7 +122,7 @@ public class ScriptedMetricTests extends ESIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(Environment.PATH_CONF_SETTING.getKey(), getDataPath("/org/elasticsearch/messy/tests/conf")) .build(); diff --git a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java index 279a5149679..7dca27454ab 100644 --- a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java +++ b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java @@ -482,7 +482,7 @@ public class SearchFieldsTests extends ESIntegTestCase { public void testGetFieldsComplexField() throws Exception { client().admin().indices().prepareCreate("my-index") - .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1)) + .setSettings(Settings.builder().put("index.refresh_interval", -1)) .addMapping("my-type2", jsonBuilder().startObject().startObject("my-type2").startObject("properties") .startObject("field1").field("type", "object").startObject("properties") .startObject("field2").field("type", "object").startObject("properties") diff --git a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/RenderSearchTemplateTests.java b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/RenderSearchTemplateTests.java index 39b2f290cd3..8d73da63033 100644 --- a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/RenderSearchTemplateTests.java +++ b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/RenderSearchTemplateTests.java @@ -40,7 +40,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; @@ -68,7 +67,7 @@ public class RenderSearchTemplateTests extends ESIntegTestCase { } catch (Exception e) { throw new RuntimeException(e); } - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put(Environment.PATH_CONF_SETTING.getKey(), configDir).build(); } diff --git a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java index 79cac3181ea..234eeee0070 100644 --- a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java +++ b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.messy.tests; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.elasticsearch.search.suggest.SuggestBuilders.phraseSuggestion; import static org.elasticsearch.search.suggest.SuggestBuilders.termSuggestion; @@ -59,8 +58,8 @@ import org.elasticsearch.action.search.ReduceSearchPhaseException; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.common.io.PathUtils; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.plugins.Plugin; @@ -180,7 +179,7 @@ public class SuggestSearchTests extends ESIntegTestCase { // see #3037 public void testSuggestModes() throws IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) .put("index.analysis.analyzer.biword.tokenizer", "standard") @@ -262,7 +261,7 @@ public class SuggestSearchTests extends ESIntegTestCase { } public void testUnmappedField() throws IOException, InterruptedException, ExecutionException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.biword.tokenizer", "standard") .putArray("index.analysis.analyzer.biword.filter", "shingler", "lowercase") @@ -437,7 +436,7 @@ public class SuggestSearchTests extends ESIntegTestCase { // see #2817 public void testStopwordsOnlyPhraseSuggest() throws IOException { assertAcked(prepareCreate("test").addMapping("typ1", "body", "type=text,analyzer=stopwd").setSettings( - settingsBuilder() + Settings.builder() .put("index.analysis.analyzer.stopwd.tokenizer", "whitespace") .putArray("index.analysis.analyzer.stopwd.filter", "stop") )); @@ -453,7 +452,7 @@ public class SuggestSearchTests extends ESIntegTestCase { } public void testPrefixLength() throws IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, 1) .put("index.analysis.analyzer.reverse.tokenizer", "standard") .putArray("index.analysis.analyzer.reverse.filter", "lowercase", "reverse") @@ -496,7 +495,7 @@ public class SuggestSearchTests extends ESIntegTestCase { @Nightly public void testMarvelHerosPhraseSuggest() throws IOException, URISyntaxException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.reverse.tokenizer", "standard") .putArray("index.analysis.analyzer.reverse.filter", "lowercase", "reverse") @@ -627,7 +626,7 @@ public class SuggestSearchTests extends ESIntegTestCase { } public void testSizePararm() throws IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, 1) .put("index.analysis.analyzer.reverse.tokenizer", "standard") .putArray("index.analysis.analyzer.reverse.filter", "lowercase", "reverse") @@ -692,7 +691,7 @@ public class SuggestSearchTests extends ESIntegTestCase { @Nightly public void testPhraseBoundaryCases() throws IOException, URISyntaxException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()).put(SETTING_NUMBER_OF_SHARDS, 1) // to get reliable statistics we should put this all into one shard .put("index.analysis.analyzer.body.tokenizer", "standard") .putArray("index.analysis.analyzer.body.filter", "lowercase") @@ -803,7 +802,7 @@ public class SuggestSearchTests extends ESIntegTestCase { // see #3469 public void testShardFailures() throws IOException, InterruptedException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.suggest.tokenizer", "standard") .putArray("index.analysis.analyzer.suggest.filter", "standard", "lowercase", "shingler") @@ -863,7 +862,7 @@ public class SuggestSearchTests extends ESIntegTestCase { endObject(). endObject(). endObject(); - assertAcked(prepareCreate("test").setSettings(settingsBuilder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.suggest.tokenizer", "standard") .putArray("index.analysis.analyzer.suggest.filter", "standard", "lowercase", "shingler") @@ -898,7 +897,7 @@ public class SuggestSearchTests extends ESIntegTestCase { // If there isn't enough chaf per shard then shards can become unbalanced, making the cutoff recheck this is testing do more harm then good. int chafPerShard = 100; - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put("index.analysis.analyzer.body.tokenizer", "standard") .putArray("index.analysis.analyzer.body.filter", "lowercase", "my_shingle") @@ -957,7 +956,7 @@ public class SuggestSearchTests extends ESIntegTestCase { @Nightly public void testSuggestWithManyCandidates() throws InterruptedException, ExecutionException, IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_SHARDS, 1) // A single shard will help to keep the tests repeatable. .put("index.analysis.analyzer.text.tokenizer", "standard") @@ -1101,7 +1100,7 @@ public class SuggestSearchTests extends ESIntegTestCase { } public void testPhraseSuggesterCollate() throws InterruptedException, ExecutionException, IOException { - CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder() + CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_SHARDS, 1) // A single shard will help to keep the tests repeatable. .put("index.analysis.analyzer.text.tokenizer", "standard") diff --git a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryParserTests.java b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryParserTests.java index fdc888569d5..4523843c4c3 100644 --- a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryParserTests.java +++ b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryParserTests.java @@ -88,7 +88,7 @@ public class TemplateQueryParserTests extends ESTestCase { @Before public void setup() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .put(Environment.PATH_CONF_SETTING.getKey(), this.getDataPath("config")) .put("node.name", getClass().getName()) diff --git a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryTests.java b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryTests.java index eb9b917c17f..d4d400c145a 100644 --- a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryTests.java +++ b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryTests.java @@ -52,7 +52,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.test.ESIntegTestCase; import org.junit.Before; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFailures; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; @@ -84,7 +83,7 @@ public class TemplateQueryTests extends ESIntegTestCase { @Override public Settings nodeSettings(int nodeOrdinal) { - return settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put(Environment.PATH_CONF_SETTING.getKey(), this.getDataPath("config")).build(); } diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuCollationTokenFilterTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuCollationTokenFilterTests.java index adf1faaf92f..71752196af0 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuCollationTokenFilterTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuCollationTokenFilterTests.java @@ -45,7 +45,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * Then things will sort and match correctly. */ public void testBasicUsage() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "tr") .put("index.analysis.filter.myCollator.strength", "primary") @@ -60,7 +60,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * Test usage of the decomposition option for unicode normalization. */ public void testNormalization() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "tr") .put("index.analysis.filter.myCollator.strength", "primary") @@ -76,7 +76,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * Test secondary strength, for english case is not significant. */ public void testSecondaryStrength() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "en") .put("index.analysis.filter.myCollator.strength", "secondary") @@ -93,7 +93,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * to quaternary level */ public void testIgnorePunctuation() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "en") .put("index.analysis.filter.myCollator.strength", "primary") @@ -110,7 +110,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * punctuation or symbols, to quaternary level */ public void testIgnoreWhitespace() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "en") .put("index.analysis.filter.myCollator.strength", "primary") @@ -130,7 +130,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * foobar-9 sorts before foobar-10 */ public void testNumerics() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "en") .put("index.analysis.filter.myCollator.numeric", "true") @@ -146,7 +146,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * secondary and tertiary */ public void testIgnoreAccentsButNotCase() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "en") .put("index.analysis.filter.myCollator.strength", "primary") @@ -166,7 +166,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { * before lowercase ones. */ public void testUpperCaseFirst() throws IOException { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.language", "en") .put("index.analysis.filter.myCollator.strength", "tertiary") @@ -195,7 +195,7 @@ public class SimpleIcuCollationTokenFilterTests extends ESTestCase { RuleBasedCollator tailoredCollator = new RuleBasedCollator(baseCollator.getRules() + DIN5007_2_tailorings); String tailoredRules = tailoredCollator.getRules(); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myCollator.type", "icu_collation") .put("index.analysis.filter.myCollator.rules", tailoredRules) .put("index.analysis.filter.myCollator.strength", "primary") diff --git a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuNormalizerCharFilterTests.java b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuNormalizerCharFilterTests.java index 749b04b2260..96defd0e076 100644 --- a/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuNormalizerCharFilterTests.java +++ b/plugins/analysis-icu/src/test/java/org/elasticsearch/index/analysis/SimpleIcuNormalizerCharFilterTests.java @@ -34,7 +34,7 @@ import java.io.StringReader; */ public class SimpleIcuNormalizerCharFilterTests extends ESTestCase { public void testDefaultSetting() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.char_filter.myNormalizerChar.type", "icu_normalizer") .build(); AnalysisService analysisService = createAnalysisService(new Index("test", "_na_"), settings, new AnalysisICUPlugin()::onModule); @@ -56,7 +56,7 @@ public class SimpleIcuNormalizerCharFilterTests extends ESTestCase { } public void testNameAndModeSetting() throws Exception { - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.char_filter.myNormalizerChar.type", "icu_normalizer") .put("index.analysis.char_filter.myNormalizerChar.name", "nfkc") .put("index.analysis.char_filter.myNormalizerChar.mode", "decompose") diff --git a/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java b/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java index 93aeddeee5f..540e11250d0 100644 --- a/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java +++ b/plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java @@ -193,7 +193,7 @@ public class KuromojiAnalysisTests extends ESTestCase { Files.copy(dict, config.resolve("user_dict.txt")); String json = "/org/elasticsearch/index/analysis/kuromoji_analysis.json"; - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .loadFromStream(json, KuromojiAnalysisTests.class.getResourceAsStream(json)) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build(); diff --git a/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java b/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java index 688394b6844..18e49fa6e51 100644 --- a/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java +++ b/plugins/analysis-phonetic/src/test/java/org/elasticsearch/index/analysis/SimplePhoneticAnalysisTests.java @@ -29,7 +29,6 @@ import org.hamcrest.MatcherAssert; import java.io.IOException; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.instanceOf; /** @@ -37,7 +36,7 @@ import static org.hamcrest.Matchers.instanceOf; public class SimplePhoneticAnalysisTests extends ESTestCase { public void testPhoneticTokenFilterFactory() throws IOException { String yaml = "/org/elasticsearch/index/analysis/phonetic-1.yml"; - Settings settings = settingsBuilder().loadFromStream(yaml, getClass().getResourceAsStream(yaml)) + Settings settings = Settings.builder().loadFromStream(yaml, getClass().getResourceAsStream(yaml)) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build(); AnalysisService analysisService = createAnalysisService(new Index("test", "_na_"), settings, diff --git a/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/SimplePolishTokenFilterTests.java b/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/SimplePolishTokenFilterTests.java index 193cfea6811..9458b6920c4 100644 --- a/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/SimplePolishTokenFilterTests.java +++ b/plugins/analysis-stempel/src/test/java/org/elasticsearch/index/analysis/SimplePolishTokenFilterTests.java @@ -46,7 +46,7 @@ public class SimplePolishTokenFilterTests extends ESTestCase { private void testToken(String source, String expected) throws IOException { Index index = new Index("test", "_na_"); - Settings settings = Settings.settingsBuilder() + Settings settings = Settings.builder() .put("index.analysis.filter.myStemmer.type", "polish_stem") .build(); AnalysisService analysisService = createAnalysisService(index, settings, new AnalysisStempelPlugin()::onModule); diff --git a/plugins/delete-by-query/src/test/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryTests.java b/plugins/delete-by-query/src/test/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryTests.java index 3c595b1ab16..1245c83444c 100644 --- a/plugins/delete-by-query/src/test/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryTests.java +++ b/plugins/delete-by-query/src/test/java/org/elasticsearch/plugin/deletebyquery/DeleteByQueryTests.java @@ -335,7 +335,7 @@ public class DeleteByQueryTests extends ESIntegTestCase { } public void testConcurrentDeleteByQueriesOnSameDocs() throws Throwable { - assertAcked(prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.refresh_interval", -1))); ensureGreen(); final long docs = randomIntBetween(50, 100); diff --git a/plugins/discovery-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTestCase.java b/plugins/discovery-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTestCase.java index c5a05871cd8..3f78b1f6683 100644 --- a/plugins/discovery-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTestCase.java +++ b/plugins/discovery-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureComputeServiceTestCase.java @@ -41,7 +41,7 @@ public abstract class AbstractAzureComputeServiceTestCase extends ESIntegTestCas @Override protected Settings nodeSettings(int nodeOrdinal) { - Settings.Builder builder = Settings.settingsBuilder() + Settings.Builder builder = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("discovery.type", "azure") // We need the network to make the mock working diff --git a/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTests.java b/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTests.java index 0da34ad45ca..46c3f8af7c2 100644 --- a/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTests.java +++ b/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureMinimumMasterNodesTests.java @@ -49,7 +49,7 @@ public class AzureMinimumMasterNodesTests extends AbstractAzureComputeServiceTes @Override protected Settings nodeSettings(int nodeOrdinal) { - Settings.Builder builder = Settings.settingsBuilder() + Settings.Builder builder = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("discovery.zen.minimum_master_nodes", 2) // Make the test run faster diff --git a/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTests.java b/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTests.java index 7e445c75104..7a85909a13e 100644 --- a/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTests.java +++ b/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTests.java @@ -39,7 +39,7 @@ public class AzureSimpleTests extends AbstractAzureComputeServiceTestCase { } public void testOneNodeDhouldRunUsingPrivateIp() { - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(Management.SERVICE_NAME_SETTING.getKey(), "dummy") .put(Discovery.HOST_TYPE_SETTING.getKey(), "private_ip"); @@ -52,7 +52,7 @@ public class AzureSimpleTests extends AbstractAzureComputeServiceTestCase { } public void testOneNodeShouldRunUsingPublicIp() { - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(Management.SERVICE_NAME_SETTING.getKey(), "dummy") .put(Discovery.HOST_TYPE_SETTING.getKey(), "public_ip"); @@ -65,7 +65,7 @@ public class AzureSimpleTests extends AbstractAzureComputeServiceTestCase { } public void testOneNodeShouldRunUsingWrongSettings() { - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(Management.SERVICE_NAME_SETTING.getKey(), "dummy") .put(Discovery.HOST_TYPE_SETTING.getKey(), "do_not_exist"); diff --git a/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTests.java b/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTests.java index b61dcf8de2e..6431696c2eb 100644 --- a/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTests.java +++ b/plugins/discovery-azure/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTests.java @@ -40,7 +40,7 @@ public class AzureTwoStartedNodesTests extends AbstractAzureComputeServiceTestCa @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/11533") public void testTwoNodesShouldRunUsingPrivateIp() { - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(Management.SERVICE_NAME_SETTING.getKey(), "dummy") .put(Discovery.HOST_TYPE_SETTING.getKey(), "private_ip"); @@ -58,7 +58,7 @@ public class AzureTwoStartedNodesTests extends AbstractAzureComputeServiceTestCa @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/11533") public void testTwoNodesShouldRunUsingPublicIp() { - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(Management.SERVICE_NAME_SETTING.getKey(), "dummy") .put(Discovery.HOST_TYPE_SETTING.getKey(), "public_ip"); diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryTests.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryTests.java index 1705421207b..d86efaa2a85 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryTests.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryTests.java @@ -250,7 +250,7 @@ public class Ec2DiscoveryTests extends ESTestCase { } public void testGetNodeListCached() throws Exception { - Settings.Builder builder = Settings.settingsBuilder() + Settings.Builder builder = Settings.builder() .put(DISCOVERY_EC2.NODE_CACHE_TIME_SETTING.getKey(), "500ms"); AwsEc2Service awsEc2Service = new AwsEc2ServiceMock(Settings.EMPTY, 1, null); DummyEc2HostProvider provider = new DummyEc2HostProvider(builder.build(), transportService, awsEc2Service, Version.CURRENT) { diff --git a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsTests.java b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsTests.java index 2af1b47f622..cdb45bfe087 100644 --- a/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsTests.java +++ b/plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.is; /** @@ -37,15 +36,15 @@ import static org.hamcrest.CoreMatchers.is; @ClusterScope(scope = Scope.TEST, numDataNodes = 0, numClientNodes = 0, transportClientRatio = 0.0) public class Ec2DiscoveryUpdateSettingsTests extends AbstractAwsTestCase { public void testMinimumMasterNodesStart() { - Settings nodeSettings = settingsBuilder() + Settings nodeSettings = Settings.builder() .put("discovery.type", "ec2") .build(); internalCluster().startNode(nodeSettings); // We try to update minimum_master_nodes now ClusterUpdateSettingsResponse response = client().admin().cluster().prepareUpdateSettings() - .setPersistentSettings(settingsBuilder().put("discovery.zen.minimum_master_nodes", 1)) - .setTransientSettings(settingsBuilder().put("discovery.zen.minimum_master_nodes", 1)) + .setPersistentSettings(Settings.builder().put("discovery.zen.minimum_master_nodes", 1)) + .setTransientSettings(Settings.builder().put("discovery.zen.minimum_master_nodes", 1)) .get(); Integer min = response.getPersistentSettings().getAsInt("discovery.zen.minimum_master_nodes", null); diff --git a/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/LanguageDetectionAttachmentMapperTests.java b/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/LanguageDetectionAttachmentMapperTests.java index e8ed5bcdfe4..7451524364b 100644 --- a/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/LanguageDetectionAttachmentMapperTests.java +++ b/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/LanguageDetectionAttachmentMapperTests.java @@ -52,7 +52,7 @@ public class LanguageDetectionAttachmentMapperTests extends AttachmentUnitTestCa public void setupMapperParser(boolean langDetect) throws IOException { DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), - Settings.settingsBuilder().put("index.mapping.attachment.detect_language", langDetect).build(), + Settings.builder().put("index.mapping.attachment.detect_language", langDetect).build(), getIndicesModuleWithRegisteredAttachmentMapper()).documentMapperParser(); String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/language/language-mapping.json"); docMapper = mapperParser.parse("person", new CompressedXContent(mapping)); diff --git a/plugins/repository-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTestCase.java b/plugins/repository-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTestCase.java index d8bca609ce3..cd7effa417f 100644 --- a/plugins/repository-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTestCase.java +++ b/plugins/repository-azure/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureRepositoryServiceTestCase.java @@ -79,7 +79,7 @@ public abstract class AbstractAzureRepositoryServiceTestCase extends AbstractAzu @Override protected Settings nodeSettings(int nodeOrdinal) { - Settings.Builder builder = Settings.settingsBuilder() + Settings.Builder builder = Settings.builder() .put(Storage.CONTAINER_SETTING.getKey(), "snapshots"); return builder.build(); } diff --git a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreServiceTests.java b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreServiceTests.java index 995ae9256ac..99e20e1ee4a 100644 --- a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreServiceTests.java +++ b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreServiceTests.java @@ -48,7 +48,7 @@ public class AzureSnapshotRestoreServiceTests extends AbstractAzureRepositorySer Client client = client(); logger.info("--> creating azure repository with path [{}]", basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("azure").setSettings(Settings.settingsBuilder() + .setType("azure").setSettings(Settings.builder() .put("base_path", basePath) .put("chunk_size", randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) ).get(); diff --git a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreTests.java b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreTests.java index 09c77da4633..99e813f1a29 100644 --- a/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreTests.java +++ b/plugins/repository-azure/src/test/java/org/elasticsearch/repositories/azure/AzureSnapshotRestoreTests.java @@ -105,7 +105,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa Client client = client(); logger.info("--> creating azure repository with path [{}]", getRepositoryPath()); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("azure").setSettings(Settings.settingsBuilder() + .setType("azure").setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName()) .put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()) .put(Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) @@ -196,7 +196,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa logger.info("creating Azure repository with path [{}]", getRepositoryPath()); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository(repositoryName) - .setType("azure").setSettings(Settings.settingsBuilder() + .setType("azure").setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName()) .put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()) .put(Repository.BASE_PATH_SETTING.getKey(), randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) @@ -236,14 +236,14 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa Client client = client(); logger.info("--> creating azure repository with path [{}]", getRepositoryPath()); PutRepositoryResponse putRepositoryResponse1 = client.admin().cluster().preparePutRepository("test-repo1") - .setType("azure").setSettings(Settings.settingsBuilder() + .setType("azure").setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName().concat("-1")) .put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()) .put(Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) ).get(); assertThat(putRepositoryResponse1.isAcknowledged(), equalTo(true)); PutRepositoryResponse putRepositoryResponse2 = client.admin().cluster().preparePutRepository("test-repo2") - .setType("azure").setSettings(Settings.settingsBuilder() + .setType("azure").setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName().concat("-2")) .put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()) .put(Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) @@ -315,7 +315,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa ClusterAdminClient client = client().admin().cluster(); logger.info("--> creating azure repository without any path"); PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName()) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -336,7 +336,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa logger.info("--> creating azure repository path [{}]", getRepositoryPath()); putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName()) .put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()) ).get(); @@ -362,7 +362,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa ClusterAdminClient client = client().admin().cluster(); logger.info("--> creating azure repository without any path"); PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName()) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -413,7 +413,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa public void run() { try { PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") - .setType("azure").setSettings(Settings.settingsBuilder() + .setType("azure").setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), container) .put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()) .put(Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) @@ -443,7 +443,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa Client client = client(); logger.info("--> creating azure repository with path [{}]", getRepositoryPath()); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("azure").setSettings(Settings.settingsBuilder() + .setType("azure").setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), getContainerName()) .put(Repository.BASE_PATH_SETTING.getKey(), getRepositoryPath()) .put(Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000), ByteSizeUnit.BYTES) @@ -491,7 +491,7 @@ public class AzureSnapshotRestoreTests extends AbstractAzureWithThirdPartyTestCa logger.info("--> creating azure repository while container is being removed"); try { client.preparePutRepository("test-repo").setType("azure") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put(Repository.CONTAINER_SETTING.getKey(), container) ).get(); fail("we should get a RepositoryVerificationException"); diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java index 0e838d17fd3..a6ed0858474 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java @@ -47,7 +47,7 @@ public class HdfsTests extends ESSingleNodeTestCase { PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("hdfs") - .setSettings(Settings.settingsBuilder() + .setSettings(Settings.builder() .put("uri", "hdfs:///") .put("conf.fs.AbstractFileSystem.hdfs.impl", TestingFs.class.getName()) .put("path", "foo") diff --git a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java index 793e442e119..743e2645ab2 100644 --- a/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java +++ b/plugins/repository-s3/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java @@ -84,7 +84,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch-cloud-aws/issues/211") public void testSimpleWorkflow() { Client client = client(); - Settings.Builder settings = Settings.settingsBuilder() + Settings.Builder settings = Settings.builder() .put(S3Repository.Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000)); // We sometime test getting the base_path from node settings using repositories.s3.base_path @@ -164,7 +164,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase Client client = client(); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", internalCluster().getInstance(Settings.class).get("repositories.s3.bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) .put(S3Repository.Repository.CHUNK_SIZE_SETTING.getKey(), randomIntBetween(1000, 10000)) .put(S3Repository.Repository.SERVER_SIDE_ENCRYPTION_SETTING.getKey(), true) @@ -259,7 +259,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); try { client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) .put(S3Repository.Repository.BUCKET_SETTING.getKey(), bucketSettings.get("bucket")) ).get(); @@ -271,7 +271,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase public void testRepositoryWithBasePath() { Client client = client(); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -284,7 +284,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.private-bucket."); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) .put(S3Repository.Repository.REGION_SETTING.getKey(), bucketSettings.get("region")) .put(S3Repository.Repository.KEY_SETTING.getKey(), bucketSettings.get("access_key")) @@ -302,7 +302,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.external-bucket."); logger.info("--> creating s3 repostoriy with endpoint [{}], bucket[{}] and path [{}]", bucketSettings.get("endpoint"), bucketSettings.get("bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BUCKET_SETTING.getKey(), bucketSettings.get("bucket")) .put(S3Repository.Repository.ENDPOINT_SETTING.getKey(), bucketSettings.get("endpoint")) .put(S3Repository.Repository.KEY_SETTING.getKey(), bucketSettings.get("access_key")) @@ -323,7 +323,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); try { client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) .put(S3Repository.Repository.BUCKET_SETTING.getKey(), bucketSettings.get("bucket")) // Below setting intentionally omitted to assert bucket is not available in default region. @@ -341,7 +341,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase Settings bucketSettings = settings.getByPrefix("repositories.s3.remote-bucket."); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) .put(S3Repository.Repository.BUCKET_SETTING.getKey(), bucketSettings.get("bucket")) .put(S3Repository.Repository.REGION_SETTING.getKey(), bucketSettings.get("region")) @@ -358,7 +358,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase Client client = client(); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", internalCluster().getInstance(Settings.class).get("repositories.s3.bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -379,7 +379,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTestCase ClusterAdminClient client = client().admin().cluster(); logger.info("--> creating s3 repository without any path"); PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo") - .setType("s3").setSettings(Settings.settingsBuilder() + .setType("s3").setSettings(Settings.builder() .put(S3Repository.Repository.BASE_PATH_SETTING.getKey(), basePath) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESBackcompatTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESBackcompatTestCase.java index d37f118d373..69bacfd3ffa 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESBackcompatTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESBackcompatTestCase.java @@ -195,7 +195,7 @@ public abstract class ESBackcompatTestCase extends ESIntegTestCase { private Settings addLoggerSettings(Settings externalNodesSettings) { TestLogging logging = getClass().getAnnotation(TestLogging.class); Map loggingLevels = LoggingListener.getLoggersAndLevelsFromAnnotation(logging); - Settings.Builder finalSettings = Settings.settingsBuilder(); + Settings.Builder finalSettings = Settings.builder(); if (loggingLevels != null) { for (Map.Entry level : loggingLevels.entrySet()) { finalSettings.put("logger." + level.getKey(), level.getValue()); diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java index b626d7ed260..06288d6cdc8 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java @@ -166,7 +166,6 @@ import java.util.function.Function; import static org.elasticsearch.client.Requests.syncedFlushRequest; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.util.CollectionUtils.eagerPartition; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.XContentTestUtils.convertToMap; @@ -987,7 +986,7 @@ public abstract class ESIntegTestCase extends ESTestCase { */ public void setMinimumMasterNodes(int n) { assertTrue(client().admin().cluster().prepareUpdateSettings().setTransientSettings( - settingsBuilder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), n)) + Settings.builder().put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), n)) .get().isAcknowledged()); } @@ -1407,7 +1406,7 @@ public abstract class ESIntegTestCase extends ESTestCase { /** Sets or unsets the cluster read_only mode **/ public static void setClusterReadOnly(boolean value) { - Settings settings = settingsBuilder().put(MetaData.SETTING_READ_ONLY_SETTING.getKey(), value).build(); + Settings settings = Settings.builder().put(MetaData.SETTING_READ_ONLY_SETTING.getKey(), value).build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings).get()); } @@ -1617,7 +1616,7 @@ public abstract class ESIntegTestCase extends ESTestCase { * In other words subclasses must ensure this method is idempotent. */ protected Settings nodeSettings(int nodeOrdinal) { - Settings.Builder builder = settingsBuilder() + Settings.Builder builder = Settings.builder() // Default the watermarks to absurdly low to prevent the tests // from failing on nodes without enough disk space .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "1b") diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java index e674c998edf..10616415693 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java @@ -88,7 +88,6 @@ import java.util.function.BooleanSupplier; import java.util.function.Consumer; import java.util.function.Supplier; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.util.CollectionUtils.arrayAsArrayList; import static org.hamcrest.Matchers.equalTo; @@ -730,7 +729,7 @@ public abstract class ESTestCase extends LuceneTestCase { */ @SafeVarargs public static AnalysisService createAnalysisService(Index index, Settings nodeSettings, Settings settings, Consumer... moduleConsumers) throws IOException { - Settings indexSettings = settingsBuilder().put(settings) + Settings indexSettings = Settings.builder().put(settings) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .build(); Environment env = new Environment(nodeSettings); diff --git a/test/framework/src/main/java/org/elasticsearch/test/ExternalNode.java b/test/framework/src/main/java/org/elasticsearch/test/ExternalNode.java index 41bd1a301aa..296f34637dd 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ExternalNode.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ExternalNode.java @@ -45,8 +45,6 @@ import java.util.Map; import java.util.Random; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; - /** * Simple helper class to start external nodes to be used within a test cluster */ @@ -192,7 +190,7 @@ final class ExternalNode implements Closeable { TransportAddress addr = nodeInfo.getTransport().getAddress().publishAddress(); // verify that the end node setting will have network enabled. - Settings clientSettings = settingsBuilder().put(externalNodeSettings) + Settings clientSettings = Settings.builder().put(externalNodeSettings) .put("client.transport.nodes_sampler_interval", "1s") .put("node.name", "transport_client_" + nodeInfo.getNode().getName()) .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), clusterName).put("client.transport.sniff", false).build(); diff --git a/test/framework/src/main/java/org/elasticsearch/test/ExternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/ExternalTestCluster.java index 45c0a8aabc3..17c3e3d0805 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ExternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ExternalTestCluster.java @@ -70,7 +70,7 @@ public final class ExternalTestCluster extends TestCluster { public ExternalTestCluster(Path tempDir, Settings additionalSettings, Collection> pluginClasses, TransportAddress... transportAddresses) { super(0); - Settings clientSettings = Settings.settingsBuilder() + Settings clientSettings = Settings.builder() .put(additionalSettings) .put("node.name", InternalTestCluster.TRANSPORT_CLIENT_PREFIX + EXTERNAL_CLUSTER_PREFIX + counter.getAndIncrement()) .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING.getKey(), true) // prevents any settings to be replaced by system properties. diff --git a/test/framework/src/main/java/org/elasticsearch/test/IndexSettingsModule.java b/test/framework/src/main/java/org/elasticsearch/test/IndexSettingsModule.java index a7c0d7af01a..f14d17abc73 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/IndexSettingsModule.java +++ b/test/framework/src/main/java/org/elasticsearch/test/IndexSettingsModule.java @@ -53,7 +53,7 @@ public class IndexSettingsModule extends AbstractModule { } public static IndexSettings newIndexSettings(Index index, Settings settings, Setting... setting) { - Settings build = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) + Settings build = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(settings) diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java index cdd5befe6b2..fe32a89c4b5 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java @@ -124,7 +124,6 @@ import java.util.stream.Stream; import static org.apache.lucene.util.LuceneTestCase.TEST_NIGHTLY; import static org.apache.lucene.util.LuceneTestCase.rarely; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ESTestCase.assertBusy; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout; import static org.hamcrest.Matchers.equalTo; @@ -275,7 +274,7 @@ public final class InternalTestCluster extends TestCluster { logger.info("Setup InternalTestCluster [{}] with seed [{}] using [{}] data nodes and [{}] client nodes", clusterName, SeedUtils.formatSeed(clusterSeed), numSharedAllRolesNodes, numShareCoordOnlyNodes); this.nodeConfigurationSource = nodeConfigurationSource; - Builder builder = Settings.settingsBuilder(); + Builder builder = Settings.builder(); if (random.nextInt(5) == 0) { // sometimes set this // randomize (multi/single) data path, special case for 0, don't set it at all... final int numOfDataPaths = random.nextInt(5); @@ -350,7 +349,7 @@ public final class InternalTestCluster extends TestCluster { } private Settings getSettings(int nodeOrdinal, long nodeSeed, Settings others) { - Builder builder = Settings.settingsBuilder().put(defaultSettings) + Builder builder = Settings.builder().put(defaultSettings) .put(getRandomNodeSettings(nodeSeed)); Settings settings = nodeConfigurationSource.nodeSettings(nodeOrdinal); if (settings != null) { @@ -378,7 +377,7 @@ public final class InternalTestCluster extends TestCluster { private Settings getRandomNodeSettings(long seed) { Random random = new Random(seed); - Builder builder = Settings.settingsBuilder(); + Builder builder = Settings.builder(); if (isLocalTransportConfigured() == false) { builder.put(Transport.TRANSPORT_TCP_COMPRESS.getKey(), rarely(random)); } @@ -575,7 +574,7 @@ public final class InternalTestCluster extends TestCluster { Collection> plugins = getPlugins(); String name = buildNodeName(nodeId); assert !nodes.containsKey(name); - Settings finalSettings = settingsBuilder() + Settings finalSettings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), baseDir) // allow overriding path.home .put(settings) .put("node.name", name) @@ -657,7 +656,7 @@ public final class InternalTestCluster extends TestCluster { public synchronized Client startCoordinatingOnlyNode(Settings settings) { ensureOpen(); // currently unused - Builder builder = settingsBuilder().put(settings).put(Node.NODE_MASTER_SETTING.getKey(), false) + Builder builder = Settings.builder().put(settings).put(Node.NODE_MASTER_SETTING.getKey(), false) .put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_INGEST_SETTING.getKey(), false); if (size() == 0) { // if we are the first node - don't wait for a state @@ -871,7 +870,7 @@ public final class InternalTestCluster extends TestCluster { public Client client(Node node, String clusterName) { TransportAddress addr = node.injector().getInstance(TransportService.class).boundAddress().publishAddress(); Settings nodeSettings = node.settings(); - Builder builder = settingsBuilder() + Builder builder = Settings.builder() .put("client.transport.nodes_sampler_interval", "1s") .put(Environment.PATH_HOME_SETTING.getKey(), baseDir) .put("node.name", TRANSPORT_CLIENT_PREFIX + node.settings().get("node.name")) diff --git a/test/framework/src/main/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java b/test/framework/src/main/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java index e6fd05e94ce..7c832118ca0 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java +++ b/test/framework/src/main/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java @@ -37,7 +37,7 @@ import java.util.Set; public class ClusterDiscoveryConfiguration extends NodeConfigurationSource { - static Settings DEFAULT_NODE_SETTINGS = Settings.settingsBuilder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), "zen").build(); + static Settings DEFAULT_NODE_SETTINGS = Settings.builder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), "zen").build(); private static final String IP_ADDR = "127.0.0.1"; final int numOfNodes;