From 2b57dd7d3e535a8c760478259efbb8bf01294d80 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Mon, 25 May 2015 13:14:01 -0400 Subject: [PATCH] Absorb ImmutableSettings into Settings Now we have a single (final) Settings implementation. Closes #11321 --- .../action/TransportActionNodeProxy.java | 1 - .../admin/cluster/node/info/NodeInfo.java | 5 +- .../cluster/node/info/NodesInfoResponse.java | 1 - .../node/info/TransportNodesInfoAction.java | 1 - .../liveness/TransportLivenessAction.java | 1 - .../node/stats/TransportNodesStatsAction.java | 1 - .../TransportDeleteRepositoryAction.java | 1 - .../get/GetRepositoriesResponse.java | 6 +- .../get/TransportGetRepositoriesAction.java | 1 - .../put/PutRepositoryRequest.java | 9 +- .../put/PutRepositoryRequestBuilder.java | 1 - .../put/TransportPutRepositoryAction.java | 1 - .../TransportVerifyRepositoryAction.java | 1 - .../TransportClusterRerouteAction.java | 1 - .../ClusterUpdateSettingsRequest.java | 11 +- .../ClusterUpdateSettingsResponse.java | 13 +- .../TransportClusterUpdateSettingsAction.java | 9 +- .../TransportClusterSearchShardsAction.java | 1 - .../create/CreateSnapshotRequest.java | 9 +- .../create/CreateSnapshotRequestBuilder.java | 1 - .../create/TransportCreateSnapshotAction.java | 1 - .../delete/TransportDeleteSnapshotAction.java | 1 - .../get/TransportGetSnapshotsAction.java | 1 - .../restore/RestoreSnapshotRequest.java | 11 +- .../TransportRestoreSnapshotAction.java | 1 - .../state/TransportClusterStateAction.java | 1 - .../stats/TransportClusterStatsAction.java | 1 - .../TransportPendingClusterTasksAction.java | 2 - .../alias/TransportIndicesAliasesAction.java | 1 - .../exists/TransportAliasesExistAction.java | 1 - .../alias/get/TransportGetAliasesAction.java | 1 - .../analyze/TransportAnalyzeAction.java | 3 +- .../TransportClearIndicesCacheAction.java | 2 - .../close/TransportCloseIndexAction.java | 1 - .../CreateIndexClusterStateUpdateRequest.java | 3 +- .../indices/create/CreateIndexRequest.java | 11 +- .../create/TransportCreateIndexAction.java | 1 - .../delete/TransportDeleteIndexAction.java | 1 - .../indices/TransportIndicesExistsAction.java | 1 - .../types/TransportTypesExistsAction.java | 1 - .../indices/flush/TransportFlushAction.java | 1 - .../admin/indices/get/GetIndexResponse.java | 5 +- .../indices/get/TransportGetIndexAction.java | 1 - .../get/TransportGetFieldMappingsAction.java | 2 - .../get/TransportGetMappingsAction.java | 1 - .../put/TransportPutMappingAction.java | 1 - .../open/TransportOpenIndexAction.java | 1 - .../optimize/TransportOptimizeAction.java | 1 - .../recovery/TransportRecoveryAction.java | 1 - .../refresh/TransportRefreshAction.java | 1 - .../seal/TransportSealIndicesAction.java | 6 - .../TransportIndicesSegmentsAction.java | 1 - .../settings/get/GetSettingsResponse.java | 5 +- .../get/TransportGetSettingsAction.java | 5 +- .../put/TransportUpdateSettingsAction.java | 1 - .../settings/put/UpdateSettingsRequest.java | 9 +- .../put/UpdateSettingsRequestBuilder.java | 1 - .../stats/TransportIndicesStatsAction.java | 1 - .../TransportDeleteIndexTemplateAction.java | 1 - .../get/TransportGetIndexTemplatesAction.java | 1 - .../template/put/PutIndexTemplateRequest.java | 9 +- .../put/PutIndexTemplateRequestBuilder.java | 1 - .../put/TransportPutIndexTemplateAction.java | 1 - .../query/TransportValidateQueryAction.java | 1 - .../delete/TransportDeleteWarmerAction.java | 1 - .../warmer/get/TransportGetWarmersAction.java | 1 - .../action/bulk/TransportBulkAction.java | 1 - .../action/count/TransportCountAction.java | 1 - .../action/delete/TransportDeleteAction.java | 4 - .../action/exists/TransportExistsAction.java | 1 - .../TransportFieldStatsTransportAction.java | 2 - .../action/get/TransportGetAction.java | 1 - .../action/index/TransportIndexAction.java | 3 - .../support/ThreadedActionListener.java | 1 - .../TransportBroadcastOperationAction.java | 1 - .../TransportMasterNodeOperationAction.java | 3 - .../info/TransportClusterInfoAction.java | 1 - .../nodes/TransportNodesOperationAction.java | 1 - ...nsportShardReplicationOperationAction.java | 4 - .../TransportSingleCustomOperationAction.java | 1 - ...ransportInstanceSingleOperationAction.java | 2 - .../TransportTermVectorsAction.java | 1 - .../dfs/TransportDfsOnlyAction.java | 1 - .../action/update/TransportUpdateAction.java | 1 - .../elasticsearch/bootstrap/Bootstrap.java | 3 +- .../elasticsearch/client/node/NodeClient.java | 9 - .../elasticsearch/client/support/Headers.java | 5 +- .../client/transport/TransportClient.java | 6 +- .../cluster/EmptyClusterInfoService.java | 4 +- .../action/index/NodeIndexDeletedAction.java | 2 - .../index/NodeMappingRefreshAction.java | 1 - .../action/shard/ShardStateAction.java | 1 - .../cluster/metadata/IndexMetaData.java | 13 +- .../metadata/IndexTemplateMetaData.java | 9 +- .../cluster/metadata/MetaData.java | 19 +- .../metadata/MetaDataCreateIndexService.java | 9 +- .../MetaDataIndexTemplateService.java | 6 +- .../metadata/MetaDataIndexUpgradeService.java | 3 +- .../MetaDataUpdateSettingsService.java | 5 +- .../metadata/RepositoriesMetaData.java | 5 +- .../cluster/metadata/RepositoryMetaData.java | 5 +- .../cluster/routing/RoutingService.java | 1 - .../routing/allocation/AllocationService.java | 1 - .../allocator/ShardsAllocators.java | 3 +- .../decider/AwarenessAllocationDecider.java | 3 +- .../SnapshotInProgressAllocationDecider.java | 3 +- .../common/blobstore/fs/FsBlobStore.java | 3 - .../common/blobstore/url/URLBlobStore.java | 2 - .../org/elasticsearch/common/cli/CliTool.java | 2 +- .../component/AbstractLifecycleComponent.java | 1 - .../common/compress/lzf/LZFCompressor.java | 3 - .../elasticsearch/common/logging/Loggers.java | 2 +- .../common/logging/log4j/LogConfigurator.java | 10 +- .../common/network/MulticastChannel.java | 4 +- .../common/settings/ImmutableSettings.java | 1148 ---------------- .../common/settings/Settings.java | 1161 +++++++++++++++-- .../common/settings/SettingsFilter.java | 2 +- .../elasticsearch/common/util/BigArrays.java | 3 - .../discovery/DiscoveryService.java | 2 - .../zen/membership/MembershipAction.java | 3 - .../discovery/zen/ping/ZenPingService.java | 1 - .../zen/ping/multicast/MulticastZenPing.java | 3 +- .../publish/PublishClusterStateAction.java | 2 - .../elasticsearch/env/NodeEnvironment.java | 17 +- .../elasticsearch/gateway/GatewayService.java | 1 - .../http/netty/NettyHttpServerTransport.java | 1 - .../org/elasticsearch/index/IndexService.java | 1 - .../index/aliases/IndexAliasesService.java | 2 - .../index/analysis/AnalysisModule.java | 2 +- .../index/analysis/AnalysisService.java | 9 +- .../analysis/ClassicTokenizerFactory.java | 2 - .../analysis/EdgeNGramTokenFilterFactory.java | 1 - .../FrenchStemTokenFilterFactory.java | 2 +- .../PreBuiltAnalyzerProviderFactory.java | 1 - .../PreBuiltCharFilterFactoryFactory.java | 1 - .../PreBuiltTokenFilterFactoryFactory.java | 1 - .../PreBuiltTokenizerFactoryFactory.java | 1 - .../analysis/StandardAnalyzerProvider.java | 1 - .../StandardHtmlStripAnalyzerProvider.java | 1 - .../analysis/StemmerTokenFilterFactory.java | 1 - .../analysis/SynonymTokenFilterFactory.java | 3 +- .../WordDelimiterTokenFilterFactory.java | 1 - .../index/cache/bitset/BitsetFilterCache.java | 1 - .../index/codec/CodecService.java | 3 +- .../KeepLastNDeletionPolicy.java | 2 - .../index/fielddata/FieldDataType.java | 3 +- .../index/fielddata/ShardFieldData.java | 1 - .../fielddata/plain/IndexIndexFieldData.java | 3 +- .../plain/PackedArrayIndexFieldData.java | 1 - .../index/gateway/IndexShardGateway.java | 1 - .../index/mapper/DocumentMapper.java | 1 - .../index/mapper/DocumentParser.java | 2 - .../mapper/core/AbstractFieldMapper.java | 5 +- .../index/mapper/core/BooleanFieldMapper.java | 1 - .../index/mapper/core/DateFieldMapper.java | 2 - .../index/mapper/core/DoubleFieldMapper.java | 2 +- .../index/mapper/core/FloatFieldMapper.java | 2 +- .../index/mapper/core/LongFieldMapper.java | 2 +- .../index/mapper/core/ShortFieldMapper.java | 2 +- .../index/mapper/core/TypeParsers.java | 3 +- .../mapper/internal/ParentFieldMapper.java | 4 +- .../index/mapper/ip/IpFieldMapper.java | 2 +- .../policy/TieredMergePolicyProvider.java | 1 - .../scheduler/MergeSchedulerProvider.java | 1 - .../index/query/IndexQueryParserService.java | 3 +- .../index/query/QueryParseContext.java | 4 +- .../index/settings/IndexSettingsService.java | 3 +- .../elasticsearch/index/shard/IndexShard.java | 1 - .../similarity/DefaultSimilarityProvider.java | 2 - .../similarity/SimilarityLookupService.java | 3 +- .../index/similarity/SimilarityProvider.java | 2 - .../index/similarity/SimilarityService.java | 3 +- .../elasticsearch/index/store/IndexStore.java | 2 - .../index/store/StoreModule.java | 1 - .../index/translog/TranslogService.java | 3 - .../indices/IndicesLifecycle.java | 2 +- .../elasticsearch/indices/IndicesService.java | 5 +- .../elasticsearch/indices/IndicesWarmer.java | 1 - .../indices/SyncedFlushService.java | 5 - .../indices/analysis/HunspellService.java | 7 +- .../analysis/IndicesAnalysisService.java | 2 +- .../breaker/CircuitBreakerService.java | 1 - .../breaker/NoneCircuitBreakerService.java | 4 +- .../cluster/IndicesClusterStateService.java | 1 - .../indices/recovery/RecoveryTarget.java | 3 - .../indices/store/IndicesStore.java | 4 +- .../TransportNodesListShardStoreMetaData.java | 6 - .../indices/ttl/IndicesTTLService.java | 3 - .../elasticsearch/monitor/MonitorModule.java | 5 - .../elasticsearch/monitor/MonitorService.java | 1 - .../elasticsearch/monitor/fs/FsService.java | 1 - .../elasticsearch/monitor/fs/JmxFsProbe.java | 4 - .../monitor/fs/SigarFsProbe.java | 2 - .../monitor/jvm/JvmMonitorService.java | 1 - .../java/org/elasticsearch/node/Node.java | 5 +- .../org/elasticsearch/node/NodeBuilder.java | 9 +- .../internal/InternalSettingsPreparer.java | 5 +- .../node/settings/NodeSettingsService.java | 3 +- .../elasticsearch/plugins/AbstractPlugin.java | 3 +- .../elasticsearch/plugins/PluginManager.java | 2 +- .../elasticsearch/plugins/PluginsService.java | 3 +- .../repositories/RepositoriesService.java | 2 +- .../repositories/RepositoryModule.java | 4 - .../elasticsearch/rest/BaseRestHandler.java | 1 - .../elasticsearch/rest/RestController.java | 1 - .../verify/RestVerifyRepositoryAction.java | 5 - .../settings/RestUpdateSettingsAction.java | 5 +- .../indices/upgrade/RestUpgradeAction.java | 1 - .../rest/action/cat/RestAllocationAction.java | 1 - .../rest/action/main/RestMainAction.java | 1 - .../org/elasticsearch/river/RiverModule.java | 2 +- .../elasticsearch/river/RiversManager.java | 1 - .../elasticsearch/river/RiversService.java | 1 - .../river/cluster/RiverClusterService.java | 1 - .../river/routing/RiversRouter.java | 1 - .../snapshots/RestoreService.java | 11 +- .../snapshots/SnapshotsService.java | 1 - .../elasticsearch/threadpool/ThreadPool.java | 12 +- .../threadpool/ThreadPoolModule.java | 1 - .../transport/TransportService.java | 2 +- .../transport/netty/NettyTransport.java | 7 +- .../org/elasticsearch/tribe/TribeService.java | 11 +- .../watcher/ResourceWatcherService.java | 1 - .../java/org/elasticsearch/VersionTests.java | 6 +- .../action/IndicesRequestTests.java | 5 +- .../action/RejectionActionTests.java | 3 +- .../repositories/RepositoryBlocksTests.java | 12 +- .../snapshots/SnapshotBlocksTests.java | 4 +- .../cluster/stats/ClusterStatsTests.java | 10 +- .../indices/create/CreateIndexTests.java | 16 +- .../admin/indices/get/GetIndexTests.java | 3 +- .../segments/IndicesSegmentsRequestTests.java | 5 +- .../BulkProcessorClusterSettingsTests.java | 3 +- .../action/bulk/BulkProcessorTests.java | 5 +- .../count/CountRequestBuilderTests.java | 3 +- .../search/SearchRequestBuilderTests.java | 3 +- .../TransportActionFilterChainTests.java | 10 +- .../ShardReplicationOperationTests.java | 17 +- .../termvectors/AbstractTermVectorsTests.java | 4 +- .../GetTermVectorsCheckDocFreqTests.java | 4 +- .../termvectors/GetTermVectorsTests.java | 22 +- .../termvectors/MultiTermVectorsTests.java | 4 +- .../aliases/IndexAliasesTests.java | 2 +- .../benchmark/aliases/AliasesBenchmark.java | 5 +- .../breaker/CircuitBreakerBenchmark.java | 6 +- .../ClusterAllocationRerouteBenchmark.java | 4 +- .../mapping/ManyMappingsBenchmark.java | 3 +- .../percolator/PercolatorStressBenchmark.java | 2 +- .../recovery/ReplicaRecoveryBenchmark.java | 2 +- .../expression/ScriptComparisonBenchmark.java | 2 +- .../scripts/score/BasicScriptBenchmark.java | 6 +- .../score/ScriptsConstantScoreBenchmark.java | 2 +- .../scripts/score/ScriptsScoreBenchmark.java | 2 +- .../ScriptsScorePayloadSumBenchmark.java | 2 +- .../search/SuggestSearchBenchMark.java | 2 +- ...CardinalityAggregationSearchBenchmark.java | 3 +- .../aggregations/GlobalOrdinalsBenchmark.java | 6 +- .../HistogramAggregationSearchBenchmark.java | 2 +- ...ludeExcludeAggregationSearchBenchmark.java | 2 +- ...PercentilesAggregationSearchBenchmark.java | 5 +- ...QueryFilterAggregationSearchBenchmark.java | 3 +- ...AggregationSearchCollectModeBenchmark.java | 3 +- ...AggregationSearchAndIndexingBenchmark.java | 3 +- .../TermsAggregationSearchBenchmark.java | 2 +- ...TimeDataHistogramAggregationBenchmark.java | 3 +- .../ChildSearchAndIndexingBenchmark.java | 2 +- .../search/child/ChildSearchBenchmark.java | 2 +- .../ChildSearchShortCircuitBenchmark.java | 2 +- .../geo/GeoDistanceSearchBenchmark.java | 5 +- .../search/nested/NestedSearchBenchMark.java | 2 +- .../search/scroll/ScrollSearchBenchmark.java | 2 +- .../benchmark/stress/NodesStressTest.java | 4 +- .../stress/SingleThreadBulkStress.java | 2 +- .../stress/SingleThreadIndexingStress.java | 2 +- .../BenchmarkNettyLargeMessages.java | 3 +- .../transport/TransportBenchmark.java | 5 +- .../blocks/SimpleBlocksTests.java | 4 +- .../bootstrap/SecurityTests.java | 5 +- .../BasicBackwardsCompatibilityTest.java | 19 +- .../ClusterStateBackwardsCompatTests.java | 3 +- .../GetIndexBackwardsCompatibilityTests.java | 3 +- .../NodesStatsBasicBackwardsCompatTests.java | 5 +- .../OldIndexBackwardsCompatibilityTests.java | 13 +- .../RecoveryWithUnsupportedIndicesTests.java | 1 - .../bwcompat/RestoreBackwardsCompatTests.java | 3 +- .../StaticIndexBackwardCompatibilityTest.java | 2 - ...sportClientBackwardsCompatibilityTest.java | 3 +- .../UnicastBackwardsCompatibilityTest.java | 5 +- .../client/AbstractClientHeadersTests.java | 5 +- .../client/node/NodeClientHeadersTests.java | 2 - .../client/node/NodeClientTests.java | 2 +- .../TransportClientHeadersTests.java | 5 +- .../TransportClientNodesServiceTests.java | 6 +- .../transport/TransportClientRetryTests.java | 5 +- .../transport/TransportClientTests.java | 7 +- .../cluster/ClusterInfoServiceTests.java | 9 +- .../cluster/ClusterServiceTests.java | 7 +- .../ClusterStateDiffPublishingTests.java | 27 +- .../cluster/ClusterStateDiffTests.java | 13 +- .../cluster/MinimumMasterNodesTests.java | 5 +- .../cluster/NoMasterNodeTests.java | 2 +- .../cluster/SimpleDataNodesTests.java | 2 +- .../cluster/SpecificMasterNodesTests.java | 6 +- .../UpdateSettingsValidationTests.java | 2 +- .../ack/AckClusterUpdateSettingsTests.java | 7 +- .../elasticsearch/cluster/ack/AckTests.java | 11 +- .../allocation/AwarenessAllocationTests.java | 29 +- .../allocation/ClusterRerouteTests.java | 2 +- .../allocation/FilteringAllocationTests.java | 2 +- .../ShardsAllocatorModuleTests.java | 5 +- .../allocation/SimpleAllocationTests.java | 2 +- .../metadata/ToAndFromJsonMetaDataTests.java | 2 +- .../node/DiscoveryNodeFiltersTests.java | 11 +- .../RoutingBackwardCompatibilityTests.java | 3 +- ...BackwardCompatibilityUponUpgradeTests.java | 3 +- .../cluster/routing/RoutingTableTest.java | 5 +- .../allocation/AddIncrementallyTests.java | 10 +- .../allocation/AllocatePostApiFlagTests.java | 2 +- .../allocation/AllocationCommandsTests.java | 2 +- .../allocation/AwarenessAllocationTests.java | 2 +- .../allocation/BalanceConfigurationTests.java | 14 +- .../BalanceUnbalancedClusterTest.java | 2 +- .../allocation/CatAllocationTestBase.java | 2 +- .../ClusterRebalanceRoutingTests.java | 2 +- .../ConcurrentRebalanceRoutingTests.java | 2 +- .../allocation/DeadNodesAllocationTests.java | 2 +- .../allocation/DisableAllocationTests.java | 2 +- ...ReplicaAsPrimaryDuringRelocationTests.java | 2 +- .../allocation/FailedNodeRoutingTests.java | 2 +- .../allocation/FailedShardsRoutingTests.java | 2 +- .../allocation/FilterRoutingTests.java | 2 +- .../routing/allocation/IndexBalanceTests.java | 2 +- .../NodeVersionAllocationDeciderTests.java | 2 +- ...alPrimariesToRelocatingPrimariesTests.java | 2 +- .../PreferPrimaryAllocationTests.java | 2 +- .../PrimaryElectionRoutingTests.java | 2 +- ...yNotRelocatedWhileBeingRecoveredTests.java | 2 +- .../RandomAllocationDeciderTests.java | 10 +- .../allocation/RebalanceAfterActiveTests.java | 2 +- .../ReplicaAllocatedAfterPrimaryTests.java | 2 +- .../RoutingNodesIntegrityTests.java | 2 +- .../allocation/SameShardRoutingTests.java | 3 +- .../allocation/ShardVersioningTests.java | 2 +- .../ShardsLimitAllocationTests.java | 2 +- .../SingleShardNoReplicasRoutingTests.java | 2 +- .../SingleShardOneReplicaRoutingTests.java | 2 +- .../TenShardsOneReplicaRoutingTests.java | 2 +- .../allocation/ThrottlingAllocationTests.java | 2 +- .../UpdateNumberOfReplicasTests.java | 2 +- .../decider/DiskThresholdDeciderTests.java | 47 +- .../DiskThresholdDeciderUnitTests.java | 7 +- ...nableAllocationDeciderIntegrationTest.java | 4 +- .../decider/EnableAllocationTests.java | 7 +- .../decider/MockDiskUsagesTests.java | 5 +- .../settings/ClusterSettingsTests.java | 27 +- .../settings/SettingsFilteringTests.java | 5 +- .../shards/ClusterSearchShardsTests.java | 2 +- .../structure/RoutingIteratorTests.java | 6 +- .../org/elasticsearch/codecs/CodecTests.java | 6 +- .../common/blobstore/BlobStoreTest.java | 3 +- .../breaker/MemoryCircuitBreakerTests.java | 6 +- .../common/bytes/PagedBytesReferenceTest.java | 2 - .../common/cli/CheckFileCommandTests.java | 9 +- .../compress/CompressedStreamTests.java | 4 +- .../compress/CompressedStringTests.java | 6 +- .../logging/log4j/Log4jESLoggerTests.java | 6 +- .../log4j/LoggingConfigurationTests.java | 24 +- .../settings/ImmutableSettingsTests.java | 2 +- .../common/settings/SettingsFilterTests.java | 22 +- .../loader/JsonSettingsLoaderTests.java | 2 +- .../loader/YamlSettingsLoaderTests.java | 2 +- .../common/util/BigArraysTests.java | 10 +- .../WriteConsistencyLevelTests.java | 4 +- .../count/query/CountQueryTests.java | 5 +- .../DiscoveryWithServiceDisruptionsTests.java | 19 +- .../discovery/ZenFaultDetectionTests.java | 11 +- .../discovery/ZenUnicastDiscoveryTests.java | 4 +- .../discovery/zen/ElectMasterServiceTest.java | 4 +- .../discovery/zen/ZenDiscoveryTests.java | 19 +- .../ping/multicast/MulticastZenPingTests.java | 7 +- .../zen/ping/unicast/UnicastZenPingTests.java | 7 +- .../org/elasticsearch/document/BulkTests.java | 4 +- .../document/ShardInfoTests.java | 5 +- .../elasticsearch/env/EnvironmentTests.java | 7 +- .../env/NodeEnvironmentTests.java | 21 +- .../explain/ExplainActionTests.java | 4 +- .../fieldstats/FieldStatsTests.java | 14 +- .../gateway/DanglingIndicesStateTests.java | 16 +- .../gateway/GatewayIndexStateTests.java | 4 +- .../gateway/GatewayMetaStateTests.java | 2 +- .../gateway/GatewayServiceTests.java | 16 +- .../gateway/MetaDataWriteDataNodesTests.java | 24 +- .../gateway/MetaStateServiceTests.java | 11 +- .../gateway/QuorumGatewayTests.java | 6 +- .../gateway/RecoverAfterNodesTests.java | 3 +- .../RecoveryBackwardsCompatibilityTests.java | 11 +- .../gateway/RecoveryFromGatewayTests.java | 5 +- .../org/elasticsearch/get/GetActionTests.java | 22 +- .../http/netty/HttpPublishPortTests.java | 3 +- .../netty/NettyHttpServerPipeliningTest.java | 12 +- ...ettyPipeliningDisabledIntegrationTest.java | 2 +- ...NettyPipeliningEnabledIntegrationTest.java | 2 +- .../index/IndexWithShadowReplicasTests.java | 43 +- .../index/TransportIndexFailuresTest.java | 6 +- .../aliases/IndexAliasesServiceTests.java | 3 +- .../ASCIIFoldingTokenFilterFactoryTests.java | 2 +- .../index/analysis/AnalysisModuleTests.java | 8 +- .../index/analysis/AnalysisTests.java | 2 +- .../index/analysis/AnalysisTestsHelper.java | 5 +- .../AnalyzerBackwardsCompatTests.java | 4 +- .../index/analysis/CharFilterTests.java | 3 +- .../index/analysis/CompoundAnalysisTests.java | 2 +- .../HunspellTokenFilterFactoryTests.java | 2 +- .../analysis/KeepFilterFactoryTests.java | 7 +- .../analysis/KeepTypesFilterFactoryTests.java | 3 +- .../LimitTokenCountFilterFactoryTests.java | 9 +- .../analysis/NGramTokenizerFactoryTests.java | 2 +- .../PatternCaptureTokenFilterTests.java | 2 +- .../PreBuiltAnalyzerProviderFactoryTests.java | 6 +- .../index/analysis/PreBuiltAnalyzerTests.java | 3 +- ...PreBuiltCharFilterFactoryFactoryTests.java | 8 +- ...reBuiltTokenFilterFactoryFactoryTests.java | 14 +- .../PreBuiltTokenizerFactoryFactoryTests.java | 8 +- .../StemmerTokenFilterFactoryTests.java | 5 +- .../index/analysis/StopAnalyzerTests.java | 2 +- .../index/analysis/StopTokenFilterTests.java | 12 +- .../WordDelimiterTokenFilterFactoryTests.java | 2 +- .../CommonGramsTokenFilterFactoryTests.java | 25 +- .../filter1/MyFilterTokenFilterFactory.java | 3 +- .../synonyms/SynonymsAnalysisTest.java | 2 +- .../cache/bitset/BitSetFilterCacheTest.java | 4 +- .../elasticsearch/index/codec/CodecTests.java | 3 +- .../SnapshotDeletionPolicyTests.java | 2 +- .../engine/InternalEngineIntegrationTest.java | 8 +- .../engine/InternalEngineMergeTests.java | 5 +- .../engine/InternalEngineSettingsTest.java | 19 +- .../index/engine/InternalEngineTests.java | 21 +- .../index/engine/ShadowEngineTests.java | 9 +- .../fielddata/AbstractFieldDataTests.java | 4 +- .../AbstractNumericFieldDataTests.java | 6 +- .../AbstractStringFieldDataTests.java | 6 +- .../fielddata/BinaryDVFieldDataTests.java | 4 +- .../DisabledFieldDataFormatTests.java | 4 +- .../index/fielddata/DuelFieldDataTests.java | 74 +- .../FSTPackedBytesStringFieldDataTests.java | 4 +- .../index/fielddata/FilterFieldDataTest.java | 16 +- .../fielddata/IndexFieldDataServiceTests.java | 11 +- .../PagedBytesStringFieldDataTests.java | 4 +- .../SortedSetDVStringFieldDataTests.java | 4 +- .../ordinals/MultiOrdinalsTests.java | 6 +- .../ordinals/SingleOrdinalsTests.java | 8 +- .../index/mapper/DynamicMappingTests.java | 5 +- .../index/mapper/FieldMappersLookupTests.java | 3 +- .../mapper/all/SimpleAllMapperTests.java | 5 +- .../mapper/binary/BinaryMappingTests.java | 3 +- .../mapper/core/Murmur3FieldMapperTests.java | 6 +- .../mapper/date/SimpleDateMappingTests.java | 2 +- .../ExternalValuesMapperIntegrationTests.java | 3 +- .../index/mapper/id/IdMappingTests.java | 7 +- .../mapper/index/IndexTypeMapperTests.java | 4 +- .../internal/FieldNamesFieldMapperTests.java | 7 +- .../index/mapper/ip/SimpleIpMappingTests.java | 2 +- .../mapper/null_value/NullValueTests.java | 4 +- .../mapper/numeric/SimpleNumericTests.java | 2 +- .../mapper/parent/ParentMappingTests.java | 5 +- .../routing/RoutingTypeMapperTests.java | 10 +- .../mapper/simple/SimpleMapperTests.java | 1 - .../index/mapper/size/SizeMappingTests.java | 4 +- .../source/CompressSourceMappingTests.java | 3 +- .../source/DefaultSourceMappingTests.java | 6 +- .../string/SimpleStringMappingTests.java | 3 +- .../timestamp/TimestampMappingTests.java | 9 +- .../index/mapper/ttl/TTLMappingTests.java | 23 +- .../mapper/update/UpdateMappingTests.java | 18 +- .../merge/policy/MergePolicySettingsTest.java | 47 +- .../query/SimpleIndexQueryParserTests.java | 5 +- .../index/query/TemplateQueryParserTest.java | 4 +- .../index/query/TemplateQueryTest.java | 2 +- .../guice/IndexQueryParserModuleTests.java | 2 +- .../plugin/IndexQueryParserPlugin2Tests.java | 3 +- .../plugin/IndexQueryParserPluginTests.java | 3 +- .../search/nested/NestedSortingTests.java | 4 +- .../index/shard/IndexShardModuleTests.java | 5 +- .../index/shard/IndexShardTests.java | 12 +- .../index/shard/ShardPathTests.java | 9 +- .../index/similarity/SimilarityTests.java | 13 +- .../index/store/CorruptedFileTest.java | 32 +- .../index/store/CorruptedTranslogTests.java | 10 +- .../index/store/ExceptionRetryTests.java | 6 +- .../index/store/IndexStoreTests.java | 5 +- .../elasticsearch/index/store/StoreTest.java | 36 +- .../suggest/stats/SuggestStatsTests.java | 7 +- .../index/translog/BufferedTranslogTests.java | 3 +- .../index/translog/TranslogTests.java | 3 +- .../IndexLifecycleActionTests.java | 3 +- .../org/elasticsearch/indices/FlushTest.java | 8 +- .../indices/IndicesCustomDataPathTests.java | 10 +- .../IndicesLifecycleListenerTests.java | 7 +- .../IndicesOptionsIntegrationTests.java | 21 +- .../org/elasticsearch/indices/SealTests.java | 4 +- .../PreBuiltAnalyzerIntegrationTests.java | 3 +- .../indices/analyze/AnalyzeActionTests.java | 3 +- .../indices/analyze/HunspellServiceTests.java | 10 +- .../indices/leaks/IndicesLeaksTests.java | 4 +- .../DedicatedMasterGetFieldMappingTests.java | 5 +- .../UpdateMappingIntegrationTests.java | 5 +- .../memory/IndexingMemoryControllerTests.java | 7 +- .../breaker/CircuitBreakerNoopTests.java | 5 +- .../breaker/CircuitBreakerServiceTests.java | 2 +- .../breaker/CircuitBreakerUnitTests.java | 6 +- .../RandomExceptionCircuitBreakerTests.java | 5 +- .../indices/recovery/IndexRecoveryTests.java | 19 +- .../settings/GetSettingsBlocksTests.java | 4 +- .../settings/UpdateNumberOfReplicasTests.java | 6 +- .../indices/settings/UpdateSettingsTests.java | 25 +- .../state/CloseIndexDisableCloseAllTests.java | 3 +- .../indices/state/RareClusterStateTests.java | 16 +- .../indices/state/SimpleIndexStateTests.java | 8 +- .../indices/stats/IndexStatsTests.java | 15 +- .../store/IndicesStoreIntegrationTests.java | 23 +- .../template/IndexTemplateFilteringTests.java | 3 +- .../template/SimpleIndexTemplateTests.java | 4 +- .../warmer/GatewayIndicesWarmerTests.java | 6 +- .../warmer/SimpleIndicesWarmerTests.java | 15 +- .../elasticsearch/mget/SimpleMgetTests.java | 4 +- .../nested/SimpleNestedTests.java | 6 +- .../network/DirectBufferNetworkTests.java | 8 +- .../InternalSettingsPreparerTests.java | 2 +- .../nodesinfo/SimpleNodesInfoTests.java | 8 +- ...DestructiveOperationsIntegrationTests.java | 9 +- .../DetailedErrorsDisabledTest.java | 3 +- .../DetailedErrorsEnabledTest.java | 3 +- .../PercolatorFacetsAndAggregationsTests.java | 4 +- .../percolator/PercolatorTests.java | 10 +- .../percolator/RecoveryPercolatorTests.java | 3 +- .../percolator/TTLPercolatorTests.java | 2 +- .../PluggableTransportModuleTests.java | 2 +- .../plugins/PluginLuceneCheckerTests.java | 3 +- .../plugins/PluginManagerTests.java | 3 +- .../plugins/PluginManagerUnitTests.java | 2 +- .../plugins/PluginServiceTests.java | 4 +- .../elasticsearch/plugins/PluginTestCase.java | 5 +- .../plugins/ResponseHeaderPluginTests.java | 3 +- .../SitePluginRelativePathConfigTests.java | 2 +- .../plugins/SitePluginTests.java | 2 +- .../recovery/FullRollingRestartTests.java | 4 +- .../recovery/RecoveriesCollectionTests.java | 4 +- .../recovery/RecoverySettingsTest.java | 6 +- .../recovery/RecoveryWhileUnderLoadTests.java | 5 +- .../recovery/RelocationTests.java | 33 +- .../recovery/SimpleRecoveryTests.java | 5 +- .../SmallFileChunkSizeRecoveryTests.java | 3 +- .../SmallTranslogOpsRecoveryTests.java | 3 +- .../SmallTranslogSizeRecoveryTests.java | 3 +- .../recovery/TruncatedRecoveryTests.java | 5 +- .../rest/CorsRegexDefaultTests.java | 3 +- .../elasticsearch/rest/CorsRegexTests.java | 9 +- .../HeadersAndContextCopyClientTests.java | 5 +- .../rest/RestFilterChainTests.java | 6 +- .../admin/indices/upgrade/UpgradeTest.java | 13 +- .../rest/util/RestUtilsTests.java | 6 +- .../script/CustomScriptContextTests.java | 3 +- .../script/GroovySecurityTests.java | 3 +- .../script/IndexLookupTests.java | 6 +- .../script/IndexedScriptTests.java | 3 +- .../script/NativeScriptTests.java | 5 +- .../script/OnDiskScriptTests.java | 3 +- .../script/ScriptFieldTests.java | 2 +- .../script/ScriptModesTests.java | 24 +- .../script/ScriptServiceTests.java | 21 +- .../mustache/MustacheScriptEngineTest.java | 4 +- .../search/StressSearchServiceReaperTest.java | 4 +- .../aggregations/bucket/ChildrenTests.java | 4 +- .../bucket/DateHistogramOffsetTests.java | 3 +- .../bucket/DateHistogramTests.java | 4 +- .../aggregations/bucket/NestedTests.java | 6 +- .../bucket/ReverseNestedTests.java | 4 +- ...ignificantTermsSignificanceScoreTests.java | 5 +- .../bucket/SignificantTermsTests.java | 3 +- .../bucket/TermsDocCountErrorTests.java | 4 +- .../metrics/CardinalityTests.java | 3 +- .../aggregations/metrics/GeoBoundsTests.java | 4 +- .../metrics/ScriptedMetricTests.java | 3 +- .../basic/SearchWhileRelocatingTests.java | 2 +- .../SearchWithRandomExceptionsTests.java | 4 +- .../basic/TransportSearchFailuresTests.java | 2 +- .../basic/TransportTwoNodesSearchTests.java | 8 +- .../search/child/ParentFieldLoadingTest.java | 3 +- .../child/SimpleChildQuerySearchTests.java | 10 +- .../compress/SearchSourceCompressTests.java | 3 +- .../search/fields/SearchFieldsTests.java | 4 +- .../functionscore/ExplainableScriptTests.java | 6 +- ...nctionScoreBackwardCompatibilityTests.java | 7 +- .../FunctionScorePluginTests.java | 2 +- .../CustomHighlighterSearchTests.java | 2 +- .../highlight/HighlighterSearchTests.java | 6 +- .../morelikethis/MoreLikeThisTests.java | 4 +- .../preference/SearchPreferenceTests.java | 2 +- .../search/query/MultiMatchQueryTests.java | 2 +- .../search/query/SearchQueryTests.java | 9 +- .../search/rescore/QueryRescorerTests.java | 14 +- .../scriptfilter/ScriptQuerySearchTests.java | 3 +- .../search/scroll/SearchScrollTests.java | 14 +- .../SearchScrollWithFailingNodesTests.java | 4 +- .../search/sort/SortParserTests.java | 4 +- .../search/stats/SearchStatsTests.java | 6 +- .../suggest/CompletionSuggestSearchTests.java | 9 +- .../suggest/CustomSuggesterSearchTests.java | 3 +- .../search/suggest/SuggestSearchTests.java | 2 +- .../CompletionPostingsFormatTest.java | 3 +- .../search/timeout/SearchTimeoutTests.java | 3 +- .../similarity/SimilarityTests.java | 4 +- .../DedicatedClusterSnapshotRestoreTests.java | 31 +- .../snapshots/RepositoriesTests.java | 20 +- .../SharedClusterSnapshotRestoreTests.java | 113 +- .../SnapshotBackwardsCompatibilityTest.java | 21 +- .../snapshots/mockstore/MockRepository.java | 2 +- .../stresstest/client/ClientFailover.java | 1 - .../fullrestart/FullRestartStressTest.java | 5 +- .../gcbehavior/FilterCacheGcStress.java | 3 +- .../stresstest/get/GetStressTest.java | 3 +- .../indexing/BulkIndexingStressTest.java | 3 +- ...oncurrentIndexingVersioningStressTest.java | 3 +- .../stresstest/leaks/GenericStatsLeak.java | 4 +- .../ManyIndicesRemoteStressTest.java | 6 +- .../manyindices/ManyIndicesStressTest.java | 3 +- ...anyNodesManyIndicesRecoveryStressTest.java | 9 +- .../refresh/RefreshStressTest1.java | 6 +- .../QuickRollingRestartStressTest.java | 3 +- .../RollingRestartStressTest.java | 5 +- .../stresstest/search1/Search1StressTest.java | 3 +- .../test/CompositeTestCluster.java | 9 +- .../test/ElasticsearchAllocationTestCase.java | 5 +- ...csearchBackwardsCompatIntegrationTest.java | 7 +- .../test/ElasticsearchIntegrationTest.java | 43 +- .../test/ElasticsearchSingleNodeTest.java | 6 +- .../test/ElasticsearchTestCase.java | 11 +- .../ElasticsearchTokenStreamTestCase.java | 6 +- .../org/elasticsearch/test/ExternalNode.java | 10 +- .../test/ExternalTestCluster.java | 3 +- .../test/InternalTestCluster.java | 35 +- .../cache/recycler/MockPageCacheRecycler.java | 1 - .../ClusterDiscoveryConfiguration.java | 13 +- .../test/gateway/NoopGatewayAllocator.java | 4 +- .../test/rest/ElasticsearchRestTestCase.java | 5 +- .../test/store/MockFSDirectoryService.java | 4 +- .../test/store/MockFSIndexStore.java | 2 - .../test/test/InternalTestClusterTests.java | 1 - .../test/transport/MockTransportService.java | 1 - .../threadpool/SimpleThreadPoolTests.java | 7 +- .../ThreadPoolSerializationTests.java | 3 +- .../UpdateThreadPoolSettingsTests.java | 11 +- .../AbstractSimpleTransportTests.java | 7 +- .../ContextAndHeaderTransportTests.java | 2 +- .../NettySizeHeaderFrameDecoderTests.java | 2 +- .../local/SimpleLocalTransportTests.java | 3 +- .../netty/NettyScheduledPingTests.java | 3 +- ...ttyTransportMultiPortIntegrationTests.java | 2 +- .../netty/NettyTransportMultiPortTests.java | 2 +- .../transport/netty/NettyTransportTests.java | 2 +- .../netty/SimpleNettyTransportTests.java | 3 +- .../org/elasticsearch/tribe/TribeTests.java | 19 +- .../elasticsearch/tribe/TribeUnitTests.java | 13 +- .../org/elasticsearch/ttl/SimpleTTLTests.java | 3 +- .../update/UpdateByNativeScriptTests.java | 3 +- .../org/elasticsearch/update/UpdateTests.java | 4 +- .../validate/SimpleValidateQueryTests.java | 6 +- .../ConcurrentDocumentOperationTests.java | 2 +- .../versioning/SimpleVersioningTests.java | 7 +- .../watcher/ResourceWatcherServiceTests.java | 11 +- 670 files changed, 2614 insertions(+), 3433 deletions(-) delete mode 100644 src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java diff --git a/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java b/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java index dccf9b0fd57..2c66a5ef762 100644 --- a/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java +++ b/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java @@ -23,7 +23,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; /** diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java index 462f51ffc9b..66904933db4 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java @@ -27,7 +27,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.http.HttpInfo; import org.elasticsearch.monitor.jvm.JvmInfo; @@ -209,7 +208,7 @@ public class NodeInfo extends NodeOperationResponse { serviceAttributes = builder.build(); } if (in.readBoolean()) { - settings = ImmutableSettings.readSettingsFromStream(in); + settings = Settings.readSettingsFromStream(in); } if (in.readBoolean()) { os = OsInfo.readOsInfo(in); @@ -256,7 +255,7 @@ public class NodeInfo extends NodeOperationResponse { out.writeBoolean(false); } else { out.writeBoolean(true); - ImmutableSettings.writeSettingsToStream(settings, out); + Settings.writeSettingsToStream(settings, out); } if (os == null) { out.writeBoolean(false); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java index 2b16962b461..b7ce109484d 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java @@ -24,7 +24,6 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java index e091854ea59..29a904fa551 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.cluster.node.info; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.nodes.NodeOperationRequest; import org.elasticsearch.action.support.nodes.TransportNodesOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java index 1570378459e..2e223f94fe9 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java @@ -22,7 +22,6 @@ package org.elasticsearch.action.admin.cluster.node.liveness; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java index 31adc2d6e67..1f8dea37aae 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.action.admin.cluster.node.stats; import com.google.common.collect.Lists; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.nodes.NodeOperationRequest; import org.elasticsearch.action.support.nodes.TransportNodesOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java index 5ec0d68eb0c..c7b8f928e3f 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.cluster.repositories.delete; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java index 3cbe0446af7..3064487ddd5 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/GetRepositoriesResponse.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.ActionResponse; import org.elasticsearch.cluster.metadata.RepositoryMetaData; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import java.io.IOException; import java.util.Iterator; @@ -63,7 +63,7 @@ public class GetRepositoriesResponse extends ActionResponse implements Iterable< repositoryListBuilder.add(new RepositoryMetaData( in.readString(), in.readString(), - ImmutableSettings.readSettingsFromStream(in)) + Settings.readSettingsFromStream(in)) ); } repositories = repositoryListBuilder.build(); @@ -76,7 +76,7 @@ public class GetRepositoriesResponse extends ActionResponse implements Iterable< for (RepositoryMetaData repository : repositories) { out.writeString(repository.name()); out.writeString(repository.type()); - ImmutableSettings.writeSettingsToStream(repository.settings(), out); + Settings.writeSettingsToStream(repository.settings(), out); } } diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java index fda863eb271..c277df24e12 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.action.admin.cluster.repositories.get; import com.google.common.collect.ImmutableList; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeReadOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java index e0fdc30b3ad..0046037c87d 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java @@ -26,7 +26,6 @@ import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -36,9 +35,9 @@ import java.io.IOException; import java.util.Map; import static org.elasticsearch.action.ValidateActions.addValidationError; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; -import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream; -import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.readSettingsFromStream; +import static org.elasticsearch.common.settings.Settings.writeSettingsToStream; /** * Register repository request. @@ -150,7 +149,7 @@ public class PutRepositoryRequest extends AcknowledgedRequest listener) { - final ImmutableSettings.Builder transientUpdates = ImmutableSettings.settingsBuilder(); - final ImmutableSettings.Builder persistentUpdates = ImmutableSettings.settingsBuilder(); + final Settings.Builder transientUpdates = Settings.settingsBuilder(); + final Settings.Builder persistentUpdates = Settings.settingsBuilder(); clusterService.submitStateUpdateTask("cluster_update_settings", Priority.IMMEDIATE, new AckedClusterStateUpdateTask(request, listener) { @@ -178,7 +177,7 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeOpe @Override public ClusterState execute(final ClusterState currentState) { - ImmutableSettings.Builder transientSettings = ImmutableSettings.settingsBuilder(); + Settings.Builder transientSettings = Settings.settingsBuilder(); transientSettings.put(currentState.metaData().transientSettings()); for (Map.Entry entry : request.transientSettings().getAsMap().entrySet()) { if (dynamicSettings.isDynamicOrLoggingSetting(entry.getKey())) { @@ -195,7 +194,7 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeOpe } } - ImmutableSettings.Builder persistentSettings = ImmutableSettings.settingsBuilder(); + Settings.Builder persistentSettings = Settings.settingsBuilder(); persistentSettings.put(currentState.metaData().persistentSettings()); for (Map.Entry entry : request.persistentSettings().getAsMap().entrySet()) { if (dynamicSettings.isDynamicOrLoggingSetting(entry.getKey())) { diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java index bc83fecf647..1575f3c61a8 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.cluster.shards; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeReadOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java index 4cafbb2e52d..9e8c87bbbae 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -42,9 +41,9 @@ import java.util.Map; import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.common.Strings.EMPTY_ARRAY; import static org.elasticsearch.common.Strings.hasLength; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; -import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream; -import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.readSettingsFromStream; +import static org.elasticsearch.common.settings.Settings.writeSettingsToStream; import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue; /** @@ -301,7 +300,7 @@ public class CreateSnapshotRequest extends MasterNodeOperationRequest mappings = Maps.newHashMap(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java index 60a265de785..873e6e9e8ca 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java @@ -36,7 +36,6 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.*; @@ -46,9 +45,9 @@ import java.util.Set; import static com.google.common.collect.Maps.newHashMap; import static org.elasticsearch.action.ValidateActions.addValidationError; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; -import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream; -import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.readSettingsFromStream; +import static org.elasticsearch.common.settings.Settings.writeSettingsToStream; /** * A request to create an index. Best created with {@link org.elasticsearch.client.Requests#createIndexRequest(String)}. @@ -148,7 +147,7 @@ public class CreateIndexRequest extends AcknowledgedRequest * A simplified version of settings that takes key value pairs settings. */ public CreateIndexRequest settings(Object... settings) { - this.settings = ImmutableSettings.builder().put(settings).build(); + this.settings = Settings.builder().put(settings).build(); return this; } @@ -172,7 +171,7 @@ public class CreateIndexRequest extends AcknowledgedRequest * The settings to create the index with (either json/yaml/properties format) */ public CreateIndexRequest settings(String source) { - this.settings = ImmutableSettings.settingsBuilder().loadFromSource(source).build(); + this.settings = Settings.settingsBuilder().loadFromSource(source).build(); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java index 18bca510a6e..eca8894e43d 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.create; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java index 4fa760c7a9e..4c0de6d799b 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.delete; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DestructiveOperations; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java index 45572ef801d..0c360468e98 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.exists.indices; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.IndicesOptions; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java index ced21bd98e0..fb617f233d3 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.action.admin.indices.exists.types; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeReadOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java b/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java index 1d91fd6d800..c9f637e4371 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.flush; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DefaultShardOperationFailedException; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java b/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java index 7080a694a11..4acc790af75 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java @@ -28,7 +28,6 @@ import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.warmer.IndexWarmersMetaData; @@ -155,7 +154,7 @@ public class GetIndexResponse extends ActionResponse { ImmutableOpenMap.Builder settingsMapBuilder = ImmutableOpenMap.builder(); for (int i = 0; i < settingsSize; i++) { String key = in.readString(); - settingsMapBuilder.put(key, ImmutableSettings.readSettingsFromStream(in)); + settingsMapBuilder.put(key, Settings.readSettingsFromStream(in)); } settings = settingsMapBuilder.build(); } @@ -195,7 +194,7 @@ public class GetIndexResponse extends ActionResponse { out.writeVInt(settings.size()); for (ObjectObjectCursor indexEntry : settings) { out.writeString(indexEntry.key); - ImmutableSettings.writeSettingsToStream(indexEntry.value, out); + Settings.writeSettingsToStream(indexEntry.value, out); } } } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java index db9bfe99133..2cc3997b2c4 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java @@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.indices.get; import com.google.common.collect.ImmutableList; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature; import org.elasticsearch.action.support.ActionFilters; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java index 3c8d1b7affa..986779cee3d 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetFieldMappingsAction.java @@ -23,14 +23,12 @@ import com.google.common.collect.ImmutableMap; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportService; import java.util.concurrent.atomic.AtomicInteger; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java index 9867aeaf80c..03eb5ed3595 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.mapping.get; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.info.TransportClusterInfoAction; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java index 5b7000cbacc..9772754d330 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.mapping.put; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java index 7a74cc123e1..83063492c07 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.open; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DestructiveOperations; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java b/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java index 3c99a909e19..c4f276126fa 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.optimize; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DefaultShardOperationFailedException; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/recovery/TransportRecoveryAction.java b/src/main/java/org/elasticsearch/action/admin/indices/recovery/TransportRecoveryAction.java index 6287136e69f..2996247963f 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/recovery/TransportRecoveryAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/recovery/TransportRecoveryAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.recovery; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DefaultShardOperationFailedException; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java b/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java index 713a14bad47..001793ecd17 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.refresh; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DefaultShardOperationFailedException; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/seal/TransportSealIndicesAction.java b/src/main/java/org/elasticsearch/action/admin/indices/seal/TransportSealIndicesAction.java index 61d5e53c32f..71a91de04b4 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/seal/TransportSealIndicesAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/seal/TransportSealIndicesAction.java @@ -24,23 +24,17 @@ import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardIterator; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.common.util.concurrent.CountDown; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.indices.IndicesLifecycle; import org.elasticsearch.indices.SyncedFlushService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; -import java.io.IOException; -import java.util.HashSet; import java.util.Set; /** diff --git a/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java index fb416d41aae..fa9639424b4 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/segments/TransportIndicesSegmentsAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.segments; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DefaultShardOperationFailedException; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java b/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java index 6043e7c4642..c45c7d9f545 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.ActionResponse; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import java.io.IOException; @@ -61,7 +60,7 @@ public class GetSettingsResponse extends ActionResponse { int size = in.readVInt(); ImmutableOpenMap.Builder builder = ImmutableOpenMap.builder(); for (int i = 0; i < size; i++) { - builder.put(in.readString(), ImmutableSettings.readSettingsFromStream(in)); + builder.put(in.readString(), Settings.readSettingsFromStream(in)); } indexToSettings = builder.build(); } @@ -72,7 +71,7 @@ public class GetSettingsResponse extends ActionResponse { out.writeVInt(indexToSettings.size()); for (ObjectObjectCursor cursor : indexToSettings) { out.writeString(cursor.key); - ImmutableSettings.writeSettingsToStream(cursor.value, out); + Settings.writeSettingsToStream(cursor.value, out); } } } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java index 7c4dfd49763..c3a8948d1bb 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java @@ -19,9 +19,7 @@ package org.elasticsearch.action.admin.indices.settings.get; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeReadOperationAction; import org.elasticsearch.cluster.ClusterService; @@ -32,7 +30,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.util.CollectionUtils; @@ -83,7 +80,7 @@ public class TransportGetSettingsAction extends TransportMasterNodeReadOperation Settings settings = SettingsFilter.filterSettings(settingsFilter.getPatterns(), indexMetaData.settings()); if (!CollectionUtils.isEmpty(request.names())) { - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder(); + Settings.Builder settingsBuilder = Settings.builder(); for (Map.Entry entry : settings.getAsMap().entrySet()) { if (Regex.simpleMatch(request.names(), entry.getKey())) { settingsBuilder.put(entry.getKey(), entry.getValue()); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java index 08195d17e38..8185badb5af 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.admin.indices.settings.put; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java index 5dee0265879..501da327d5b 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java @@ -26,7 +26,6 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -36,9 +35,9 @@ import java.io.IOException; import java.util.Map; import static org.elasticsearch.action.ValidateActions.addValidationError; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; -import static org.elasticsearch.common.settings.ImmutableSettings.readSettingsFromStream; -import static org.elasticsearch.common.settings.ImmutableSettings.writeSettingsToStream; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.readSettingsFromStream; +import static org.elasticsearch.common.settings.Settings.writeSettingsToStream; /** * Request for an update index settings action @@ -124,7 +123,7 @@ public class UpdateSettingsRequest extends AcknowledgedRequest diff --git a/src/main/java/org/elasticsearch/action/support/ThreadedActionListener.java b/src/main/java/org/elasticsearch/action/support/ThreadedActionListener.java index 77dd305897c..2a2bdd7a061 100644 --- a/src/main/java/org/elasticsearch/action/support/ThreadedActionListener.java +++ b/src/main/java/org/elasticsearch/action/support/ThreadedActionListener.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.AbstractRunnable; -import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; import org.elasticsearch.threadpool.ThreadPool; import java.util.concurrent.Future; diff --git a/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java b/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java index b0bcad2e86b..6ff55467f7d 100644 --- a/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.support.broadcast; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.NoShardAvailableActionException; import org.elasticsearch.action.support.ActionFilters; diff --git a/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java b/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java index 4ff18e68db0..9e1c662cf60 100644 --- a/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java @@ -19,14 +19,12 @@ package org.elasticsearch.action.support.master; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionRunnable; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.action.support.ThreadedActionListener; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; @@ -35,7 +33,6 @@ import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.node.NodeClosedException; import org.elasticsearch.threadpool.ThreadPool; diff --git a/src/main/java/org/elasticsearch/action/support/master/info/TransportClusterInfoAction.java b/src/main/java/org/elasticsearch/action/support/master/info/TransportClusterInfoAction.java index 8ecff553bce..fdf6352ef18 100644 --- a/src/main/java/org/elasticsearch/action/support/master/info/TransportClusterInfoAction.java +++ b/src/main/java/org/elasticsearch/action/support/master/info/TransportClusterInfoAction.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.action.support.master.info; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.support.ActionFilters; diff --git a/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java b/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java index 9331a5d4a65..78503930357 100644 --- a/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.support.nodes; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.FailedNodeException; import org.elasticsearch.action.NoSuchNodeException; diff --git a/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java b/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java index 0136bf9b2a3..3d05c4960a3 100644 --- a/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/replication/TransportShardReplicationOperationAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.support.replication; -import org.apache.lucene.util.IOUtils; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionWriteResponse; @@ -51,7 +50,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; -import org.elasticsearch.common.util.concurrent.RefCounted; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.engine.DocumentAlreadyExistsException; import org.elasticsearch.index.engine.Engine; @@ -70,13 +68,11 @@ import org.elasticsearch.river.RiverIndexName; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; -import java.io.Closeable; import java.io.IOException; import java.util.Map; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; /** */ diff --git a/src/main/java/org/elasticsearch/action/support/single/custom/TransportSingleCustomOperationAction.java b/src/main/java/org/elasticsearch/action/support/single/custom/TransportSingleCustomOperationAction.java index cb2376d3230..5f8740501ae 100644 --- a/src/main/java/org/elasticsearch/action/support/single/custom/TransportSingleCustomOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/single/custom/TransportSingleCustomOperationAction.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.action.support.single.custom; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.NoShardAvailableActionException; diff --git a/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java b/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java index d4190aca619..e33347bdbee 100644 --- a/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/single/instance/TransportInstanceSingleOperationAction.java @@ -19,13 +19,11 @@ package org.elasticsearch.action.support.single.instance; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.UnavailableShardsException; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; diff --git a/src/main/java/org/elasticsearch/action/termvectors/TransportTermVectorsAction.java b/src/main/java/org/elasticsearch/action/termvectors/TransportTermVectorsAction.java index 7dccb0f3fb0..e03abfee230 100644 --- a/src/main/java/org/elasticsearch/action/termvectors/TransportTermVectorsAction.java +++ b/src/main/java/org/elasticsearch/action/termvectors/TransportTermVectorsAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.termvectors; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.RoutingMissingException; import org.elasticsearch.action.support.ActionFilters; diff --git a/src/main/java/org/elasticsearch/action/termvectors/dfs/TransportDfsOnlyAction.java b/src/main/java/org/elasticsearch/action/termvectors/dfs/TransportDfsOnlyAction.java index 2dca1a9049e..c1d698725e9 100644 --- a/src/main/java/org/elasticsearch/action/termvectors/dfs/TransportDfsOnlyAction.java +++ b/src/main/java/org/elasticsearch/action/termvectors/dfs/TransportDfsOnlyAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.termvectors.dfs; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.support.ActionFilters; diff --git a/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java b/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java index 135be162d4b..e14d687a860 100644 --- a/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java +++ b/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.action.update; import com.google.common.collect.ImmutableList; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRunnable; diff --git a/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java b/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java index ce34de372ad..cc1b7e059ad 100644 --- a/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java +++ b/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java @@ -38,7 +38,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.monitor.process.JmxProcessProbe; -import org.elasticsearch.monitor.sigar.SigarService; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.node.internal.InternalSettingsPreparer; @@ -50,7 +49,7 @@ import java.util.concurrent.CountDownLatch; import static com.google.common.collect.Sets.newHashSet; import static org.elasticsearch.common.jna.Kernel32Library.ConsoleCtrlHandler; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; /** * A main entry point when starting from the command line. diff --git a/src/main/java/org/elasticsearch/client/node/NodeClient.java b/src/main/java/org/elasticsearch/client/node/NodeClient.java index 2ee07aee55b..deb3e5b1ad5 100644 --- a/src/main/java/org/elasticsearch/client/node/NodeClient.java +++ b/src/main/java/org/elasticsearch/client/node/NodeClient.java @@ -21,19 +21,10 @@ package org.elasticsearch.client.node; import com.google.common.collect.ImmutableMap; import org.elasticsearch.action.*; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.action.support.ThreadedActionListener; import org.elasticsearch.action.support.TransportAction; -import org.elasticsearch.client.AdminClient; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.ClusterAdminClient; -import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.support.AbstractClient; import org.elasticsearch.client.support.Headers; -import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; diff --git a/src/main/java/org/elasticsearch/client/support/Headers.java b/src/main/java/org/elasticsearch/client/support/Headers.java index 719c7668892..f46bd0a1c9d 100644 --- a/src/main/java/org/elasticsearch/client/support/Headers.java +++ b/src/main/java/org/elasticsearch/client/support/Headers.java @@ -20,7 +20,6 @@ package org.elasticsearch.client.support; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.transport.TransportMessage; @@ -32,7 +31,7 @@ public class Headers { public static final String PREFIX = "request.headers"; - public static final Headers EMPTY = new Headers(ImmutableSettings.EMPTY) { + public static final Headers EMPTY = new Headers(Settings.EMPTY) { @Override public > M applyTo(M message) { return message; @@ -61,6 +60,6 @@ public class Headers { static Settings resolveHeaders(Settings settings) { Settings headers = settings.getAsSettings(PREFIX); - return headers != null ? headers : ImmutableSettings.EMPTY; + return headers != null ? headers : Settings.EMPTY; } } diff --git a/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/src/main/java/org/elasticsearch/client/transport/TransportClient.java index 2801159a0db..9e3cb1f0f80 100644 --- a/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -34,7 +34,6 @@ import org.elasticsearch.common.compress.CompressorFactory; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.network.NetworkModule; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.transport.TransportAddress; @@ -43,7 +42,6 @@ import org.elasticsearch.env.EnvironmentModule; import org.elasticsearch.indices.breaker.CircuitBreakerModule; import org.elasticsearch.monitor.MonitorService; import org.elasticsearch.node.internal.InternalSettingsPreparer; -import org.elasticsearch.node.settings.NodeSettingsService; import org.elasticsearch.plugins.PluginsModule; import org.elasticsearch.plugins.PluginsService; import org.elasticsearch.search.TransportSearchModule; @@ -55,7 +53,7 @@ import org.elasticsearch.transport.netty.NettyTransport; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * The transport client allows to create a client that is not part of the cluster, but simply connects to one @@ -78,7 +76,7 @@ public class TransportClient extends AbstractClient { */ public static class Builder { - private Settings settings = ImmutableSettings.EMPTY; + private Settings settings = Settings.EMPTY; private boolean loadConfigSettings = true; /** diff --git a/src/main/java/org/elasticsearch/cluster/EmptyClusterInfoService.java b/src/main/java/org/elasticsearch/cluster/EmptyClusterInfoService.java index 096ea43e9b1..3267a9b1185 100644 --- a/src/main/java/org/elasticsearch/cluster/EmptyClusterInfoService.java +++ b/src/main/java/org/elasticsearch/cluster/EmptyClusterInfoService.java @@ -21,7 +21,7 @@ package org.elasticsearch.cluster; import com.google.common.collect.ImmutableMap; import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; /** * ClusterInfoService that provides empty maps for disk usage and shard sizes @@ -34,7 +34,7 @@ public class EmptyClusterInfoService extends AbstractComponent implements Cluste private final ClusterInfo emptyClusterInfo; private EmptyClusterInfoService() { - super(ImmutableSettings.EMPTY); + super(Settings.EMPTY); emptyClusterInfo = new ClusterInfo(ImmutableMap.of(), ImmutableMap.of()); } diff --git a/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java b/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java index 1bf3d3b6b90..769551d8732 100644 --- a/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java +++ b/src/main/java/org/elasticsearch/cluster/action/index/NodeIndexDeletedAction.java @@ -20,7 +20,6 @@ package org.elasticsearch.cluster.action.index; import org.apache.lucene.store.LockObtainFailedException; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.component.AbstractComponent; @@ -30,7 +29,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; -import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.Index; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.threadpool.ThreadPool; diff --git a/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java b/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java index 5623dd96d6f..c6cb7b508b0 100644 --- a/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java +++ b/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.cluster.action.index; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.IndicesRequest; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.cluster.ClusterState; diff --git a/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java b/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java index ecbc27bd266..bdea92d1f6f 100644 --- a/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java +++ b/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.cluster.action.shard; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; diff --git a/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java b/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java index d70eb0d86a5..c9c7bbabb00 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java @@ -38,7 +38,6 @@ import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.compress.CompressedString; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.loader.SettingsLoader; import org.elasticsearch.common.xcontent.ToXContent; @@ -57,7 +56,7 @@ import java.util.Map; import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.AND; import static org.elasticsearch.cluster.node.DiscoveryNodeFilters.OpType.OR; -import static org.elasticsearch.common.settings.ImmutableSettings.*; +import static org.elasticsearch.common.settings.Settings.*; /** * @@ -65,7 +64,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.*; public class IndexMetaData implements Diffable { public static final IndexMetaData PROTO = IndexMetaData.builder("") - .settings(ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) + .settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) .numberOfShards(1).numberOfReplicas(0).build(); public interface Custom extends Diffable, ToXContent { @@ -518,7 +517,7 @@ public class IndexMetaData implements Diffable { index = in.readString(); version = in.readLong(); state = State.fromId(in.readByte()); - settings = ImmutableSettings.readSettingsFromStream(in); + settings = Settings.readSettingsFromStream(in); mappings = DiffableUtils.readImmutableOpenMapDiff(in, MappingMetaData.PROTO); aliases = DiffableUtils.readImmutableOpenMapDiff(in, AliasMetaData.PROTO); customs = DiffableUtils.readImmutableOpenMapDiff(in, new DiffableUtils.KeyedReader() { @@ -539,7 +538,7 @@ public class IndexMetaData implements Diffable { out.writeString(index); out.writeLong(version); out.writeByte(state.id); - ImmutableSettings.writeSettingsToStream(settings, out); + Settings.writeSettingsToStream(settings, out); mappings.writeTo(out); aliases.writeTo(out); customs.writeTo(out); @@ -617,7 +616,7 @@ public class IndexMetaData implements Diffable { private String index; private State state = State.OPEN; private long version = 1; - private Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS; + private Settings settings = Settings.Builder.EMPTY_SETTINGS; private final ImmutableOpenMap.Builder mappings; private final ImmutableOpenMap.Builder aliases; private final ImmutableOpenMap.Builder customs; @@ -829,7 +828,7 @@ public class IndexMetaData implements Diffable { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { if ("settings".equals(currentFieldName)) { - builder.settings(ImmutableSettings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered()))); + builder.settings(Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered()))); } else if ("mappings".equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { diff --git a/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java b/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java index 54150ee6a1e..ae555a54e75 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/IndexTemplateMetaData.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.compress.CompressedString; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.loader.SettingsLoader; import org.elasticsearch.common.xcontent.ToXContent; @@ -168,7 +167,7 @@ public class IndexTemplateMetaData extends AbstractDiffable cursor : mappings) { out.writeString(cursor.key); @@ -222,7 +221,7 @@ public class IndexTemplateMetaData extends AbstractDiffable mappings; @@ -376,7 +375,7 @@ public class IndexTemplateMetaData extends AbstractDiffable, Diffable { this.version = version; this.transientSettings = transientSettings; this.persistentSettings = persistentSettings; - this.settings = ImmutableSettings.settingsBuilder().put(persistentSettings).put(transientSettings).build(); + this.settings = Settings.settingsBuilder().put(persistentSettings).put(transientSettings).build(); this.indices = indices; this.customs = customs; this.templates = templates; @@ -1194,8 +1193,8 @@ public class MetaData implements Iterable, Diffable { public MetaDataDiff(StreamInput in) throws IOException { uuid = in.readString(); version = in.readLong(); - transientSettings = ImmutableSettings.readSettingsFromStream(in); - persistentSettings = ImmutableSettings.readSettingsFromStream(in); + transientSettings = Settings.readSettingsFromStream(in); + persistentSettings = Settings.readSettingsFromStream(in); indices = DiffableUtils.readImmutableOpenMapDiff(in, IndexMetaData.PROTO); templates = DiffableUtils.readImmutableOpenMapDiff(in, IndexTemplateMetaData.PROTO); customs = DiffableUtils.readImmutableOpenMapDiff(in, new KeyedReader() { @@ -1215,8 +1214,8 @@ public class MetaData implements Iterable, Diffable { public void writeTo(StreamOutput out) throws IOException { out.writeString(uuid); out.writeLong(version); - ImmutableSettings.writeSettingsToStream(transientSettings, out); - ImmutableSettings.writeSettingsToStream(persistentSettings, out); + Settings.writeSettingsToStream(transientSettings, out); + Settings.writeSettingsToStream(persistentSettings, out); indices.writeTo(out); templates.writeTo(out); customs.writeTo(out); @@ -1294,8 +1293,8 @@ public class MetaData implements Iterable, Diffable { private String uuid; private long version; - private Settings transientSettings = ImmutableSettings.Builder.EMPTY_SETTINGS; - private Settings persistentSettings = ImmutableSettings.Builder.EMPTY_SETTINGS; + private Settings transientSettings = Settings.Builder.EMPTY_SETTINGS; + private Settings persistentSettings = Settings.Builder.EMPTY_SETTINGS; private final ImmutableOpenMap.Builder indices; private final ImmutableOpenMap.Builder templates; @@ -1546,7 +1545,7 @@ public class MetaData implements Iterable, Diffable { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { if ("settings".equals(currentFieldName)) { - builder.persistentSettings(ImmutableSettings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build()); + builder.persistentSettings(Settings.settingsBuilder().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/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java index 1d0f584f618..41e310a95ad 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java @@ -49,13 +49,10 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.compress.CompressedString; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.Streams; -import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentHelper; -import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.env.Environment; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.Index; @@ -80,7 +77,7 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * Service responsible for submitting create index requests @@ -193,7 +190,7 @@ public class MetaDataCreateIndexService extends AbstractComponent { private void createIndex(final CreateIndexClusterStateUpdateRequest request, final ActionListener listener, final Semaphore mdLock) { - ImmutableSettings.Builder updatedSettingsBuilder = ImmutableSettings.settingsBuilder(); + Settings.Builder updatedSettingsBuilder = Settings.settingsBuilder(); updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); request.settings(updatedSettingsBuilder.build()); @@ -300,7 +297,7 @@ public class MetaDataCreateIndexService extends AbstractComponent { } } - ImmutableSettings.Builder indexSettingsBuilder = settingsBuilder(); + Settings.Builder indexSettingsBuilder = settingsBuilder(); // 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/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java index 755d0077c13..3e945b161eb 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexTemplateService.java @@ -22,7 +22,6 @@ import com.carrotsearch.hppc.cursors.ObjectCursor; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.support.master.MasterNodeOperationRequest; import org.elasticsearch.cluster.ClusterService; @@ -33,7 +32,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.indices.IndexTemplateAlreadyExistsException; @@ -105,7 +103,7 @@ public class MetaDataIndexTemplateService extends AbstractComponent { } public void putTemplate(final PutRequest request, final PutListener listener) { - ImmutableSettings.Builder updatedSettingsBuilder = ImmutableSettings.settingsBuilder(); + Settings.Builder updatedSettingsBuilder = Settings.settingsBuilder(); updatedSettingsBuilder.put(request.settings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); request.settings(updatedSettingsBuilder.build()); @@ -228,7 +226,7 @@ public class MetaDataIndexTemplateService extends AbstractComponent { boolean create; int order; String template; - Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS; + Settings settings = Settings.Builder.EMPTY_SETTINGS; Map mappings = Maps.newHashMap(); List aliases = Lists.newArrayList(); Map customs = Maps.newHashMap(); diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java index 570f6ec064a..5265cfabd5d 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexUpgradeService.java @@ -24,7 +24,6 @@ import org.elasticsearch.cluster.routing.HashFunction; import org.elasticsearch.cluster.routing.SimpleHashFunction; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; /** @@ -114,7 +113,7 @@ public class MetaDataIndexUpgradeService extends AbstractComponent { if (indexMetaData.settings().get(IndexMetaData.SETTING_LEGACY_ROUTING_HASH_FUNCTION) == null && indexMetaData.getCreationVersion().before(Version.V_2_0_0)) { // these settings need an upgrade - Settings indexSettings = ImmutableSettings.builder().put(indexMetaData.settings()) + Settings indexSettings = Settings.builder().put(indexMetaData.settings()) .put(IndexMetaData.SETTING_LEGACY_ROUTING_HASH_FUNCTION, pre20HashFunction) .put(IndexMetaData.SETTING_LEGACY_ROUTING_USE_TYPE, pre20UseType == null ? false : pre20UseType) .build(); diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java index dd98081e021..4b5d793356d 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataUpdateSettingsService.java @@ -34,7 +34,6 @@ import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Priority; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.settings.IndexDynamicSettings; @@ -138,7 +137,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements if (nrReplicasChanged.size() > 0) { for (final Integer fNumberOfReplicas : nrReplicasChanged.keySet()) { - Settings settings = ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, fNumberOfReplicas).build(); + Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, fNumberOfReplicas).build(); final List indices = nrReplicasChanged.get(fNumberOfReplicas); UpdateSettingsClusterStateUpdateRequest updateRequest = new UpdateSettingsClusterStateUpdateRequest() @@ -166,7 +165,7 @@ public class MetaDataUpdateSettingsService extends AbstractComponent implements } public void updateSettings(final UpdateSettingsClusterStateUpdateRequest request, final ActionListener listener) { - ImmutableSettings.Builder updatedSettingsBuilder = ImmutableSettings.settingsBuilder(); + Settings.Builder updatedSettingsBuilder = Settings.settingsBuilder(); updatedSettingsBuilder.put(request.settings()).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX); // never allow to change the number of shards for (String key : updatedSettingsBuilder.internalMap().keySet()) { diff --git a/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java b/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java index 51cd5db086b..52e28ffd21e 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/RepositoriesMetaData.java @@ -25,7 +25,6 @@ import org.elasticsearch.cluster.AbstractDiffable; import org.elasticsearch.cluster.metadata.MetaData.Custom; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.loader.SettingsLoader; import org.elasticsearch.common.xcontent.ToXContent; @@ -143,7 +142,7 @@ public class RepositoriesMetaData extends AbstractDiffable implements Me throw new ElasticsearchParseException("failed to parse repository [" + name + "], expected object"); } String type = null; - Settings settings = ImmutableSettings.EMPTY; + Settings settings = Settings.EMPTY; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { String currentFieldName = parser.currentName(); @@ -156,7 +155,7 @@ public class RepositoriesMetaData extends AbstractDiffable implements Me if (parser.nextToken() != XContentParser.Token.START_OBJECT) { throw new ElasticsearchParseException("failed to parse repository [" + name + "], incompatible params"); } - settings = ImmutableSettings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build(); + settings = Settings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build(); } else { throw new ElasticsearchParseException("failed to parse repository [" + name + "], unknown field [" + currentFieldName + "]"); } diff --git a/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetaData.java b/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetaData.java index a283f1f43c1..182c06b7e39 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetaData.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetaData.java @@ -20,7 +20,6 @@ package org.elasticsearch.cluster.metadata; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import java.io.IOException; @@ -84,7 +83,7 @@ public class RepositoryMetaData { public static RepositoryMetaData readFrom(StreamInput in) throws IOException { String name = in.readString(); String type = in.readString(); - Settings settings = ImmutableSettings.readSettingsFromStream(in); + Settings settings = Settings.readSettingsFromStream(in); return new RepositoryMetaData(name, type, settings); } @@ -97,7 +96,7 @@ public class RepositoryMetaData { public void writeTo(StreamOutput out) throws IOException { out.writeString(name); out.writeString(type); - ImmutableSettings.writeSettingsToStream(settings, out); + Settings.writeSettingsToStream(settings, out); } @Override diff --git a/src/main/java/org/elasticsearch/cluster/routing/RoutingService.java b/src/main/java/org/elasticsearch/cluster/routing/RoutingService.java index 33804559e4d..32c328365d2 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/RoutingService.java +++ b/src/main/java/org/elasticsearch/cluster/routing/RoutingService.java @@ -19,7 +19,6 @@ package org.elasticsearch.cluster.routing; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.allocation.AllocationService; diff --git a/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationService.java b/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationService.java index 8e6b68ecf78..4b99a48a2ab 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationService.java +++ b/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationService.java @@ -22,7 +22,6 @@ package org.elasticsearch.cluster.routing.allocation; import com.carrotsearch.hppc.cursors.ObjectCursor; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.ClusterInfoService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; diff --git a/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ShardsAllocators.java b/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ShardsAllocators.java index 69ae6efb6b7..b9ac4bd4f56 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ShardsAllocators.java +++ b/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/ShardsAllocators.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.cluster.routing.allocation.StartedRerouteAllocation; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.gateway.GatewayAllocator; @@ -41,7 +40,7 @@ public class ShardsAllocators extends AbstractComponent implements ShardsAllocat private final ShardsAllocator allocator; public ShardsAllocators(GatewayAllocator allocator) { - this(ImmutableSettings.Builder.EMPTY_SETTINGS, allocator); + this(Settings.Builder.EMPTY_SETTINGS, allocator); } public ShardsAllocators(Settings settings, GatewayAllocator allocator) { diff --git a/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AwarenessAllocationDecider.java b/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AwarenessAllocationDecider.java index e8f033b25fd..c242a90ce86 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AwarenessAllocationDecider.java +++ b/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AwarenessAllocationDecider.java @@ -28,7 +28,6 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.settings.NodeSettingsService; @@ -120,7 +119,7 @@ public class AwarenessAllocationDecider extends AllocationDecider { * Creates a new {@link AwarenessAllocationDecider} instance */ public AwarenessAllocationDecider() { - this(ImmutableSettings.Builder.EMPTY_SETTINGS); + this(Settings.Builder.EMPTY_SETTINGS); } /** diff --git a/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/SnapshotInProgressAllocationDecider.java b/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/SnapshotInProgressAllocationDecider.java index db4e88cce92..7aaae44f380 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/SnapshotInProgressAllocationDecider.java +++ b/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/SnapshotInProgressAllocationDecider.java @@ -24,7 +24,6 @@ import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.settings.NodeSettingsService; @@ -58,7 +57,7 @@ public class SnapshotInProgressAllocationDecider extends AllocationDecider { * Creates a new {@link org.elasticsearch.cluster.routing.allocation.decider.SnapshotInProgressAllocationDecider} instance */ public SnapshotInProgressAllocationDecider() { - this(ImmutableSettings.Builder.EMPTY_SETTINGS); + this(Settings.Builder.EMPTY_SETTINGS); } /** diff --git a/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobStore.java b/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobStore.java index 3314f2eb8e2..ad9fe257cf7 100644 --- a/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobStore.java +++ b/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobStore.java @@ -24,17 +24,14 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.blobstore.BlobContainer; import org.elasticsearch.common.blobstore.BlobPath; import org.elasticsearch.common.blobstore.BlobStore; -import org.elasticsearch.common.blobstore.BlobStoreException; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; -import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.zip.ZipFile; /** * diff --git a/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobStore.java b/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobStore.java index 11c13abec3c..f330ce82441 100644 --- a/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobStore.java +++ b/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobStore.java @@ -27,11 +27,9 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.threadpool.ThreadPool; import java.net.MalformedURLException; import java.net.URL; -import java.util.concurrent.Executor; /** * Read-only URL-based blob store diff --git a/src/main/java/org/elasticsearch/common/cli/CliTool.java b/src/main/java/org/elasticsearch/common/cli/CliTool.java index f2e08c5b1e5..71e87943349 100644 --- a/src/main/java/org/elasticsearch/common/cli/CliTool.java +++ b/src/main/java/org/elasticsearch/common/cli/CliTool.java @@ -31,7 +31,7 @@ import org.elasticsearch.node.internal.InternalSettingsPreparer; import java.io.IOException; import java.util.Locale; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; /** * A base class for command-line interface tool. diff --git a/src/main/java/org/elasticsearch/common/component/AbstractLifecycleComponent.java b/src/main/java/org/elasticsearch/common/component/AbstractLifecycleComponent.java index 3bac87515a0..11dbca72973 100644 --- a/src/main/java/org/elasticsearch/common/component/AbstractLifecycleComponent.java +++ b/src/main/java/org/elasticsearch/common/component/AbstractLifecycleComponent.java @@ -19,7 +19,6 @@ package org.elasticsearch.common.component; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.settings.Settings; import java.util.List; diff --git a/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java b/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java index 42a51db620b..57771a1e3a8 100644 --- a/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java +++ b/src/main/java/org/elasticsearch/common/compress/lzf/LZFCompressor.java @@ -20,13 +20,10 @@ package org.elasticsearch.common.compress.lzf; import com.ning.compress.lzf.ChunkDecoder; -import com.ning.compress.lzf.ChunkEncoder; import com.ning.compress.lzf.LZFChunk; import com.ning.compress.lzf.LZFEncoder; import com.ning.compress.lzf.util.ChunkDecoderFactory; -import com.ning.compress.lzf.util.ChunkEncoderFactory; import org.apache.lucene.store.IndexInput; -import org.apache.lucene.util.Constants; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.compress.CompressedIndexInput; import org.elasticsearch.common.compress.CompressedStreamInput; diff --git a/src/main/java/org/elasticsearch/common/logging/Loggers.java b/src/main/java/org/elasticsearch/common/logging/Loggers.java index bc2ea568b82..512b8a40fe6 100644 --- a/src/main/java/org/elasticsearch/common/logging/Loggers.java +++ b/src/main/java/org/elasticsearch/common/logging/Loggers.java @@ -62,7 +62,7 @@ public class Loggers { return getLogger(clazz, settings, shardId.index(), Lists.asList(Integer.toString(shardId.id()), prefixes).toArray(new String[0])); } - /** Just like {@link #getLogger(Class,Settings,ShardId,String...)} but String loggerName instead of Class. */ + /** Just like {@link #getLogger(Class, org.elasticsearch.common.settings.Settings,ShardId,String...)} but String loggerName instead of Class. */ public static ESLogger getLogger(String loggerName, Settings settings, ShardId shardId, String... prefixes) { return getLogger(loggerName, settings, Lists.asList(shardId.index().name(), Integer.toString(shardId.id()), prefixes).toArray(new String[0])); } diff --git a/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java b/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java index 7d422d59aea..a4359491e30 100644 --- a/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java +++ b/src/main/java/org/elasticsearch/common/logging/log4j/LogConfigurator.java @@ -23,10 +23,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.rolling.SizeBasedTriggeringPolicy; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.collect.MapBuilder; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.FailedToResolveConfigException; @@ -40,7 +38,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * @@ -88,7 +86,7 @@ public class LogConfigurator { } loaded = true; Environment environment = new Environment(settings); - ImmutableSettings.Builder settingsBuilder = settingsBuilder().put(settings); + Settings.Builder settingsBuilder = settingsBuilder().put(settings); resolveConfig(environment, settingsBuilder); settingsBuilder .putProperties("elasticsearch.", System.getProperties()) @@ -120,7 +118,7 @@ public class LogConfigurator { loaded = false; } - public static void resolveConfig(Environment env, final ImmutableSettings.Builder settingsBuilder) { + public static void resolveConfig(Environment env, final Settings.Builder settingsBuilder) { try { Files.walkFileTree(env.configFile(), EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor() { @@ -143,7 +141,7 @@ public class LogConfigurator { } } - public static void loadConfig(Path file, ImmutableSettings.Builder settingsBuilder) { + public static void loadConfig(Path file, Settings.Builder settingsBuilder) { try { settingsBuilder.loadFromUrl(file.toUri().toURL()); } catch (FailedToResolveConfigException | NoClassDefFoundError | MalformedURLException e) { diff --git a/src/main/java/org/elasticsearch/common/network/MulticastChannel.java b/src/main/java/org/elasticsearch/common/network/MulticastChannel.java index 238683414d2..076d65e5bea 100644 --- a/src/main/java/org/elasticsearch/common/network/MulticastChannel.java +++ b/src/main/java/org/elasticsearch/common/network/MulticastChannel.java @@ -25,7 +25,7 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.ESLoggerFactory; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import java.io.Closeable; import java.net.*; @@ -276,7 +276,7 @@ public abstract class MulticastChannel implements Closeable { this.datagramPacketSend = new DatagramPacket(new byte[config.bufferSize], config.bufferSize, InetAddress.getByName(config.group), config.port); this.multicastSocket = buildMulticastSocket(config); this.receiver = new Receiver(); - this.receiverThread = daemonThreadFactory(ImmutableSettings.builder().put("name", name).build(), "discovery#multicast#receiver").newThread(receiver); + this.receiverThread = daemonThreadFactory(Settings.builder().put("name", name).build(), "discovery#multicast#receiver").newThread(receiver); this.receiverThread.start(); } diff --git a/src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java b/src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java deleted file mode 100644 index 8738d30e774..00000000000 --- a/src/main/java/org/elasticsearch/common/settings/ImmutableSettings.java +++ /dev/null @@ -1,1148 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.common.settings; - -import com.google.common.base.Charsets; -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import org.elasticsearch.Version; -import org.elasticsearch.common.Booleans; -import org.elasticsearch.common.Classes; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.Streams; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.property.PropertyPlaceholder; -import org.elasticsearch.common.settings.loader.SettingsLoader; -import org.elasticsearch.common.settings.loader.SettingsLoaderFactory; -import org.elasticsearch.common.unit.*; -import org.elasticsearch.common.xcontent.XContentBuilder; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.elasticsearch.common.Strings.toCamelCase; -import static org.elasticsearch.common.unit.ByteSizeValue.parseBytesSizeValue; -import static org.elasticsearch.common.unit.SizeValue.parseSizeValue; -import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; - -/** - * An immutable implementation of {@link Settings}. - */ -public class ImmutableSettings implements Settings { - - public static final Settings EMPTY = new Builder().build(); - private final static Pattern ARRAY_PATTERN = Pattern.compile("(.*)\\.\\d+$"); - - private ImmutableMap settings; - private final ImmutableMap forcedUnderscoreSettings; - private transient ClassLoader classLoader; - - ImmutableSettings(Map settings, ClassLoader classLoader) { - this.settings = ImmutableMap.copyOf(settings); - Map forcedUnderscoreSettings = null; - for (Map.Entry entry : settings.entrySet()) { - String toUnderscoreCase = Strings.toUnderscoreCase(entry.getKey()); - if (!toUnderscoreCase.equals(entry.getKey())) { - if (forcedUnderscoreSettings == null) { - forcedUnderscoreSettings = new HashMap<>(); - } - forcedUnderscoreSettings.put(toUnderscoreCase, entry.getValue()); - } - } - this.forcedUnderscoreSettings = forcedUnderscoreSettings == null ? ImmutableMap.of() : ImmutableMap.copyOf(forcedUnderscoreSettings); - this.classLoader = classLoader; - } - - @Override - public ClassLoader getClassLoader() { - return this.classLoader == null ? Classes.getDefaultClassLoader() : classLoader; - } - - @Override - public ClassLoader getClassLoaderIfSet() { - return this.classLoader; - } - - @Override - public ImmutableMap getAsMap() { - return this.settings; - } - - @Override - public Map getAsStructuredMap() { - Map map = Maps.newHashMapWithExpectedSize(2); - for (Map.Entry entry : settings.entrySet()) { - processSetting(map, "", entry.getKey(), entry.getValue()); - } - for (Map.Entry entry : map.entrySet()) { - if (entry.getValue() instanceof Map) { - @SuppressWarnings("unchecked") Map valMap = (Map) entry.getValue(); - entry.setValue(convertMapsToArrays(valMap)); - } - } - - return map; - } - - private void processSetting(Map map, String prefix, String setting, String value) { - int prefixLength = setting.indexOf('.'); - if (prefixLength == -1) { - @SuppressWarnings("unchecked") Map innerMap = (Map) map.get(prefix + setting); - if (innerMap != null) { - // It supposed to be a value, but we already have a map stored, need to convert this map to "." notation - for (Map.Entry entry : innerMap.entrySet()) { - map.put(prefix + setting + "." + entry.getKey(), entry.getValue()); - } - } - map.put(prefix + setting, value); - } else { - String key = setting.substring(0, prefixLength); - String rest = setting.substring(prefixLength + 1); - Object existingValue = map.get(prefix + key); - if (existingValue == null) { - Map newMap = Maps.newHashMapWithExpectedSize(2); - processSetting(newMap, "", rest, value); - map.put(key, newMap); - } else { - if (existingValue instanceof Map) { - @SuppressWarnings("unchecked") - Map innerMap = (Map) existingValue; - processSetting(innerMap, "", rest, value); - map.put(key, innerMap); - } else { - // It supposed to be a map, but we already have a value stored, which is not a map - // fall back to "." notation - processSetting(map, prefix + key + ".", rest, value); - } - } - } - } - - private Object convertMapsToArrays(Map map) { - if (map.isEmpty()) { - return map; - } - boolean isArray = true; - int maxIndex = -1; - for (Map.Entry entry : map.entrySet()) { - if (isArray) { - try { - int index = Integer.parseInt(entry.getKey()); - if (index >= 0) { - maxIndex = Math.max(maxIndex, index); - } else { - isArray = false; - } - } catch (NumberFormatException ex) { - isArray = false; - } - } - if (entry.getValue() instanceof Map) { - @SuppressWarnings("unchecked") Map valMap = (Map) entry.getValue(); - entry.setValue(convertMapsToArrays(valMap)); - } - } - if (isArray && (maxIndex + 1) == map.size()) { - ArrayList newValue = Lists.newArrayListWithExpectedSize(maxIndex + 1); - for (int i = 0; i <= maxIndex; i++) { - Object obj = map.get(Integer.toString(i)); - if (obj == null) { - // Something went wrong. Different format? - // Bailout! - return map; - } - newValue.add(obj); - } - return newValue; - } - return map; - } - - @Override - public Settings getByPrefix(String prefix) { - Builder builder = new Builder(); - for (Map.Entry entry : getAsMap().entrySet()) { - if (entry.getKey().startsWith(prefix)) { - if (entry.getKey().length() < prefix.length()) { - // ignore this. one - continue; - } - builder.put(entry.getKey().substring(prefix.length()), entry.getValue()); - } - } - builder.classLoader(classLoader); - return builder.build(); - } - - @Override - public Settings getAsSettings(String setting) { - return getByPrefix(setting + "."); - } - - @Override - public String get(String setting) { - String retVal = settings.get(setting); - if (retVal != null) { - return retVal; - } - return forcedUnderscoreSettings.get(setting); - } - - @Override - public String get(String[] settings) { - for (String setting : settings) { - String retVal = get(setting); - if (retVal != null) { - return retVal; - } - } - return null; - } - - @Override - public String get(String setting, String defaultValue) { - String retVal = get(setting); - return retVal == null ? defaultValue : retVal; - } - - @Override - public String get(String[] settings, String defaultValue) { - String retVal = get(settings); - return retVal == null ? defaultValue : retVal; - } - - @Override - public Float getAsFloat(String setting, Float defaultValue) { - String sValue = get(setting); - if (sValue == null) { - return defaultValue; - } - try { - return Float.parseFloat(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse float setting [" + setting + "] with value [" + sValue + "]", e); - } - } - - @Override - public Float getAsFloat(String[] settings, Float defaultValue) throws SettingsException { - String sValue = get(settings); - if (sValue == null) { - return defaultValue; - } - try { - return Float.parseFloat(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse float setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); - } - } - - @Override - public Double getAsDouble(String setting, Double defaultValue) { - String sValue = get(setting); - if (sValue == null) { - return defaultValue; - } - try { - return Double.parseDouble(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse double setting [" + setting + "] with value [" + sValue + "]", e); - } - } - - @Override - public Double getAsDouble(String[] settings, Double defaultValue) { - String sValue = get(settings); - if (sValue == null) { - return defaultValue; - } - try { - return Double.parseDouble(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse double setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); - } - } - - - @Override - public Integer getAsInt(String setting, Integer defaultValue) { - String sValue = get(setting); - if (sValue == null) { - return defaultValue; - } - try { - return Integer.parseInt(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse int setting [" + setting + "] with value [" + sValue + "]", e); - } - } - - @Override - public Integer getAsInt(String[] settings, Integer defaultValue) { - String sValue = get(settings); - if (sValue == null) { - return defaultValue; - } - try { - return Integer.parseInt(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse int setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); - } - } - - @Override - public Long getAsLong(String setting, Long defaultValue) { - String sValue = get(setting); - if (sValue == null) { - return defaultValue; - } - try { - return Long.parseLong(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse long setting [" + setting + "] with value [" + sValue + "]", e); - } - } - - @Override - public Long getAsLong(String[] settings, Long defaultValue) { - String sValue = get(settings); - if (sValue == null) { - return defaultValue; - } - try { - return Long.parseLong(sValue); - } catch (NumberFormatException e) { - throw new SettingsException("Failed to parse long setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); - } - } - - @Override - public Boolean getAsBoolean(String setting, Boolean defaultValue) { - return Booleans.parseBoolean(get(setting), defaultValue); - } - - @Override - public Boolean getAsBoolean(String[] settings, Boolean defaultValue) { - return Booleans.parseBoolean(get(settings), defaultValue); - } - - @Override - public TimeValue getAsTime(String setting, TimeValue defaultValue) { - return parseTimeValue(get(setting), defaultValue); - } - - @Override - public TimeValue getAsTime(String[] settings, TimeValue defaultValue) { - return parseTimeValue(get(settings), defaultValue); - } - - @Override - public ByteSizeValue getAsBytesSize(String setting, ByteSizeValue defaultValue) throws SettingsException { - return parseBytesSizeValue(get(setting), defaultValue); - } - - @Override - public ByteSizeValue getAsBytesSize(String[] settings, ByteSizeValue defaultValue) throws SettingsException { - return parseBytesSizeValue(get(settings), defaultValue); - } - - @Override - public ByteSizeValue getAsMemory(String setting, String defaultValue) throws SettingsException { - return MemorySizeValue.parseBytesSizeValueOrHeapRatio(get(setting, defaultValue)); - } - - @Override - public ByteSizeValue getAsMemory(String[] settings, String defaultValue) throws SettingsException { - return MemorySizeValue.parseBytesSizeValueOrHeapRatio(get(settings, defaultValue)); - } - - @Override - public RatioValue getAsRatio(String setting, String defaultValue) throws SettingsException { - return RatioValue.parseRatioValue(get(setting, defaultValue)); - } - - @Override - public RatioValue getAsRatio(String[] settings, String defaultValue) throws SettingsException { - return RatioValue.parseRatioValue(get(settings, defaultValue)); - } - - @Override - public SizeValue getAsSize(String setting, SizeValue defaultValue) throws SettingsException { - return parseSizeValue(get(setting), defaultValue); - } - - @Override - public SizeValue getAsSize(String[] settings, SizeValue defaultValue) throws SettingsException { - return parseSizeValue(get(settings), defaultValue); - } - - @SuppressWarnings({"unchecked"}) - @Override - public Class getAsClass(String setting, Class defaultClazz) throws NoClassSettingsException { - String sValue = get(setting); - if (sValue == null) { - return defaultClazz; - } - try { - return (Class) getClassLoader().loadClass(sValue); - } catch (ClassNotFoundException e) { - throw new NoClassSettingsException("Failed to load class setting [" + setting + "] with value [" + sValue + "]", e); - } - } - - @SuppressWarnings({"unchecked"}) - @Override - public Class getAsClass(String setting, Class defaultClazz, String prefixPackage, String suffixClassName) throws NoClassSettingsException { - String sValue = get(setting); - if (sValue == null) { - return defaultClazz; - } - String fullClassName = sValue; - try { - return (Class) getClassLoader().loadClass(fullClassName); - } catch (ClassNotFoundException e) { - String prefixValue = prefixPackage; - int packageSeparator = sValue.lastIndexOf('.'); - if (packageSeparator > 0) { - prefixValue = sValue.substring(0, packageSeparator + 1); - sValue = sValue.substring(packageSeparator + 1); - } - fullClassName = prefixValue + Strings.capitalize(toCamelCase(sValue)) + suffixClassName; - try { - return (Class) getClassLoader().loadClass(fullClassName); - } catch (ClassNotFoundException e1) { - return loadClass(prefixValue, sValue, suffixClassName, setting); - } catch (NoClassDefFoundError e1) { - return loadClass(prefixValue, sValue, suffixClassName, setting); - } - } - } - - private Class loadClass(String prefixValue, String sValue, String suffixClassName, String setting) { - String fullClassName = prefixValue + toCamelCase(sValue).toLowerCase(Locale.ROOT) + "." + Strings.capitalize(toCamelCase(sValue)) + suffixClassName; - try { - return (Class) getClassLoader().loadClass(fullClassName); - } catch (ClassNotFoundException e2) { - throw new NoClassSettingsException("Failed to load class setting [" + setting + "] with value [" + get(setting) + "]", e2); - } - } - - @Override - public String[] getAsArray(String settingPrefix) throws SettingsException { - return getAsArray(settingPrefix, Strings.EMPTY_ARRAY, true); - } - - @Override - public String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException { - return getAsArray(settingPrefix, defaultArray, true); - } - - @Override - public String[] getAsArray(String settingPrefix, String[] defaultArray, Boolean commaDelimited) throws SettingsException { - List result = Lists.newArrayList(); - - if (get(settingPrefix) != null) { - if (commaDelimited) { - String[] strings = Strings.splitStringByCommaToArray(get(settingPrefix)); - if (strings.length > 0) { - for (String string : strings) { - result.add(string.trim()); - } - } - } else { - result.add(get(settingPrefix).trim()); - } - } - - int counter = 0; - while (true) { - String value = get(settingPrefix + '.' + (counter++)); - if (value == null) { - break; - } - result.add(value.trim()); - } - if (result.isEmpty()) { - return defaultArray; - } - return result.toArray(new String[result.size()]); - } - - @Override - public Map getGroups(String settingPrefix) throws SettingsException { - return getGroups(settingPrefix, false); - } - - @Override - public Map getGroups(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException { - if (!Strings.hasLength(settingPrefix)) { - throw new IllegalArgumentException("illegal setting prefix " + settingPrefix); - } - if (settingPrefix.charAt(settingPrefix.length() - 1) != '.') { - settingPrefix = settingPrefix + "."; - } - // we don't really care that it might happen twice - Map> map = new LinkedHashMap<>(); - for (Object o : settings.keySet()) { - String setting = (String) o; - if (setting.startsWith(settingPrefix)) { - String nameValue = setting.substring(settingPrefix.length()); - int dotIndex = nameValue.indexOf('.'); - if (dotIndex == -1) { - if (ignoreNonGrouped) { - continue; - } - throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting [" + setting + "] because of a missing '.'"); - } - String name = nameValue.substring(0, dotIndex); - String value = nameValue.substring(dotIndex + 1); - Map groupSettings = map.get(name); - if (groupSettings == null) { - groupSettings = new LinkedHashMap<>(); - map.put(name, groupSettings); - } - groupSettings.put(value, get(setting)); - } - } - Map retVal = new LinkedHashMap<>(); - for (Map.Entry> entry : map.entrySet()) { - retVal.put(entry.getKey(), new ImmutableSettings(Collections.unmodifiableMap(entry.getValue()), classLoader)); - } - return Collections.unmodifiableMap(retVal); - } - - @Override - public Version getAsVersion(String setting, Version defaultVersion) throws SettingsException { - String sValue = get(setting); - if (sValue == null) { - return defaultVersion; - } - try { - return Version.fromId(Integer.parseInt(sValue)); - } catch (Exception e) { - throw new SettingsException("Failed to parse version setting [" + setting + "] with value [" + sValue + "]", e); - } - } - - @Override - public Set names() { - Set names = new HashSet<>(); - for (String key : settings.keySet()) { - int i = key.indexOf("."); - if (i < 0) { - names.add(key); - } else { - names.add(key.substring(0, i)); - } - } - return names; - } - - @Override - public String toDelimitedString(char delimiter) { - StringBuilder sb = new StringBuilder(); - for (Map.Entry entry : settings.entrySet()) { - sb.append(entry.getKey()).append("=").append(entry.getValue()).append(delimiter); - } - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ImmutableSettings that = (ImmutableSettings) o; - - if (classLoader != null ? !classLoader.equals(that.classLoader) : that.classLoader != null) return false; - if (settings != null ? !settings.equals(that.settings) : that.settings != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = settings != null ? settings.hashCode() : 0; - result = 31 * result + (classLoader != null ? classLoader.hashCode() : 0); - return result; - } - - public static Settings readSettingsFromStream(StreamInput in) throws IOException { - Builder builder = new Builder(); - int numberOfSettings = in.readVInt(); - for (int i = 0; i < numberOfSettings; i++) { - builder.put(in.readString(), in.readString()); - } - return builder.build(); - } - - public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException { - out.writeVInt(settings.getAsMap().size()); - for (Map.Entry entry : settings.getAsMap().entrySet()) { - out.writeString(entry.getKey()); - out.writeString(entry.getValue()); - } - } - - public static Builder builder() { - return new Builder(); - } - - /** - * Returns a builder to be used in order to build settings. - */ - public static Builder settingsBuilder() { - return new Builder(); - } - - @Override - public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - Settings settings = SettingsFilter.filterSettings(params, this); - if (!params.paramAsBoolean("flat_settings", false)) { - for (Map.Entry entry : settings.getAsStructuredMap().entrySet()) { - builder.field(entry.getKey(), entry.getValue()); - } - } else { - for (Map.Entry entry : settings.getAsMap().entrySet()) { - builder.field(entry.getKey(), entry.getValue(), XContentBuilder.FieldCaseConversion.NONE); - } - } - return builder; - } - - /** - * A builder allowing to put different settings and then {@link #build()} an immutable - * settings implementation. Use {@link ImmutableSettings#settingsBuilder()} in order to - * construct it. - */ - public static class Builder implements Settings.Builder { - - public static final Settings EMPTY_SETTINGS = new Builder().build(); - - private final Map map = new LinkedHashMap<>(); - - private ClassLoader classLoader; - - private Builder() { - - } - - public Map internalMap() { - return this.map; - } - - /** - * Removes the provided setting from the internal map holding the current list of settings. - */ - public String remove(String key) { - return map.remove(key); - } - - /** - * Returns a setting value based on the setting key. - */ - public String get(String key) { - String retVal = map.get(key); - if (retVal != null) { - return retVal; - } - // try camel case version - return map.get(toCamelCase(key)); - } - - /** - * Puts tuples of key value pairs of settings. Simplified version instead of repeating calling - * put for each one. - */ - public Builder put(Object... settings) { - if (settings.length == 1) { - // support cases where the actual type gets lost down the road... - if (settings[0] instanceof Map) { - //noinspection unchecked - return put((Map) settings[0]); - } else if (settings[0] instanceof Settings) { - return put((Settings) settings[0]); - } - } - if ((settings.length % 2) != 0) { - throw new IllegalArgumentException("array settings of key + value order doesn't hold correct number of arguments (" + settings.length + ")"); - } - for (int i = 0; i < settings.length; i++) { - put(settings[i++].toString(), settings[i].toString()); - } - return this; - } - - /** - * Sets a setting with the provided setting key and value. - * - * @param key The setting key - * @param value The setting value - * @return The builder - */ - public Builder put(String key, String value) { - map.put(key, value); - return this; - } - - /** - * Sets a setting with the provided setting key and class as value. - * - * @param key The setting key - * @param clazz The setting class value - * @return The builder - */ - public Builder put(String key, Class clazz) { - map.put(key, clazz.getName()); - return this; - } - - /** - * Sets the setting with the provided setting key and the boolean value. - * - * @param setting The setting key - * @param value The boolean value - * @return The builder - */ - public Builder put(String setting, boolean value) { - put(setting, String.valueOf(value)); - return this; - } - - /** - * Sets the setting with the provided setting key and the int value. - * - * @param setting The setting key - * @param value The int value - * @return The builder - */ - public Builder put(String setting, int value) { - put(setting, String.valueOf(value)); - return this; - } - - public Builder put(String setting, Version version) { - put(setting, version.id); - return this; - } - - /** - * Sets the setting with the provided setting key and the long value. - * - * @param setting The setting key - * @param value The long value - * @return The builder - */ - public Builder put(String setting, long value) { - put(setting, String.valueOf(value)); - return this; - } - - /** - * Sets the setting with the provided setting key and the float value. - * - * @param setting The setting key - * @param value The float value - * @return The builder - */ - public Builder put(String setting, float value) { - put(setting, String.valueOf(value)); - return this; - } - - /** - * Sets the setting with the provided setting key and the double value. - * - * @param setting The setting key - * @param value The double value - * @return The builder - */ - public Builder put(String setting, double value) { - put(setting, String.valueOf(value)); - return this; - } - - /** - * Sets the setting with the provided setting key and the time value. - * - * @param setting The setting key - * @param value The time value - * @return The builder - */ - public Builder put(String setting, long value, TimeUnit timeUnit) { - put(setting, timeUnit.toMillis(value)); - return this; - } - - /** - * Sets the setting with the provided setting key and the size value. - * - * @param setting The setting key - * @param value The size value - * @return The builder - */ - public Builder put(String setting, long value, ByteSizeUnit sizeUnit) { - put(setting, sizeUnit.toBytes(value)); - return this; - } - - /** - * Sets the setting with the provided setting key and an array of values. - * - * @param setting The setting key - * @param values The values - * @return The builder - */ - public Builder putArray(String setting, String... values) { - remove(setting); - int counter = 0; - while (true) { - String value = map.remove(setting + '.' + (counter++)); - if (value == null) { - break; - } - } - for (int i = 0; i < values.length; i++) { - put(setting + "." + i, values[i]); - } - return this; - } - - /** - * Sets the setting group. - */ - public Builder put(String settingPrefix, String groupName, String[] settings, String[] values) throws SettingsException { - if (settings.length != values.length) { - throw new SettingsException("The settings length must match the value length"); - } - for (int i = 0; i < settings.length; i++) { - if (values[i] == null) { - continue; - } - put(settingPrefix + "." + groupName + "." + settings[i], values[i]); - } - return this; - } - - /** - * Sets all the provided settings. - */ - public Builder put(Settings settings) { - removeNonArraysFieldsIfNewSettingsContainsFieldAsArray(settings.getAsMap()); - map.putAll(settings.getAsMap()); - classLoader = settings.getClassLoaderIfSet(); - return this; - } - - /** - * Sets all the provided settings. - */ - public Builder put(Map settings) { - removeNonArraysFieldsIfNewSettingsContainsFieldAsArray(settings); - map.putAll(settings); - return this; - } - - /** - * Removes non array values from the existing map, if settings contains an array value instead - * - * Example: - * Existing map contains: {key:value} - * New map contains: {key:[value1,value2]} (which has been flattened to {}key.0:value1,key.1:value2}) - * - * This ensure that that the 'key' field gets removed from the map in order to override all the - * data instead of merging - */ - private void removeNonArraysFieldsIfNewSettingsContainsFieldAsArray(Map settings) { - List prefixesToRemove = new ArrayList<>(); - for (final Map.Entry entry : settings.entrySet()) { - final Matcher matcher = ARRAY_PATTERN.matcher(entry.getKey()); - if (matcher.matches()) { - prefixesToRemove.add(matcher.group(1)); - } else if (Iterables.any(map.keySet(), startsWith(entry.getKey() + "."))) { - prefixesToRemove.add(entry.getKey()); - } - } - for (String prefix : prefixesToRemove) { - Iterator> iterator = map.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - if (entry.getKey().startsWith(prefix + ".") || entry.getKey().equals(prefix)) { - iterator.remove(); - } - } - } - } - - /** - * Sets all the provided settings. - */ - public Builder put(Properties properties) { - for (Map.Entry entry : properties.entrySet()) { - map.put((String) entry.getKey(), (String) entry.getValue()); - } - return this; - } - - public Builder loadFromDelimitedString(String value, char delimiter) { - String[] values = Strings.splitStringToArray(value, delimiter); - for (String s : values) { - int index = s.indexOf('='); - if (index == -1) { - throw new IllegalArgumentException("value [" + s + "] for settings loaded with delimiter [" + delimiter + "] is malformed, missing ="); - } - map.put(s.substring(0, index), s.substring(index + 1)); - } - return this; - } - - /** - * Loads settings from the actual string content that represents them using the - * {@link SettingsLoaderFactory#loaderFromSource(String)}. - */ - public Builder loadFromSource(String source) { - SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromSource(source); - try { - Map loadedSettings = settingsLoader.load(source); - put(loadedSettings); - } catch (Exception e) { - throw new SettingsException("Failed to load settings from [" + source + "]", e); - } - return this; - } - - /** - * Loads settings from a url that represents them using the - * {@link SettingsLoaderFactory#loaderFromSource(String)}. - */ - public Builder loadFromUrl(URL url) throws SettingsException { - try { - return loadFromStream(url.toExternalForm(), url.openStream()); - } catch (IOException e) { - throw new SettingsException("Failed to open stream for url [" + url.toExternalForm() + "]", e); - } - } - - /** - * Loads settings from a url that represents them using the - * {@link SettingsLoaderFactory#loaderFromSource(String)}. - */ - public Builder loadFromPath(Path path) throws SettingsException { - try { - return loadFromStream(path.getFileName().toString(), Files.newInputStream(path)); - } catch (IOException e) { - throw new SettingsException("Failed to open stream for url [" + path + "]", e); - } - } - - /** - * Loads settings from a stream that represents them using the - * {@link SettingsLoaderFactory#loaderFromSource(String)}. - */ - public Builder loadFromStream(String resourceName, InputStream is) throws SettingsException { - SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromResource(resourceName); - try { - Map loadedSettings = settingsLoader.load(Streams.copyToString(new InputStreamReader(is, Charsets.UTF_8))); - put(loadedSettings); - } catch (Exception e) { - throw new SettingsException("Failed to load settings from [" + resourceName + "]", e); - } - return this; - } - - /** - * Loads settings from classpath that represents them using the - * {@link SettingsLoaderFactory#loaderFromSource(String)}. - */ - public Builder loadFromClasspath(String resourceName) throws SettingsException { - ClassLoader classLoader = this.classLoader; - if (classLoader == null) { - classLoader = Classes.getDefaultClassLoader(); - } - InputStream is = classLoader.getResourceAsStream(resourceName); - if (is == null) { - return this; - } - - return loadFromStream(resourceName, is); - } - - /** - * Sets the class loader associated with the settings built. - */ - public Builder classLoader(ClassLoader classLoader) { - this.classLoader = classLoader; - return this; - } - - /** - * Puts all the properties with keys starting with the provided prefix. - * - * @param prefix The prefix to filter property key by - * @param properties The properties to put - * @return The builder - */ - public Builder putProperties(String prefix, Properties properties) { - for (Object key1 : properties.keySet()) { - String key = (String) key1; - String value = properties.getProperty(key); - if (key.startsWith(prefix)) { - map.put(key.substring(prefix.length()), value); - } - } - return this; - } - - /** - * Puts all the properties with keys starting with the provided prefix. - * - * @param prefix The prefix to filter property key by - * @param properties The properties to put - * @return The builder - */ - public Builder putProperties(String prefix, Properties properties, String[] ignorePrefixes) { - for (Object key1 : properties.keySet()) { - String key = (String) key1; - String value = properties.getProperty(key); - if (key.startsWith(prefix)) { - boolean ignore = false; - for (String ignorePrefix : ignorePrefixes) { - if (key.startsWith(ignorePrefix)) { - ignore = true; - break; - } - } - if (!ignore) { - map.put(key.substring(prefix.length()), value); - } - } - } - return this; - } - - /** - * Runs across all the settings set on this builder and replaces ${...} elements in the - * each setting value according to the following logic: - *

- *

First, tries to resolve it against a System property ({@link System#getProperty(String)}), next, - * tries and resolve it against an environment variable ({@link System#getenv(String)}), and last, tries - * and replace it with another setting already set on this builder. - */ - public Builder replacePropertyPlaceholders() { - PropertyPlaceholder propertyPlaceholder = new PropertyPlaceholder("${", "}", false); - PropertyPlaceholder.PlaceholderResolver placeholderResolver = new PropertyPlaceholder.PlaceholderResolver() { - @Override - public String resolvePlaceholder(String placeholderName) { - if (placeholderName.startsWith("env.")) { - // explicit env var prefix - return System.getenv(placeholderName.substring("env.".length())); - } - String value = System.getProperty(placeholderName); - if (value != null) { - return value; - } - value = System.getenv(placeholderName); - if (value != null) { - return value; - } - return map.get(placeholderName); - } - - @Override - public boolean shouldIgnoreMissing(String placeholderName) { - // if its an explicit env var, we are ok with not having a value for it and treat it as optional - if (placeholderName.startsWith("env.")) { - return true; - } - return false; - } - }; - for (Map.Entry entry : Maps.newHashMap(map).entrySet()) { - String value = propertyPlaceholder.replacePlaceholders(entry.getValue(), placeholderResolver); - // if the values exists and has length, we should maintain it in the map - // otherwise, the replace process resolved into removing it - if (Strings.hasLength(value)) { - map.put(entry.getKey(), value); - } else { - map.remove(entry.getKey()); - } - } - return this; - } - - /** - * Checks that all settings in the builder start with the specified prefix. - * - * If a setting doesn't start with the prefix, the builder appends the prefix to such setting. - */ - public Builder normalizePrefix(String prefix) { - Map replacements = Maps.newHashMap(); - Iterator> iterator = map.entrySet().iterator(); - while(iterator.hasNext()) { - Map.Entry entry = iterator.next(); - if (entry.getKey().startsWith(prefix) == false) { - replacements.put(prefix + entry.getKey(), entry.getValue()); - iterator.remove(); - } - } - map.putAll(replacements); - return this; - } - - /** - * Builds a {@link Settings} (underlying uses {@link ImmutableSettings}) based on everything - * set on this builder. - */ - @Override - public Settings build() { - return new ImmutableSettings(Collections.unmodifiableMap(map), classLoader); - } - } - - private static StartsWithPredicate startsWith(String prefix) { - return new StartsWithPredicate(prefix); - } - - private static final class StartsWithPredicate implements Predicate { - - private String prefix; - - public StartsWithPredicate(String prefix) { - this.prefix = prefix; - } - - @Override - public boolean apply(String input) { - return input.startsWith(prefix); - } - } -} diff --git a/src/main/java/org/elasticsearch/common/settings/Settings.java b/src/main/java/org/elasticsearch/common/settings/Settings.java index 5a62ea714aa..67bd3b00f44 100644 --- a/src/main/java/org/elasticsearch/common/settings/Settings.java +++ b/src/main/java/org/elasticsearch/common/settings/Settings.java @@ -19,59 +19,208 @@ package org.elasticsearch.common.settings; +import com.google.common.base.Charsets; +import com.google.common.base.Predicate; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.elasticsearch.Version; -import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.common.unit.RatioValue; -import org.elasticsearch.common.unit.SizeValue; -import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.common.Booleans; +import org.elasticsearch.common.Classes; +import org.elasticsearch.common.Strings; +import org.elasticsearch.common.io.Streams; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.property.PropertyPlaceholder; +import org.elasticsearch.common.settings.loader.SettingsLoader; +import org.elasticsearch.common.settings.loader.SettingsLoaderFactory; +import org.elasticsearch.common.unit.*; import org.elasticsearch.common.xcontent.ToXContent; +import org.elasticsearch.common.xcontent.XContentBuilder; -import java.util.Map; -import java.util.Set; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static org.elasticsearch.common.Strings.toCamelCase; +import static org.elasticsearch.common.unit.ByteSizeValue.parseBytesSizeValue; +import static org.elasticsearch.common.unit.SizeValue.parseSizeValue; +import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; /** - * Immutable settings allowing to control the configuration. - *

- *

Using {@link ImmutableSettings#settingsBuilder()} in order to create a builder - * which in turn can create an immutable implementation of settings. - * - * @see ImmutableSettings + * An immutable {@code Settings} implementation. */ -public interface Settings extends ToXContent { +public final class Settings implements ToXContent { - /** - * A settings that are filtered (and key is removed) with the specified prefix. - */ - Settings getByPrefix(String prefix); + public static final Settings EMPTY = new Builder().build(); + private final static Pattern ARRAY_PATTERN = Pattern.compile("(.*)\\.\\d+$"); - /** - * Returns the settings mapped to the given setting name. - */ - Settings getAsSettings(String setting); + private ImmutableMap settings; + private final ImmutableMap forcedUnderscoreSettings; + private transient ClassLoader classLoader; + + Settings(Map settings, ClassLoader classLoader) { + this.settings = ImmutableMap.copyOf(settings); + Map forcedUnderscoreSettings = null; + for (Map.Entry entry : settings.entrySet()) { + String toUnderscoreCase = Strings.toUnderscoreCase(entry.getKey()); + if (!toUnderscoreCase.equals(entry.getKey())) { + if (forcedUnderscoreSettings == null) { + forcedUnderscoreSettings = new HashMap<>(); + } + forcedUnderscoreSettings.put(toUnderscoreCase, entry.getValue()); + } + } + this.forcedUnderscoreSettings = forcedUnderscoreSettings == null ? ImmutableMap.of() : ImmutableMap.copyOf(forcedUnderscoreSettings); + this.classLoader = classLoader; + } /** * The class loader associated with this settings, or {@link org.elasticsearch.common.Classes#getDefaultClassLoader()} * if not set. */ - ClassLoader getClassLoader(); + public ClassLoader getClassLoader() { + return this.classLoader == null ? Classes.getDefaultClassLoader() : classLoader; + } /** * The class loader associated with this settings, but only if explicitly set, otherwise null. */ - @Nullable - ClassLoader getClassLoaderIfSet(); + public ClassLoader getClassLoaderIfSet() { + return this.classLoader; + } /** * The settings as a flat {@link java.util.Map}. */ - ImmutableMap getAsMap(); + public ImmutableMap getAsMap() { + return this.settings; + } /** * The settings as a structured {@link java.util.Map}. */ - Map getAsStructuredMap(); + public Map getAsStructuredMap() { + Map map = Maps.newHashMapWithExpectedSize(2); + for (Map.Entry entry : settings.entrySet()) { + processSetting(map, "", entry.getKey(), entry.getValue()); + } + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() instanceof Map) { + @SuppressWarnings("unchecked") Map valMap = (Map) entry.getValue(); + entry.setValue(convertMapsToArrays(valMap)); + } + } + + return map; + } + + private void processSetting(Map map, String prefix, String setting, String value) { + int prefixLength = setting.indexOf('.'); + if (prefixLength == -1) { + @SuppressWarnings("unchecked") Map innerMap = (Map) map.get(prefix + setting); + if (innerMap != null) { + // It supposed to be a value, but we already have a map stored, need to convert this map to "." notation + for (Map.Entry entry : innerMap.entrySet()) { + map.put(prefix + setting + "." + entry.getKey(), entry.getValue()); + } + } + map.put(prefix + setting, value); + } else { + String key = setting.substring(0, prefixLength); + String rest = setting.substring(prefixLength + 1); + Object existingValue = map.get(prefix + key); + if (existingValue == null) { + Map newMap = Maps.newHashMapWithExpectedSize(2); + processSetting(newMap, "", rest, value); + map.put(key, newMap); + } else { + if (existingValue instanceof Map) { + @SuppressWarnings("unchecked") + Map innerMap = (Map) existingValue; + processSetting(innerMap, "", rest, value); + map.put(key, innerMap); + } else { + // It supposed to be a map, but we already have a value stored, which is not a map + // fall back to "." notation + processSetting(map, prefix + key + ".", rest, value); + } + } + } + } + + private Object convertMapsToArrays(Map map) { + if (map.isEmpty()) { + return map; + } + boolean isArray = true; + int maxIndex = -1; + for (Map.Entry entry : map.entrySet()) { + if (isArray) { + try { + int index = Integer.parseInt(entry.getKey()); + if (index >= 0) { + maxIndex = Math.max(maxIndex, index); + } else { + isArray = false; + } + } catch (NumberFormatException ex) { + isArray = false; + } + } + if (entry.getValue() instanceof Map) { + @SuppressWarnings("unchecked") Map valMap = (Map) entry.getValue(); + entry.setValue(convertMapsToArrays(valMap)); + } + } + if (isArray && (maxIndex + 1) == map.size()) { + ArrayList newValue = Lists.newArrayListWithExpectedSize(maxIndex + 1); + for (int i = 0; i <= maxIndex; i++) { + Object obj = map.get(Integer.toString(i)); + if (obj == null) { + // Something went wrong. Different format? + // Bailout! + return map; + } + newValue.add(obj); + } + return newValue; + } + return map; + } + + /** + * A settings that are filtered (and key is removed) with the specified prefix. + */ + public Settings getByPrefix(String prefix) { + Builder builder = new Builder(); + for (Map.Entry entry : getAsMap().entrySet()) { + if (entry.getKey().startsWith(prefix)) { + if (entry.getKey().length() < prefix.length()) { + // ignore this. one + continue; + } + builder.put(entry.getKey().substring(prefix.length()), entry.getValue()); + } + } + builder.classLoader(classLoader); + return builder.build(); + } + + /** + * Returns the settings mapped to the given setting name. + */ + public Settings getAsSettings(String setting) { + return getByPrefix(setting + "."); + } /** * Returns the setting value associated with the setting key. @@ -79,158 +228,273 @@ public interface Settings extends ToXContent { * @param setting The setting key * @return The setting value, null if it does not exists. */ - String get(String setting); + public String get(String setting) { + String retVal = settings.get(setting); + if (retVal != null) { + return retVal; + } + return forcedUnderscoreSettings.get(setting); + } /** * Returns the setting value associated with the first setting key. */ - String get(String[] settings); + public String get(String[] settings) { + for (String setting : settings) { + String retVal = get(setting); + if (retVal != null) { + return retVal; + } + } + return null; + } /** * Returns the setting value associated with the setting key. If it does not exists, * returns the default value provided. */ - String get(String setting, String defaultValue); + public String get(String setting, String defaultValue) { + String retVal = get(setting); + return retVal == null ? defaultValue : retVal; + } /** * Returns the setting value associated with the first setting key, if none exists, * returns the default value provided. */ - String get(String[] settings, String defaultValue); - - /** - * Returns group settings for the given setting prefix. - */ - Map getGroups(String settingPrefix) throws SettingsException; - - /** - * Returns group settings for the given setting prefix. - */ - Map getGroups(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException; + public String get(String[] settings, String defaultValue) { + String retVal = get(settings); + return retVal == null ? defaultValue : retVal; + } /** * Returns the setting value (as float) associated with the setting key. If it does not exists, * returns the default value provided. */ - Float getAsFloat(String setting, Float defaultValue) throws SettingsException; + public Float getAsFloat(String setting, Float defaultValue) { + String sValue = get(setting); + if (sValue == null) { + return defaultValue; + } + try { + return Float.parseFloat(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse float setting [" + setting + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as float) associated with teh first setting key, if none * exists, returns the default value provided. */ - Float getAsFloat(String[] settings, Float defaultValue) throws SettingsException; + public Float getAsFloat(String[] settings, Float defaultValue) throws SettingsException { + String sValue = get(settings); + if (sValue == null) { + return defaultValue; + } + try { + return Float.parseFloat(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse float setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as double) associated with the setting key. If it does not exists, * returns the default value provided. */ - Double getAsDouble(String setting, Double defaultValue) throws SettingsException; + public Double getAsDouble(String setting, Double defaultValue) { + String sValue = get(setting); + if (sValue == null) { + return defaultValue; + } + try { + return Double.parseDouble(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse double setting [" + setting + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as double) associated with teh first setting key, if none * exists, returns the default value provided. */ - Double getAsDouble(String[] settings, Double defaultValue) throws SettingsException; + public Double getAsDouble(String[] settings, Double defaultValue) { + String sValue = get(settings); + if (sValue == null) { + return defaultValue; + } + try { + return Double.parseDouble(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse double setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); + } + } + /** * Returns the setting value (as int) associated with the setting key. If it does not exists, * returns the default value provided. */ - Integer getAsInt(String setting, Integer defaultValue) throws SettingsException; + public Integer getAsInt(String setting, Integer defaultValue) { + String sValue = get(setting); + if (sValue == null) { + return defaultValue; + } + try { + return Integer.parseInt(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse int setting [" + setting + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as int) associated with the first setting key. If it does not exists, * returns the default value provided. */ - Integer getAsInt(String[] settings, Integer defaultValue) throws SettingsException; + public Integer getAsInt(String[] settings, Integer defaultValue) { + String sValue = get(settings); + if (sValue == null) { + return defaultValue; + } + try { + return Integer.parseInt(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse int setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as long) associated with the setting key. If it does not exists, * returns the default value provided. */ - Long getAsLong(String setting, Long defaultValue) throws SettingsException; + public Long getAsLong(String setting, Long defaultValue) { + String sValue = get(setting); + if (sValue == null) { + return defaultValue; + } + try { + return Long.parseLong(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse long setting [" + setting + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as long) associated with the setting key. If it does not exists, * returns the default value provided. */ - Long getAsLong(String[] settings, Long defaultValue) throws SettingsException; + public Long getAsLong(String[] settings, Long defaultValue) { + String sValue = get(settings); + if (sValue == null) { + return defaultValue; + } + try { + return Long.parseLong(sValue); + } catch (NumberFormatException e) { + throw new SettingsException("Failed to parse long setting [" + Arrays.toString(settings) + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as boolean) associated with the setting key. If it does not exists, * returns the default value provided. */ - Boolean getAsBoolean(String setting, Boolean defaultValue) throws SettingsException; + public Boolean getAsBoolean(String setting, Boolean defaultValue) { + return Booleans.parseBoolean(get(setting), defaultValue); + } /** * Returns the setting value (as boolean) associated with the setting key. If it does not exists, * returns the default value provided. */ - Boolean getAsBoolean(String[] settings, Boolean defaultValue) throws SettingsException; + public Boolean getAsBoolean(String[] settings, Boolean defaultValue) { + return Booleans.parseBoolean(get(settings), defaultValue); + } /** * Returns the setting value (as time) associated with the setting key. If it does not exists, * returns the default value provided. */ - TimeValue getAsTime(String setting, TimeValue defaultValue) throws SettingsException; + public TimeValue getAsTime(String setting, TimeValue defaultValue) { + return parseTimeValue(get(setting), defaultValue); + } /** * Returns the setting value (as time) associated with the setting key. If it does not exists, * returns the default value provided. */ - TimeValue getAsTime(String[] settings, TimeValue defaultValue) throws SettingsException; + public TimeValue getAsTime(String[] settings, TimeValue defaultValue) { + return parseTimeValue(get(settings), defaultValue); + } /** * Returns the setting value (as size) associated with the setting key. If it does not exists, * returns the default value provided. */ - ByteSizeValue getAsBytesSize(String setting, ByteSizeValue defaultValue) throws SettingsException; + public ByteSizeValue getAsBytesSize(String setting, ByteSizeValue defaultValue) throws SettingsException { + return parseBytesSizeValue(get(setting), defaultValue); + } /** * Returns the setting value (as size) associated with the setting key. If it does not exists, * returns the default value provided. */ - ByteSizeValue getAsBytesSize(String[] settings, ByteSizeValue defaultValue) throws SettingsException; + public ByteSizeValue getAsBytesSize(String[] settings, ByteSizeValue defaultValue) throws SettingsException { + return parseBytesSizeValue(get(settings), defaultValue); + } /** * Returns the setting value (as size) associated with the setting key. Provided values can either be * absolute values (intepreted as a number of bytes), byte sizes (eg. 1mb) or percentage of the heap size * (eg. 12%). If it does not exists, parses the default value provided. */ - ByteSizeValue getAsMemory(String setting, String defaultValue) throws SettingsException; + public ByteSizeValue getAsMemory(String setting, String defaultValue) throws SettingsException { + return MemorySizeValue.parseBytesSizeValueOrHeapRatio(get(setting, defaultValue)); + } /** * Returns the setting value (as size) associated with the setting key. Provided values can either be * absolute values (intepreted as a number of bytes), byte sizes (eg. 1mb) or percentage of the heap size * (eg. 12%). If it does not exists, parses the default value provided. */ - ByteSizeValue getAsMemory(String[] setting, String defaultValue) throws SettingsException; + public ByteSizeValue getAsMemory(String[] settings, String defaultValue) throws SettingsException { + return MemorySizeValue.parseBytesSizeValueOrHeapRatio(get(settings, defaultValue)); + } /** * Returns the setting value (as a RatioValue) associated with the setting key. Provided values can * either be a percentage value (eg. 23%), or expressed as a floating point number (eg. 0.23). If * it does not exist, parses the default value provided. */ - RatioValue getAsRatio(String setting, String defaultValue) throws SettingsException; + public RatioValue getAsRatio(String setting, String defaultValue) throws SettingsException { + return RatioValue.parseRatioValue(get(setting, defaultValue)); + } /** * Returns the setting value (as a RatioValue) associated with the setting key. Provided values can * either be a percentage value (eg. 23%), or expressed as a floating point number (eg. 0.23). If * it does not exist, parses the default value provided. */ - RatioValue getAsRatio(String[] settings, String defaultValue) throws SettingsException; + public RatioValue getAsRatio(String[] settings, String defaultValue) throws SettingsException { + return RatioValue.parseRatioValue(get(settings, defaultValue)); + } /** * Returns the setting value (as size) associated with the setting key. If it does not exists, * returns the default value provided. */ - SizeValue getAsSize(String setting, SizeValue defaultValue) throws SettingsException; + public SizeValue getAsSize(String setting, SizeValue defaultValue) throws SettingsException { + return parseSizeValue(get(setting), defaultValue); + } /** * Returns the setting value (as size) associated with the setting key. If it does not exists, * returns the default value provided. */ - SizeValue getAsSize(String[] settings, SizeValue defaultValue) throws SettingsException; + public SizeValue getAsSize(String[] settings, SizeValue defaultValue) throws SettingsException { + return parseSizeValue(get(settings), defaultValue); + } /** * Returns the setting value (as a class) associated with the setting key. If it does not exists, @@ -240,9 +504,20 @@ public interface Settings extends ToXContent { * @param defaultClazz The class to return if no value is associated with the setting * @param The type of the class * @return The class setting value, or the default class provided is no value exists - * @throws NoClassSettingsException Failure to load a class + * @throws org.elasticsearch.common.settings.NoClassSettingsException Failure to load a class */ - Class getAsClass(String setting, Class defaultClazz) throws NoClassSettingsException; + @SuppressWarnings({"unchecked"}) + public Class getAsClass(String setting, Class defaultClazz) throws NoClassSettingsException { + String sValue = get(setting); + if (sValue == null) { + return defaultClazz; + } + try { + return (Class) getClassLoader().loadClass(sValue); + } catch (ClassNotFoundException e) { + throw new NoClassSettingsException("Failed to load class setting [" + setting + "] with value [" + sValue + "]", e); + } + } /** * Returns the setting value (as a class) associated with the setting key. If the value itself fails to @@ -255,9 +530,73 @@ public interface Settings extends ToXContent { * @param suffixClassName The suffix class name to prefix the value with if failing to load the class as is * @param The type of the class * @return The class represented by the setting value, or the default class provided if no value exists - * @throws NoClassSettingsException Failure to load the class + * @throws org.elasticsearch.common.settings.NoClassSettingsException Failure to load the class */ - Class getAsClass(String setting, Class defaultClazz, String prefixPackage, String suffixClassName) throws NoClassSettingsException; + @SuppressWarnings({"unchecked"}) + public Class getAsClass(String setting, Class defaultClazz, String prefixPackage, String suffixClassName) throws NoClassSettingsException { + String sValue = get(setting); + if (sValue == null) { + return defaultClazz; + } + String fullClassName = sValue; + try { + return (Class) getClassLoader().loadClass(fullClassName); + } catch (ClassNotFoundException e) { + String prefixValue = prefixPackage; + int packageSeparator = sValue.lastIndexOf('.'); + if (packageSeparator > 0) { + prefixValue = sValue.substring(0, packageSeparator + 1); + sValue = sValue.substring(packageSeparator + 1); + } + fullClassName = prefixValue + Strings.capitalize(toCamelCase(sValue)) + suffixClassName; + try { + return (Class) getClassLoader().loadClass(fullClassName); + } catch (ClassNotFoundException e1) { + return loadClass(prefixValue, sValue, suffixClassName, setting); + } catch (NoClassDefFoundError e1) { + return loadClass(prefixValue, sValue, suffixClassName, setting); + } + } + } + + private Class loadClass(String prefixValue, String sValue, String suffixClassName, String setting) { + String fullClassName = prefixValue + toCamelCase(sValue).toLowerCase(Locale.ROOT) + "." + Strings.capitalize(toCamelCase(sValue)) + suffixClassName; + try { + return (Class) getClassLoader().loadClass(fullClassName); + } catch (ClassNotFoundException e2) { + throw new NoClassSettingsException("Failed to load class setting [" + setting + "] with value [" + get(setting) + "]", e2); + } + } + + /** + * The values associated with a setting prefix as an array. The settings array is in the format of: + * settingPrefix.[index]. + *

+ *

It will also automatically load a comma separated list under the settingPrefix and merge with + * the numbered format. + * + * @param settingPrefix The setting prefix to load the array by + * @return The setting array values + * @throws org.elasticsearch.common.settings.SettingsException + */ + public String[] getAsArray(String settingPrefix) throws SettingsException { + return getAsArray(settingPrefix, Strings.EMPTY_ARRAY, true); + } + + /** + * The values associated with a setting prefix as an array. The settings array is in the format of: + * settingPrefix.[index]. + *

+ *

If commaDelimited is true, it will automatically load a comma separated list under the settingPrefix and merge with + * the numbered format. + * + * @param settingPrefix The setting prefix to load the array by + * @return The setting array values + * @throws org.elasticsearch.common.settings.SettingsException + */ + public String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException { + return getAsArray(settingPrefix, defaultArray, true); + } /** * The values associated with a setting prefix as an array. The settings array is in the format of: @@ -270,59 +609,693 @@ public interface Settings extends ToXContent { * @param defaultArray The default array to use if no value is specified * @param commaDelimited Whether to try to parse a string as a comma-delimited value * @return The setting array values - * @throws SettingsException + * @throws org.elasticsearch.common.settings.SettingsException */ - String[] getAsArray(String settingPrefix, String[] defaultArray, Boolean commaDelimited) throws SettingsException; + public String[] getAsArray(String settingPrefix, String[] defaultArray, Boolean commaDelimited) throws SettingsException { + List result = Lists.newArrayList(); + + if (get(settingPrefix) != null) { + if (commaDelimited) { + String[] strings = Strings.splitStringByCommaToArray(get(settingPrefix)); + if (strings.length > 0) { + for (String string : strings) { + result.add(string.trim()); + } + } + } else { + result.add(get(settingPrefix).trim()); + } + } + + int counter = 0; + while (true) { + String value = get(settingPrefix + '.' + (counter++)); + if (value == null) { + break; + } + result.add(value.trim()); + } + if (result.isEmpty()) { + return defaultArray; + } + return result.toArray(new String[result.size()]); + } /** - * The values associated with a setting prefix as an array. The settings array is in the format of: - * settingPrefix.[index]. - *

- *

If commaDelimited is true, it will automatically load a comma separated list under the settingPrefix and merge with - * the numbered format. - * - * @param settingPrefix The setting prefix to load the array by - * @return The setting array values - * @throws SettingsException + * Returns group settings for the given setting prefix. */ - String[] getAsArray(String settingPrefix, String[] defaultArray) throws SettingsException; + public Map getGroups(String settingPrefix) throws SettingsException { + return getGroups(settingPrefix, false); + } /** - * The values associated with a setting prefix as an array. The settings array is in the format of: - * settingPrefix.[index]. - *

- *

It will also automatically load a comma separated list under the settingPrefix and merge with - * the numbered format. - * - * @param settingPrefix The setting prefix to load the array by - * @return The setting array values - * @throws SettingsException + * Returns group settings for the given setting prefix. */ - String[] getAsArray(String settingPrefix) throws SettingsException; + public Map getGroups(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException { + if (!Strings.hasLength(settingPrefix)) { + throw new IllegalArgumentException("illegal setting prefix " + settingPrefix); + } + if (settingPrefix.charAt(settingPrefix.length() - 1) != '.') { + settingPrefix = settingPrefix + "."; + } + // we don't really care that it might happen twice + Map> map = new LinkedHashMap<>(); + for (Object o : settings.keySet()) { + String setting = (String) o; + if (setting.startsWith(settingPrefix)) { + String nameValue = setting.substring(settingPrefix.length()); + int dotIndex = nameValue.indexOf('.'); + if (dotIndex == -1) { + if (ignoreNonGrouped) { + continue; + } + throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting [" + setting + "] because of a missing '.'"); + } + String name = nameValue.substring(0, dotIndex); + String value = nameValue.substring(dotIndex + 1); + Map groupSettings = map.get(name); + if (groupSettings == null) { + groupSettings = new LinkedHashMap<>(); + map.put(name, groupSettings); + } + groupSettings.put(value, get(setting)); + } + } + Map retVal = new LinkedHashMap<>(); + for (Map.Entry> entry : map.entrySet()) { + retVal.put(entry.getKey(), new Settings(Collections.unmodifiableMap(entry.getValue()), classLoader)); + } + return Collections.unmodifiableMap(retVal); + } /** * Returns a parsed version. */ - Version getAsVersion(String setting, Version defaultVersion) throws SettingsException; + public Version getAsVersion(String setting, Version defaultVersion) throws SettingsException { + String sValue = get(setting); + if (sValue == null) { + return defaultVersion; + } + try { + return Version.fromId(Integer.parseInt(sValue)); + } catch (Exception e) { + throw new SettingsException("Failed to parse version setting [" + setting + "] with value [" + sValue + "]", e); + } + } /** * @return The direct keys of this settings */ - Set names(); + public Set names() { + Set names = new HashSet<>(); + for (String key : settings.keySet()) { + int i = key.indexOf("."); + if (i < 0) { + names.add(key); + } else { + names.add(key.substring(0, i)); + } + } + return names; + } /** * Returns the settings as delimited string. */ - String toDelimitedString(char delimiter); + public String toDelimitedString(char delimiter) { + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : settings.entrySet()) { + sb.append(entry.getKey()).append("=").append(entry.getValue()).append(delimiter); + } + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Settings that = (Settings) o; + + if (classLoader != null ? !classLoader.equals(that.classLoader) : that.classLoader != null) return false; + if (settings != null ? !settings.equals(that.settings) : that.settings != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = settings != null ? settings.hashCode() : 0; + result = 31 * result + (classLoader != null ? classLoader.hashCode() : 0); + return result; + } + + public static Settings readSettingsFromStream(StreamInput in) throws IOException { + Builder builder = new Builder(); + int numberOfSettings = in.readVInt(); + for (int i = 0; i < numberOfSettings; i++) { + builder.put(in.readString(), in.readString()); + } + return builder.build(); + } + + public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException { + out.writeVInt(settings.getAsMap().size()); + for (Map.Entry entry : settings.getAsMap().entrySet()) { + out.writeString(entry.getKey()); + out.writeString(entry.getValue()); + } + } + + public static Builder builder() { + return new Builder(); + } /** - * A settings builder interface. + * Returns a builder to be used in order to build settings. */ - interface Builder { + public static Builder settingsBuilder() { + return new Builder(); + } + + @Override + public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { + Settings settings = SettingsFilter.filterSettings(params, this); + if (!params.paramAsBoolean("flat_settings", false)) { + for (Map.Entry entry : settings.getAsStructuredMap().entrySet()) { + builder.field(entry.getKey(), entry.getValue()); + } + } else { + for (Map.Entry entry : settings.getAsMap().entrySet()) { + builder.field(entry.getKey(), entry.getValue(), XContentBuilder.FieldCaseConversion.NONE); + } + } + return builder; + } + + /** + * A builder allowing to put different settings and then {@link #build()} an immutable + * settings implementation. Use {@link Settings#settingsBuilder()} in order to + * construct it. + */ + public static class Builder { + + public static final Settings EMPTY_SETTINGS = new Builder().build(); + + private final Map map = new LinkedHashMap<>(); + + private ClassLoader classLoader; + + private Builder() { + + } + + public Map internalMap() { + return this.map; + } /** - * Builds the settings. + * Removes the provided setting from the internal map holding the current list of settings. */ - Settings build(); + public String remove(String key) { + return map.remove(key); + } + + /** + * Returns a setting value based on the setting key. + */ + public String get(String key) { + String retVal = map.get(key); + if (retVal != null) { + return retVal; + } + // try camel case version + return map.get(toCamelCase(key)); + } + + /** + * Puts tuples of key value pairs of settings. Simplified version instead of repeating calling + * put for each one. + */ + public Builder put(Object... settings) { + if (settings.length == 1) { + // support cases where the actual type gets lost down the road... + if (settings[0] instanceof Map) { + //noinspection unchecked + return put((Map) settings[0]); + } else if (settings[0] instanceof Settings) { + return put((Settings) settings[0]); + } + } + if ((settings.length % 2) != 0) { + throw new IllegalArgumentException("array settings of key + value order doesn't hold correct number of arguments (" + settings.length + ")"); + } + for (int i = 0; i < settings.length; i++) { + put(settings[i++].toString(), settings[i].toString()); + } + return this; + } + + /** + * Sets a setting with the provided setting key and value. + * + * @param key The setting key + * @param value The setting value + * @return The builder + */ + public Builder put(String key, String value) { + map.put(key, value); + return this; + } + + /** + * Sets a setting with the provided setting key and class as value. + * + * @param key The setting key + * @param clazz The setting class value + * @return The builder + */ + public Builder put(String key, Class clazz) { + map.put(key, clazz.getName()); + return this; + } + + /** + * Sets the setting with the provided setting key and the boolean value. + * + * @param setting The setting key + * @param value The boolean value + * @return The builder + */ + public Builder put(String setting, boolean value) { + put(setting, String.valueOf(value)); + return this; + } + + /** + * Sets the setting with the provided setting key and the int value. + * + * @param setting The setting key + * @param value The int value + * @return The builder + */ + public Builder put(String setting, int value) { + put(setting, String.valueOf(value)); + return this; + } + + public Builder put(String setting, Version version) { + put(setting, version.id); + return this; + } + + /** + * Sets the setting with the provided setting key and the long value. + * + * @param setting The setting key + * @param value The long value + * @return The builder + */ + public Builder put(String setting, long value) { + put(setting, String.valueOf(value)); + return this; + } + + /** + * Sets the setting with the provided setting key and the float value. + * + * @param setting The setting key + * @param value The float value + * @return The builder + */ + public Builder put(String setting, float value) { + put(setting, String.valueOf(value)); + return this; + } + + /** + * Sets the setting with the provided setting key and the double value. + * + * @param setting The setting key + * @param value The double value + * @return The builder + */ + public Builder put(String setting, double value) { + put(setting, String.valueOf(value)); + return this; + } + + /** + * Sets the setting with the provided setting key and the time value. + * + * @param setting The setting key + * @param value The time value + * @return The builder + */ + public Builder put(String setting, long value, TimeUnit timeUnit) { + put(setting, timeUnit.toMillis(value)); + return this; + } + + /** + * Sets the setting with the provided setting key and the size value. + * + * @param setting The setting key + * @param value The size value + * @return The builder + */ + public Builder put(String setting, long value, ByteSizeUnit sizeUnit) { + put(setting, sizeUnit.toBytes(value)); + return this; + } + + /** + * Sets the setting with the provided setting key and an array of values. + * + * @param setting The setting key + * @param values The values + * @return The builder + */ + public Builder putArray(String setting, String... values) { + remove(setting); + int counter = 0; + while (true) { + String value = map.remove(setting + '.' + (counter++)); + if (value == null) { + break; + } + } + for (int i = 0; i < values.length; i++) { + put(setting + "." + i, values[i]); + } + return this; + } + + /** + * Sets the setting group. + */ + public Builder put(String settingPrefix, String groupName, String[] settings, String[] values) throws SettingsException { + if (settings.length != values.length) { + throw new SettingsException("The settings length must match the value length"); + } + for (int i = 0; i < settings.length; i++) { + if (values[i] == null) { + continue; + } + put(settingPrefix + "." + groupName + "." + settings[i], values[i]); + } + return this; + } + + /** + * Sets all the provided settings. + */ + public Builder put(Settings settings) { + removeNonArraysFieldsIfNewSettingsContainsFieldAsArray(settings.getAsMap()); + map.putAll(settings.getAsMap()); + classLoader = settings.getClassLoaderIfSet(); + return this; + } + + /** + * Sets all the provided settings. + */ + public Builder put(Map settings) { + removeNonArraysFieldsIfNewSettingsContainsFieldAsArray(settings); + map.putAll(settings); + return this; + } + + /** + * Removes non array values from the existing map, if settings contains an array value instead + * + * Example: + * Existing map contains: {key:value} + * New map contains: {key:[value1,value2]} (which has been flattened to {}key.0:value1,key.1:value2}) + * + * This ensure that that the 'key' field gets removed from the map in order to override all the + * data instead of merging + */ + private void removeNonArraysFieldsIfNewSettingsContainsFieldAsArray(Map settings) { + List prefixesToRemove = new ArrayList<>(); + for (final Map.Entry entry : settings.entrySet()) { + final Matcher matcher = ARRAY_PATTERN.matcher(entry.getKey()); + if (matcher.matches()) { + prefixesToRemove.add(matcher.group(1)); + } else if (Iterables.any(map.keySet(), startsWith(entry.getKey() + "."))) { + prefixesToRemove.add(entry.getKey()); + } + } + for (String prefix : prefixesToRemove) { + Iterator> iterator = map.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + if (entry.getKey().startsWith(prefix + ".") || entry.getKey().equals(prefix)) { + iterator.remove(); + } + } + } + } + + /** + * Sets all the provided settings. + */ + public Builder put(Properties properties) { + for (Map.Entry entry : properties.entrySet()) { + map.put((String) entry.getKey(), (String) entry.getValue()); + } + return this; + } + + public Builder loadFromDelimitedString(String value, char delimiter) { + String[] values = Strings.splitStringToArray(value, delimiter); + for (String s : values) { + int index = s.indexOf('='); + if (index == -1) { + throw new IllegalArgumentException("value [" + s + "] for settings loaded with delimiter [" + delimiter + "] is malformed, missing ="); + } + map.put(s.substring(0, index), s.substring(index + 1)); + } + return this; + } + + /** + * Loads settings from the actual string content that represents them using the + * {@link SettingsLoaderFactory#loaderFromSource(String)}. + */ + public Builder loadFromSource(String source) { + SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromSource(source); + try { + Map loadedSettings = settingsLoader.load(source); + put(loadedSettings); + } catch (Exception e) { + throw new SettingsException("Failed to load settings from [" + source + "]", e); + } + return this; + } + + /** + * Loads settings from a url that represents them using the + * {@link SettingsLoaderFactory#loaderFromSource(String)}. + */ + public Builder loadFromUrl(URL url) throws SettingsException { + try { + return loadFromStream(url.toExternalForm(), url.openStream()); + } catch (IOException e) { + throw new SettingsException("Failed to open stream for url [" + url.toExternalForm() + "]", e); + } + } + + /** + * Loads settings from a url that represents them using the + * {@link SettingsLoaderFactory#loaderFromSource(String)}. + */ + public Builder loadFromPath(Path path) throws SettingsException { + try { + return loadFromStream(path.getFileName().toString(), Files.newInputStream(path)); + } catch (IOException e) { + throw new SettingsException("Failed to open stream for url [" + path + "]", e); + } + } + + /** + * Loads settings from a stream that represents them using the + * {@link SettingsLoaderFactory#loaderFromSource(String)}. + */ + public Builder loadFromStream(String resourceName, InputStream is) throws SettingsException { + SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromResource(resourceName); + try { + Map loadedSettings = settingsLoader.load(Streams.copyToString(new InputStreamReader(is, Charsets.UTF_8))); + put(loadedSettings); + } catch (Exception e) { + throw new SettingsException("Failed to load settings from [" + resourceName + "]", e); + } + return this; + } + + /** + * Loads settings from classpath that represents them using the + * {@link SettingsLoaderFactory#loaderFromSource(String)}. + */ + public Builder loadFromClasspath(String resourceName) throws SettingsException { + ClassLoader classLoader = this.classLoader; + if (classLoader == null) { + classLoader = Classes.getDefaultClassLoader(); + } + InputStream is = classLoader.getResourceAsStream(resourceName); + if (is == null) { + return this; + } + + return loadFromStream(resourceName, is); + } + + /** + * Sets the class loader associated with the settings built. + */ + public Builder classLoader(ClassLoader classLoader) { + this.classLoader = classLoader; + return this; + } + + /** + * Puts all the properties with keys starting with the provided prefix. + * + * @param prefix The prefix to filter property key by + * @param properties The properties to put + * @return The builder + */ + public Builder putProperties(String prefix, Properties properties) { + for (Object key1 : properties.keySet()) { + String key = (String) key1; + String value = properties.getProperty(key); + if (key.startsWith(prefix)) { + map.put(key.substring(prefix.length()), value); + } + } + return this; + } + + /** + * Puts all the properties with keys starting with the provided prefix. + * + * @param prefix The prefix to filter property key by + * @param properties The properties to put + * @return The builder + */ + public Builder putProperties(String prefix, Properties properties, String[] ignorePrefixes) { + for (Object key1 : properties.keySet()) { + String key = (String) key1; + String value = properties.getProperty(key); + if (key.startsWith(prefix)) { + boolean ignore = false; + for (String ignorePrefix : ignorePrefixes) { + if (key.startsWith(ignorePrefix)) { + ignore = true; + break; + } + } + if (!ignore) { + map.put(key.substring(prefix.length()), value); + } + } + } + return this; + } + + /** + * Runs across all the settings set on this builder and replaces ${...} elements in the + * each setting value according to the following logic: + *

+ *

First, tries to resolve it against a System property ({@link System#getProperty(String)}), next, + * tries and resolve it against an environment variable ({@link System#getenv(String)}), and last, tries + * and replace it with another setting already set on this builder. + */ + public Builder replacePropertyPlaceholders() { + PropertyPlaceholder propertyPlaceholder = new PropertyPlaceholder("${", "}", false); + PropertyPlaceholder.PlaceholderResolver placeholderResolver = new PropertyPlaceholder.PlaceholderResolver() { + @Override + public String resolvePlaceholder(String placeholderName) { + if (placeholderName.startsWith("env.")) { + // explicit env var prefix + return System.getenv(placeholderName.substring("env.".length())); + } + String value = System.getProperty(placeholderName); + if (value != null) { + return value; + } + value = System.getenv(placeholderName); + if (value != null) { + return value; + } + return map.get(placeholderName); + } + + @Override + public boolean shouldIgnoreMissing(String placeholderName) { + // if its an explicit env var, we are ok with not having a value for it and treat it as optional + if (placeholderName.startsWith("env.")) { + return true; + } + return false; + } + }; + for (Map.Entry entry : Maps.newHashMap(map).entrySet()) { + String value = propertyPlaceholder.replacePlaceholders(entry.getValue(), placeholderResolver); + // if the values exists and has length, we should maintain it in the map + // otherwise, the replace process resolved into removing it + if (Strings.hasLength(value)) { + map.put(entry.getKey(), value); + } else { + map.remove(entry.getKey()); + } + } + return this; + } + + /** + * Checks that all settings in the builder start with the specified prefix. + * + * If a setting doesn't start with the prefix, the builder appends the prefix to such setting. + */ + public Builder normalizePrefix(String prefix) { + Map replacements = Maps.newHashMap(); + Iterator> iterator = map.entrySet().iterator(); + while(iterator.hasNext()) { + Map.Entry entry = iterator.next(); + if (entry.getKey().startsWith(prefix) == false) { + replacements.put(prefix + entry.getKey(), entry.getValue()); + iterator.remove(); + } + } + map.putAll(replacements); + return this; + } + + /** + * Builds a {@link Settings} (underlying uses {@link Settings}) based on everything + * set on this builder. + */ + public Settings build() { + return new Settings(Collections.unmodifiableMap(map), classLoader); + } + } + + private static StartsWithPredicate startsWith(String prefix) { + return new StartsWithPredicate(prefix); + } + + private static final class StartsWithPredicate implements Predicate { + + private String prefix; + + public StartsWithPredicate(String prefix) { + this.prefix = prefix; + } + + @Override + public boolean apply(String input) { + return input.startsWith(prefix); + } } } diff --git a/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java b/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java index f02ebd3f54a..56739c0f19f 100644 --- a/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java +++ b/src/main/java/org/elasticsearch/common/settings/SettingsFilter.java @@ -88,7 +88,7 @@ public class SettingsFilter extends AbstractComponent { public static Settings filterSettings(String patterns, Settings settings) { String[] patternArray = Strings.delimitedListToStringArray(patterns, ","); - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder().put(settings); + Settings.Builder builder = Settings.settingsBuilder().put(settings); List simpleMatchPatternList = newArrayList(); for (String pattern : patternArray) { if (Regex.isSimpleMatchPattern(pattern)) { diff --git a/src/main/java/org/elasticsearch/common/util/BigArrays.java b/src/main/java/org/elasticsearch/common/util/BigArrays.java index fa202f2d719..90db1bd73a0 100644 --- a/src/main/java/org/elasticsearch/common/util/BigArrays.java +++ b/src/main/java/org/elasticsearch/common/util/BigArrays.java @@ -27,13 +27,10 @@ import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.breaker.CircuitBreakingException; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.recycler.Recycler; -import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.breaker.CircuitBreakerService; import java.util.Arrays; diff --git a/src/main/java/org/elasticsearch/discovery/DiscoveryService.java b/src/main/java/org/elasticsearch/discovery/DiscoveryService.java index a95c313447b..c86033b85da 100644 --- a/src/main/java/org/elasticsearch/discovery/DiscoveryService.java +++ b/src/main/java/org/elasticsearch/discovery/DiscoveryService.java @@ -19,10 +19,8 @@ package org.elasticsearch.discovery; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchTimeoutException; import org.elasticsearch.cluster.ClusterChangedEvent; -import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Strings; diff --git a/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java b/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java index 7a7567ea3b4..dae17ef8b05 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java +++ b/src/main/java/org/elasticsearch/discovery/zen/membership/MembershipAction.java @@ -19,10 +19,7 @@ package org.elasticsearch.discovery.zen.membership; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.io.stream.StreamInput; diff --git a/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPingService.java b/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPingService.java index b7bd539c2f7..00fb59e94ba 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPingService.java +++ b/src/main/java/org/elasticsearch/discovery/zen/ping/ZenPingService.java @@ -20,7 +20,6 @@ package org.elasticsearch.discovery.zen.ping; import com.google.common.collect.ImmutableList; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.Nullable; diff --git a/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java b/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java index bc75092dc82..ab379de7584 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java +++ b/src/main/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPing.java @@ -20,7 +20,6 @@ package org.elasticsearch.discovery.zen.ping.multicast; import org.apache.lucene.util.Constants; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterName; @@ -52,7 +51,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.cluster.node.DiscoveryNode.readNode; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.newConcurrentMap; /** diff --git a/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java b/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java index c4ad8895e79..92d5bad4bf6 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java +++ b/src/main/java/org/elasticsearch/discovery/zen/publish/PublishClusterStateAction.java @@ -49,8 +49,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; /** * diff --git a/src/main/java/org/elasticsearch/env/NodeEnvironment.java b/src/main/java/org/elasticsearch/env/NodeEnvironment.java index e018e07499c..26a725f9072 100644 --- a/src/main/java/org/elasticsearch/env/NodeEnvironment.java +++ b/src/main/java/org/elasticsearch/env/NodeEnvironment.java @@ -32,7 +32,6 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.Index; @@ -289,8 +288,8 @@ public class NodeEnvironment extends AbstractComponent implements Closeable { * @throws IOException if an IOException occurs */ public void deleteShardDirectorySafe(ShardId shardId, @IndexSettings Settings indexSettings) throws IOException { - // This is to ensure someone doesn't use ImmutableSettings.EMPTY - assert indexSettings != ImmutableSettings.EMPTY; + // This is to ensure someone doesn't use Settings.EMPTY + assert indexSettings != Settings.EMPTY; final Path[] paths = availableShardPaths(shardId); logger.trace("deleting shard {} directory, paths: [{}]", shardId, paths); try (ShardLock lock = shardLock(shardId)) { @@ -339,7 +338,7 @@ public class NodeEnvironment extends AbstractComponent implements Closeable { * @throws ElasticsearchException if the write.lock is not acquirable */ public void deleteShardDirectoryUnderLock(ShardLock lock, @IndexSettings Settings indexSettings) throws IOException { - assert indexSettings != ImmutableSettings.EMPTY; + assert indexSettings != Settings.EMPTY; final ShardId shardId = lock.getShardId(); assert isShardLocked(shardId) : "shard " + shardId + " is not locked"; final Path[] paths = availableShardPaths(shardId); @@ -377,8 +376,8 @@ public class NodeEnvironment extends AbstractComponent implements Closeable { * @throws Exception if any of the shards data directories can't be locked or deleted */ public void deleteIndexDirectorySafe(Index index, long lockTimeoutMS, @IndexSettings Settings indexSettings) throws IOException { - // This is to ensure someone doesn't use ImmutableSettings.EMPTY - assert indexSettings != ImmutableSettings.EMPTY; + // This is to ensure someone doesn't use Settings.EMPTY + assert indexSettings != Settings.EMPTY; final List locks = lockAllForIndex(index, indexSettings, lockTimeoutMS); try { deleteIndexDirectoryUnderLock(index, indexSettings); @@ -395,8 +394,8 @@ public class NodeEnvironment extends AbstractComponent implements Closeable { * @param indexSettings settings for the index being deleted */ public void deleteIndexDirectoryUnderLock(Index index, @IndexSettings Settings indexSettings) throws IOException { - // This is to ensure someone doesn't use ImmutableSettings.EMPTY - assert indexSettings != ImmutableSettings.EMPTY; + // This is to ensure someone doesn't use Settings.EMPTY + assert indexSettings != Settings.EMPTY; final Path[] indexPaths = indexPaths(index); logger.trace("deleting index {} directory, paths({}): [{}]", index, indexPaths.length, indexPaths); IOUtils.rm(indexPaths); @@ -733,7 +732,7 @@ public class NodeEnvironment extends AbstractComponent implements Closeable { */ @SuppressForbidden(reason = "Lee is working on it: https://github.com/elastic/elasticsearch/pull/11065") private Path resolveCustomLocation(@IndexSettings Settings indexSettings) { - assert indexSettings != ImmutableSettings.EMPTY; + assert indexSettings != Settings.EMPTY; String customDataDir = indexSettings.get(IndexMetaData.SETTING_DATA_PATH); if (customDataDir != null) { // This assert is because this should be caught by MetaDataCreateIndexService diff --git a/src/main/java/org/elasticsearch/gateway/GatewayService.java b/src/main/java/org/elasticsearch/gateway/GatewayService.java index da0b2bcabf8..71144a748e8 100644 --- a/src/main/java/org/elasticsearch/gateway/GatewayService.java +++ b/src/main/java/org/elasticsearch/gateway/GatewayService.java @@ -20,7 +20,6 @@ package org.elasticsearch.gateway; import com.carrotsearch.hppc.cursors.ObjectCursor; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlockLevel; diff --git a/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java b/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java index 68ff3f9bc3c..a89c0209cd3 100644 --- a/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java +++ b/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java @@ -19,7 +19,6 @@ package org.elasticsearch.http.netty; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; diff --git a/src/main/java/org/elasticsearch/index/IndexService.java b/src/main/java/org/elasticsearch/index/IndexService.java index fa575e8e884..6276e682123 100644 --- a/src/main/java/org/elasticsearch/index/IndexService.java +++ b/src/main/java/org/elasticsearch/index/IndexService.java @@ -24,7 +24,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; import org.apache.lucene.util.IOUtils; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; diff --git a/src/main/java/org/elasticsearch/index/aliases/IndexAliasesService.java b/src/main/java/org/elasticsearch/index/aliases/IndexAliasesService.java index 298501292e3..a097a01675b 100644 --- a/src/main/java/org/elasticsearch/index/aliases/IndexAliasesService.java +++ b/src/main/java/org/elasticsearch/index/aliases/IndexAliasesService.java @@ -21,9 +21,7 @@ package org.elasticsearch.index.aliases; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; -import org.apache.lucene.search.Filter; import org.apache.lucene.search.Query; -import org.apache.lucene.search.QueryWrapperFilter; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.compress.CompressedString; import org.elasticsearch.common.inject.Inject; diff --git a/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java b/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java index 3b351567456..99cd9e4aa80 100644 --- a/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java +++ b/src/main/java/org/elasticsearch/index/analysis/AnalysisModule.java @@ -26,8 +26,8 @@ import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Scopes; import org.elasticsearch.common.inject.assistedinject.FactoryProvider; import org.elasticsearch.common.inject.multibindings.MapBinder; -import org.elasticsearch.common.settings.NoClassSettingsException; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.NoClassSettingsException; import org.elasticsearch.index.analysis.compound.DictionaryCompoundWordTokenFilterFactory; import org.elasticsearch.index.analysis.compound.HyphenationCompoundWordTokenFilterFactory; import org.elasticsearch.indices.analysis.IndicesAnalysisService; diff --git a/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java b/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java index dbbe01ae38f..e1c23ceb2f8 100644 --- a/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java +++ b/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.Index; @@ -65,7 +64,7 @@ public class AnalysisService extends AbstractIndexComponent implements Closeable @Nullable Map charFilterFactoryFactories, @Nullable Map tokenFilterFactoryFactories) { super(index, indexSettings); - Settings defaultSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.indexCreated(indexSettings)).build(); + Settings defaultSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.indexCreated(indexSettings)).build(); Map tokenizers = newHashMap(); if (tokenizerFactoryFactories != null) { Map tokenizersSettings = indexSettings.getGroups("index.analysis.tokenizer"); @@ -192,17 +191,17 @@ public class AnalysisService extends AbstractIndexComponent implements Closeable String name = entry.getKey(); Version indexVersion = Version.indexCreated(indexSettings); if (!analyzerProviders.containsKey(name)) { - analyzerProviders.put(name, entry.getValue().create(name, ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, indexVersion).build())); + analyzerProviders.put(name, entry.getValue().create(name, Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, indexVersion).build())); } String camelCaseName = Strings.toCamelCase(name); if (!camelCaseName.equals(entry.getKey()) && !analyzerProviders.containsKey(camelCaseName)) { - analyzerProviders.put(camelCaseName, entry.getValue().create(name, ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, indexVersion).build())); + analyzerProviders.put(camelCaseName, entry.getValue().create(name, Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, indexVersion).build())); } } } if (!analyzerProviders.containsKey("default")) { - analyzerProviders.put("default", new StandardAnalyzerProvider(index, indexSettings, null, "default", ImmutableSettings.Builder.EMPTY_SETTINGS)); + analyzerProviders.put("default", new StandardAnalyzerProvider(index, indexSettings, null, "default", Settings.Builder.EMPTY_SETTINGS)); } if (!analyzerProviders.containsKey("default_index")) { analyzerProviders.put("default_index", analyzerProviders.get("default")); diff --git a/src/main/java/org/elasticsearch/index/analysis/ClassicTokenizerFactory.java b/src/main/java/org/elasticsearch/index/analysis/ClassicTokenizerFactory.java index 0d4c4b05cf7..a1d651426ef 100644 --- a/src/main/java/org/elasticsearch/index/analysis/ClassicTokenizerFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/ClassicTokenizerFactory.java @@ -28,8 +28,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.settings.IndexSettings; -import java.io.Reader; - /** * Factory for {@link ClassicTokenizer} */ diff --git a/src/main/java/org/elasticsearch/index/analysis/EdgeNGramTokenFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/EdgeNGramTokenFilterFactory.java index f6eca682c6c..2930a3e3099 100644 --- a/src/main/java/org/elasticsearch/index/analysis/EdgeNGramTokenFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/EdgeNGramTokenFilterFactory.java @@ -25,7 +25,6 @@ import org.apache.lucene.analysis.ngram.Lucene43EdgeNGramTokenFilter; import org.apache.lucene.analysis.ngram.NGramTokenFilter; import org.apache.lucene.analysis.reverse.ReverseStringFilter; import org.apache.lucene.util.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; diff --git a/src/main/java/org/elasticsearch/index/analysis/FrenchStemTokenFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/FrenchStemTokenFilterFactory.java index 228441d34c4..6a95acf81ab 100644 --- a/src/main/java/org/elasticsearch/index/analysis/FrenchStemTokenFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/FrenchStemTokenFilterFactory.java @@ -23,10 +23,10 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.miscellaneous.SetKeywordMarkerFilter; import org.apache.lucene.analysis.util.CharArraySet; import org.apache.lucene.analysis.snowball.SnowballFilter; +import org.elasticsearch.common.settings.Settings; import org.tartarus.snowball.ext.FrenchStemmer; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.settings.IndexSettings; diff --git a/src/main/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactory.java b/src/main/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactory.java index de656af6381..7518b5d9bbd 100644 --- a/src/main/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactory.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Analyzer; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltAnalyzers; diff --git a/src/main/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactory.java b/src/main/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactory.java index 7c99f7c811d..f88b904436b 100644 --- a/src/main/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactory.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltCharFilters; diff --git a/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactory.java b/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactory.java index 321f0b59a9a..4430204d47e 100644 --- a/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactory.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltTokenFilters; diff --git a/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactory.java b/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactory.java index c12ae467bff..64213f7d400 100644 --- a/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactory.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltTokenizers; diff --git a/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java b/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java index a732d3350be..eb22299ee0f 100644 --- a/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java +++ b/src/main/java/org/elasticsearch/index/analysis/StandardAnalyzerProvider.java @@ -23,7 +23,6 @@ import org.apache.lucene.analysis.core.StopAnalyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.analysis.util.CharArraySet; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; diff --git a/src/main/java/org/elasticsearch/index/analysis/StandardHtmlStripAnalyzerProvider.java b/src/main/java/org/elasticsearch/index/analysis/StandardHtmlStripAnalyzerProvider.java index eefc523ed43..84c1e4c80c2 100644 --- a/src/main/java/org/elasticsearch/index/analysis/StandardHtmlStripAnalyzerProvider.java +++ b/src/main/java/org/elasticsearch/index/analysis/StandardHtmlStripAnalyzerProvider.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.core.StopAnalyzer; import org.apache.lucene.analysis.util.CharArraySet; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; diff --git a/src/main/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactory.java index 5defb93f849..1b2018f07b7 100644 --- a/src/main/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactory.java @@ -53,7 +53,6 @@ import org.apache.lucene.analysis.ru.RussianLightStemFilter; import org.apache.lucene.analysis.snowball.SnowballFilter; import org.apache.lucene.analysis.sv.SwedishLightStemFilter; import org.elasticsearch.Version; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; diff --git a/src/main/java/org/elasticsearch/index/analysis/SynonymTokenFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/SynonymTokenFilterFactory.java index 646e3d9b6ea..6fc69e72920 100644 --- a/src/main/java/org/elasticsearch/index/analysis/SynonymTokenFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/SynonymTokenFilterFactory.java @@ -31,7 +31,6 @@ import org.apache.lucene.analysis.synonym.WordnetSynonymParser; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.io.FastStringReader; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; @@ -80,7 +79,7 @@ public class SynonymTokenFilterFactory extends AbstractTokenFilterFactory { throw new IllegalArgumentException("failed to find tokenizer [" + tokenizerName + "] for synonym token filter"); } - final TokenizerFactory tokenizerFactory = tokenizerFactoryFactory.create(tokenizerName, ImmutableSettings.builder().put(indexSettings).put(settings).build()); + final TokenizerFactory tokenizerFactory = tokenizerFactoryFactory.create(tokenizerName, Settings.builder().put(indexSettings).put(settings).build()); Analyzer analyzer = new Analyzer() { @Override diff --git a/src/main/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactory.java b/src/main/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactory.java index fc9be482549..efcdbf57b18 100644 --- a/src/main/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactory.java +++ b/src/main/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactory.java @@ -27,7 +27,6 @@ import org.apache.lucene.analysis.util.CharArraySet; import org.apache.lucene.util.Version; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; -import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.Index; diff --git a/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java b/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java index 284ecc0ecb7..7bf252f235a 100644 --- a/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java +++ b/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java @@ -32,7 +32,6 @@ import org.apache.lucene.search.Filter; import org.apache.lucene.search.join.BitDocIdSetFilter; import org.apache.lucene.util.BitDocIdSet; import org.apache.lucene.util.SparseFixedBitSet; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Inject; diff --git a/src/main/java/org/elasticsearch/index/codec/CodecService.java b/src/main/java/org/elasticsearch/index/codec/CodecService.java index bd152052651..2ba4aeb4c9d 100644 --- a/src/main/java/org/elasticsearch/index/codec/CodecService.java +++ b/src/main/java/org/elasticsearch/index/codec/CodecService.java @@ -26,7 +26,6 @@ import org.apache.lucene.codecs.lucene50.Lucene50Codec; import org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat.Mode; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.Index; @@ -53,7 +52,7 @@ public class CodecService extends AbstractIndexComponent { public final static String LUCENE_DEFAULT_CODEC = "lucene_default"; public CodecService(Index index) { - this(index, ImmutableSettings.Builder.EMPTY_SETTINGS); + this(index, Settings.Builder.EMPTY_SETTINGS); } public CodecService(Index index, @IndexSettings Settings indexSettings) { diff --git a/src/main/java/org/elasticsearch/index/deletionpolicy/KeepLastNDeletionPolicy.java b/src/main/java/org/elasticsearch/index/deletionpolicy/KeepLastNDeletionPolicy.java index 48c62759d40..f9b3b8901d9 100644 --- a/src/main/java/org/elasticsearch/index/deletionpolicy/KeepLastNDeletionPolicy.java +++ b/src/main/java/org/elasticsearch/index/deletionpolicy/KeepLastNDeletionPolicy.java @@ -20,11 +20,9 @@ package org.elasticsearch.index.deletionpolicy; import org.apache.lucene.index.IndexCommit; -import org.apache.lucene.index.IndexDeletionPolicy; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.settings.IndexSettings; -import org.elasticsearch.index.shard.AbstractIndexShardComponent; import org.elasticsearch.index.shard.ShardId; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/index/fielddata/FieldDataType.java b/src/main/java/org/elasticsearch/index/fielddata/FieldDataType.java index 98cd00ac79b..f42ba96b762 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/FieldDataType.java +++ b/src/main/java/org/elasticsearch/index/fielddata/FieldDataType.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.fielddata; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.mapper.FieldMapper.Loading; @@ -36,7 +35,7 @@ public class FieldDataType { private final Settings settings; public FieldDataType(String type) { - this(type, ImmutableSettings.Builder.EMPTY_SETTINGS); + this(type, Settings.Builder.EMPTY_SETTINGS); } public FieldDataType(String type, Settings.Builder builder) { diff --git a/src/main/java/org/elasticsearch/index/fielddata/ShardFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/ShardFieldData.java index cfb73c0db15..70d8bb18534 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/ShardFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/ShardFieldData.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.index.mapper.FieldMapper; -import org.elasticsearch.index.mapper.internal.ParentFieldMapper; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.AbstractIndexShardComponent; import org.elasticsearch.index.shard.ShardId; diff --git a/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java index 295b2392b88..3fb3a82eb6a 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java @@ -26,7 +26,6 @@ import org.apache.lucene.index.RandomAccessOrds; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.util.Accountable; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.fielddata.AtomicOrdinalsFieldData; @@ -103,7 +102,7 @@ public class IndexIndexFieldData extends AbstractIndexOrdinalsFieldData { private final AtomicOrdinalsFieldData atomicFieldData; private IndexIndexFieldData(Index index, FieldMapper.Names names) { - super(index, ImmutableSettings.EMPTY, names, new FieldDataType("string"), null, null); + super(index, Settings.EMPTY, names, new FieldDataType("string"), null, null); atomicFieldData = new IndexAtomicFieldData(index().name()); } diff --git a/src/main/java/org/elasticsearch/index/fielddata/plain/PackedArrayIndexFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/plain/PackedArrayIndexFieldData.java index 922c0be9390..50f6e631e84 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/plain/PackedArrayIndexFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/plain/PackedArrayIndexFieldData.java @@ -37,7 +37,6 @@ import org.apache.lucene.util.Bits; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefIterator; import org.apache.lucene.util.LongValues; -import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.RamUsageEstimator; import org.apache.lucene.util.packed.PackedInts; import org.apache.lucene.util.packed.PackedLongValues; diff --git a/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java b/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java index eb52365217f..2bd6a8c9bee 100644 --- a/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java +++ b/src/main/java/org/elasticsearch/index/gateway/IndexShardGateway.java @@ -39,7 +39,6 @@ import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.store.Store; import org.elasticsearch.indices.recovery.RecoveryState; -import org.elasticsearch.threadpool.ThreadPool; import java.io.Closeable; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java b/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java index f69fc2e5411..45da4be320b 100644 --- a/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java @@ -24,7 +24,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; -import org.apache.lucene.document.Field; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSetIterator; diff --git a/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java b/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java index 7c4b641056e..d07457602b2 100644 --- a/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java +++ b/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java @@ -26,7 +26,6 @@ import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexOptions; import org.apache.lucene.index.IndexableField; import org.apache.lucene.util.CloseableThreadLocal; -import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.joda.FormatDateTimeFormatter; import org.elasticsearch.common.settings.Settings; @@ -46,7 +45,6 @@ import java.io.IOException; import java.util.Collections; import java.util.Map; import java.util.Set; -import java.util.concurrent.locks.Lock; /** A parser for documents, given mappings from a DocumentMapper */ class DocumentParser implements Closeable { diff --git a/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java index 5c26e0c14b4..ddf04a25469 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java @@ -47,7 +47,6 @@ import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.lucene.BytesRefs; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.search.Queries; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -330,7 +329,7 @@ public abstract class AbstractFieldMapper implements FieldMapper { } else { // create a new field data type, with the default settings as well as the "new ones" this.fieldDataType = new FieldDataType(defaultFieldDataType().getType(), - ImmutableSettings.builder().put(defaultFieldDataType().getSettings()).put(fieldDataSettings) + Settings.builder().put(defaultFieldDataType().getSettings()).put(fieldDataSettings) ); } @@ -623,7 +622,7 @@ public abstract class AbstractFieldMapper implements FieldMapper { if (!Objects.equal(fieldMergeWith.customFieldDataSettings, this.customFieldDataSettings)) { this.customFieldDataSettings = fieldMergeWith.customFieldDataSettings; this.fieldDataType = new FieldDataType(defaultFieldDataType().getType(), - ImmutableSettings.builder().put(defaultFieldDataType().getSettings()).put(this.customFieldDataSettings) + Settings.builder().put(defaultFieldDataType().getSettings()).put(this.customFieldDataSettings) ); } } diff --git a/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java index ff4f485b17e..a9850b466b4 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java @@ -25,7 +25,6 @@ import org.apache.lucene.document.SortedNumericDocValuesField; import org.apache.lucene.index.IndexOptions; import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.Query; -import org.apache.lucene.search.TermQuery; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Nullable; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java index 3d7862bc54e..e3842fe474a 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java @@ -25,10 +25,8 @@ import org.apache.lucene.index.IndexOptions; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Terms; import org.apache.lucene.search.ConstantScoreQuery; -import org.apache.lucene.search.Filter; import org.apache.lucene.search.NumericRangeQuery; import org.apache.lucene.search.Query; -import org.apache.lucene.search.QueryWrapperFilter; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.NumericUtils; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java index ffb6496853c..48282232d28 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java @@ -133,7 +133,7 @@ public class DoubleFieldMapper extends NumberFieldMapper { protected DoubleFieldMapper(Names names, int precisionStep, float boost, FieldType fieldType, Boolean docValues, Double nullValue, Explicit ignoreMalformed, Explicit coerce, - SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, + SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) { super(names, precisionStep, boost, fieldType, docValues, ignoreMalformed, coerce, NumericDoubleAnalyzer.buildNamedAnalyzer(precisionStep), NumericDoubleAnalyzer.buildNamedAnalyzer(Integer.MAX_VALUE), diff --git a/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java index 88fba259ff7..4a3f6c2e3fc 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java @@ -133,7 +133,7 @@ public class FloatFieldMapper extends NumberFieldMapper { protected FloatFieldMapper(Names names, int precisionStep, float boost, FieldType fieldType, Boolean docValues, Float nullValue, Explicit ignoreMalformed, Explicit coerce, - SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, + SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) { super(names, precisionStep, boost, fieldType, docValues, ignoreMalformed, coerce, NumericFloatAnalyzer.buildNamedAnalyzer(precisionStep), NumericFloatAnalyzer.buildNamedAnalyzer(Integer.MAX_VALUE), diff --git a/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java index 46dcf502494..cd9b9ca5df1 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java @@ -128,7 +128,7 @@ public class LongFieldMapper extends NumberFieldMapper { protected LongFieldMapper(Names names, int precisionStep, float boost, FieldType fieldType, Boolean docValues, Long nullValue, Explicit ignoreMalformed, Explicit coerce, - SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, + SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) { super(names, precisionStep, boost, fieldType, docValues, ignoreMalformed, coerce, NumericLongAnalyzer.buildNamedAnalyzer(precisionStep), NumericLongAnalyzer.buildNamedAnalyzer(Integer.MAX_VALUE), diff --git a/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java index 24970718744..f195862ac74 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java @@ -130,7 +130,7 @@ public class ShortFieldMapper extends NumberFieldMapper { protected ShortFieldMapper(Names names, int precisionStep, float boost, FieldType fieldType, Boolean docValues, Short nullValue, Explicit ignoreMalformed, Explicit coerce, - SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, + SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) { super(names, precisionStep, boost, fieldType, docValues, ignoreMalformed, coerce, new NamedAnalyzer("_short/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)), new NamedAnalyzer("_short/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)), diff --git a/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java b/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java index 20f9eda9b26..983b83ce054 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java @@ -25,7 +25,6 @@ import org.elasticsearch.Version; import org.elasticsearch.common.Strings; import org.elasticsearch.common.joda.FormatDateTimeFormatter; import org.elasticsearch.common.joda.Joda; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.loader.SettingsLoader; import org.elasticsearch.index.analysis.NamedAnalyzer; @@ -281,7 +280,7 @@ public class TypeParsers { builder.similarity(parserContext.similarityLookupService().similarity(propNode.toString())); iterator.remove(); } else if (propName.equals("fielddata")) { - final Settings settings = ImmutableSettings.builder().put(SettingsLoader.Helper.loadNestedFromMap(nodeMapValue(propNode, "fielddata"))).build(); + final Settings settings = Settings.builder().put(SettingsLoader.Helper.loadNestedFromMap(nodeMapValue(propNode, "fielddata"))).build(); builder.fieldDataSettings(settings); iterator.remove(); } else if (propName.equals("copy_to")) { diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java index 940c2f6484e..7aca0b17ea6 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java @@ -52,8 +52,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import static org.elasticsearch.common.settings.ImmutableSettings.builder; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.builder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeMapValue; import static org.elasticsearch.index.mapper.MapperBuilders.parent; diff --git a/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java index 29fd2884e7b..0fa74b0ab8a 100644 --- a/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java @@ -158,7 +158,7 @@ public class IpFieldMapper extends NumberFieldMapper { protected IpFieldMapper(Names names, int precisionStep, float boost, FieldType fieldType, Boolean docValues, String nullValue, Explicit ignoreMalformed, Explicit coerce, - SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, + SimilarityProvider similarity, Loading normsLoading, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) { super(names, precisionStep, boost, fieldType, docValues, ignoreMalformed, coerce, new NamedAnalyzer("_ip/" + precisionStep, new NumericIpAnalyzer(precisionStep)), diff --git a/src/main/java/org/elasticsearch/index/merge/policy/TieredMergePolicyProvider.java b/src/main/java/org/elasticsearch/index/merge/policy/TieredMergePolicyProvider.java index 6b5241e98eb..d65a24444e5 100644 --- a/src/main/java/org/elasticsearch/index/merge/policy/TieredMergePolicyProvider.java +++ b/src/main/java/org/elasticsearch/index/merge/policy/TieredMergePolicyProvider.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.merge.policy; import org.apache.lucene.index.TieredMergePolicy; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; diff --git a/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java b/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java index b7bec5e092b..457fcce9fbc 100644 --- a/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java +++ b/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java @@ -26,7 +26,6 @@ import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.merge.OnGoingMerge; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.AbstractIndexShardComponent; -import org.elasticsearch.index.shard.IndexShardComponent; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.threadpool.ThreadPool; diff --git a/src/main/java/org/elasticsearch/index/query/IndexQueryParserService.java b/src/main/java/org/elasticsearch/index/query/IndexQueryParserService.java index 76f46d795b7..a3684d379e6 100644 --- a/src/main/java/org/elasticsearch/index/query/IndexQueryParserService.java +++ b/src/main/java/org/elasticsearch/index/query/IndexQueryParserService.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.query; import com.google.common.collect.ImmutableMap; -import org.apache.lucene.search.Filter; import org.apache.lucene.search.Query; import org.apache.lucene.util.CloseableThreadLocal; import org.elasticsearch.Version; @@ -54,7 +53,7 @@ import java.util.Map; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Maps.newHashMap; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; /** * diff --git a/src/main/java/org/elasticsearch/index/query/QueryParseContext.java b/src/main/java/org/elasticsearch/index/query/QueryParseContext.java index 454060b5686..e3ee40c3ae5 100644 --- a/src/main/java/org/elasticsearch/index/query/QueryParseContext.java +++ b/src/main/java/org/elasticsearch/index/query/QueryParseContext.java @@ -33,7 +33,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.Index; @@ -41,7 +40,6 @@ import org.elasticsearch.index.analysis.AnalysisService; import org.elasticsearch.index.fielddata.IndexFieldData; import org.elasticsearch.index.mapper.ContentPath; import org.elasticsearch.index.mapper.FieldMapper; -import org.elasticsearch.index.mapper.FieldMappers; import org.elasticsearch.index.mapper.Mapper; import org.elasticsearch.index.mapper.MapperBuilders; import org.elasticsearch.index.mapper.MapperService; @@ -329,7 +327,7 @@ public class QueryParseContext { } else if (mapUnmappedFieldAsString){ StringFieldMapper.Builder builder = MapperBuilders.stringField(name); // it would be better to pass the real index settings, but they are not easily accessible from here... - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, indexQueryParser.getIndexCreatedVersion()).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, indexQueryParser.getIndexCreatedVersion()).build(); StringFieldMapper stringFieldMapper = builder.build(new Mapper.BuilderContext(settings, new ContentPath(1))); return stringFieldMapper; } else { diff --git a/src/main/java/org/elasticsearch/index/settings/IndexSettingsService.java b/src/main/java/org/elasticsearch/index/settings/IndexSettingsService.java index 06f06c02081..62964b55414 100644 --- a/src/main/java/org/elasticsearch/index/settings/IndexSettingsService.java +++ b/src/main/java/org/elasticsearch/index/settings/IndexSettingsService.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.settings; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.Index; @@ -49,7 +48,7 @@ public class IndexSettingsService extends AbstractIndexComponent { // nothing to update, same settings return; } - this.settings = ImmutableSettings.settingsBuilder().put(this.settings).put(settings).build(); + this.settings = Settings.settingsBuilder().put(this.settings).put(settings).build(); for (Listener listener : listeners) { try { listener.onRefreshSettings(settings); diff --git a/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/src/main/java/org/elasticsearch/index/shard/IndexShard.java index 71c0bc1347d..acac1c07794 100644 --- a/src/main/java/org/elasticsearch/index/shard/IndexShard.java +++ b/src/main/java/org/elasticsearch/index/shard/IndexShard.java @@ -79,7 +79,6 @@ import org.elasticsearch.index.get.ShardGetService; import org.elasticsearch.index.indexing.IndexingStats; import org.elasticsearch.index.indexing.ShardIndexingService; import org.elasticsearch.index.mapper.*; -import org.elasticsearch.index.mapper.internal.ParentFieldMapper; import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.merge.policy.MergePolicyProvider; import org.elasticsearch.index.merge.scheduler.MergeSchedulerProvider; diff --git a/src/main/java/org/elasticsearch/index/similarity/DefaultSimilarityProvider.java b/src/main/java/org/elasticsearch/index/similarity/DefaultSimilarityProvider.java index d43fa298405..a6e04434b3b 100644 --- a/src/main/java/org/elasticsearch/index/similarity/DefaultSimilarityProvider.java +++ b/src/main/java/org/elasticsearch/index/similarity/DefaultSimilarityProvider.java @@ -23,8 +23,6 @@ import org.apache.lucene.search.similarities.DefaultSimilarity; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.assistedinject.Assisted; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.Index; -import org.elasticsearch.index.settings.IndexSettings; /** * {@link SimilarityProvider} for {@link DefaultSimilarity}. diff --git a/src/main/java/org/elasticsearch/index/similarity/SimilarityLookupService.java b/src/main/java/org/elasticsearch/index/similarity/SimilarityLookupService.java index 7e049aa40a8..49e3df989f4 100644 --- a/src/main/java/org/elasticsearch/index/similarity/SimilarityLookupService.java +++ b/src/main/java/org/elasticsearch/index/similarity/SimilarityLookupService.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.similarity; import com.google.common.collect.ImmutableMap; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.Index; @@ -59,7 +58,7 @@ public class SimilarityLookupService extends AbstractIndexComponent { Settings settings = similaritySettings.get(name); if (settings == null) { - settings = ImmutableSettings.Builder.EMPTY_SETTINGS; + settings = Settings.Builder.EMPTY_SETTINGS; } providers.put(name, factory.create(name, settings)); } diff --git a/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java b/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java index 4dbe3d0d79f..38f56af4514 100644 --- a/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java +++ b/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java @@ -20,9 +20,7 @@ package org.elasticsearch.index.similarity; import org.apache.lucene.search.similarities.Similarity; -import org.elasticsearch.common.inject.Provider; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexComponent; /** * Provider for {@link Similarity} instances diff --git a/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java b/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java index 277640b4b89..7c31ca2c8fd 100644 --- a/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java +++ b/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.similarity; import org.apache.lucene.search.similarities.PerFieldSimilarityWrapper; import org.apache.lucene.search.similarities.Similarity; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.Index; @@ -41,7 +40,7 @@ public class SimilarityService extends AbstractIndexComponent { private final Similarity perFieldSimilarity; public SimilarityService(Index index) { - this(index, ImmutableSettings.Builder.EMPTY_SETTINGS); + this(index, Settings.Builder.EMPTY_SETTINGS); } public SimilarityService(Index index, Settings settings) { diff --git a/src/main/java/org/elasticsearch/index/store/IndexStore.java b/src/main/java/org/elasticsearch/index/store/IndexStore.java index cfef4f594be..4022dd75aa1 100644 --- a/src/main/java/org/elasticsearch/index/store/IndexStore.java +++ b/src/main/java/org/elasticsearch/index/store/IndexStore.java @@ -20,13 +20,11 @@ package org.elasticsearch.index.store; import org.apache.lucene.store.StoreRateLimiting; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.Index; -import org.elasticsearch.index.IndexService; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.settings.IndexSettingsService; import org.elasticsearch.indices.store.IndicesStore; diff --git a/src/main/java/org/elasticsearch/index/store/StoreModule.java b/src/main/java/org/elasticsearch/index/store/StoreModule.java index 273455bf214..fe0e314ba16 100644 --- a/src/main/java/org/elasticsearch/index/store/StoreModule.java +++ b/src/main/java/org/elasticsearch/index/store/StoreModule.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.store; import org.elasticsearch.common.inject.AbstractModule; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.ShardLock; import org.elasticsearch.index.shard.ShardPath; diff --git a/src/main/java/org/elasticsearch/index/translog/TranslogService.java b/src/main/java/org/elasticsearch/index/translog/TranslogService.java index 1aa7184a4d9..8897227e991 100644 --- a/src/main/java/org/elasticsearch/index/translog/TranslogService.java +++ b/src/main/java/org/elasticsearch/index/translog/TranslogService.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.translog; import org.elasticsearch.action.admin.indices.flush.FlushRequest; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -34,8 +33,6 @@ import org.elasticsearch.index.shard.*; import org.elasticsearch.threadpool.ThreadPool; import java.io.Closeable; -import java.util.Arrays; -import java.util.Locale; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadLocalRandom; diff --git a/src/main/java/org/elasticsearch/indices/IndicesLifecycle.java b/src/main/java/org/elasticsearch/indices/IndicesLifecycle.java index 39de271bfe8..42262c81e9e 100644 --- a/src/main/java/org/elasticsearch/indices/IndicesLifecycle.java +++ b/src/main/java/org/elasticsearch/indices/IndicesLifecycle.java @@ -21,13 +21,13 @@ package org.elasticsearch.indices; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Nullable; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.shard.IndexShardState; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.settings.IndexSettings; -import org.elasticsearch.common.settings.Settings; /** * A global component allowing to register for lifecycle of an index (create/closed) and diff --git a/src/main/java/org/elasticsearch/indices/IndicesService.java b/src/main/java/org/elasticsearch/indices/IndicesService.java index 18faf0038fe..4f55237f7ca 100644 --- a/src/main/java/org/elasticsearch/indices/IndicesService.java +++ b/src/main/java/org/elasticsearch/indices/IndicesService.java @@ -37,7 +37,6 @@ import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.*; import org.elasticsearch.common.io.FileSystemUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.EsExecutors; @@ -89,7 +88,7 @@ import static com.google.common.collect.Maps.newHashMap; 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.collect.MapBuilder.newMapBuilder; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * @@ -605,7 +604,7 @@ public class IndicesService extends AbstractLifecycleComponent i // play safe here and make sure that we take node level settings into account. // we might run on nodes where we use shard FS and then in the future don't delete // actual content. - ImmutableSettings.Builder builder = settingsBuilder(); + Settings.Builder builder = settingsBuilder(); builder.put(settings); builder.put(metaData.getSettings()); return builder.build(); diff --git a/src/main/java/org/elasticsearch/indices/IndicesWarmer.java b/src/main/java/org/elasticsearch/indices/IndicesWarmer.java index 8df91dba921..2b28842698d 100644 --- a/src/main/java/org/elasticsearch/indices/IndicesWarmer.java +++ b/src/main/java/org/elasticsearch/indices/IndicesWarmer.java @@ -31,7 +31,6 @@ import org.elasticsearch.index.IndexService; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.IndexShard; -import org.elasticsearch.indices.IndicesService; import org.elasticsearch.threadpool.ThreadPool; import java.util.List; diff --git a/src/main/java/org/elasticsearch/indices/SyncedFlushService.java b/src/main/java/org/elasticsearch/indices/SyncedFlushService.java index c4c3fbaa84c..aa42a408a18 100644 --- a/src/main/java/org/elasticsearch/indices/SyncedFlushService.java +++ b/src/main/java/org/elasticsearch/indices/SyncedFlushService.java @@ -36,13 +36,11 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.common.util.concurrent.CountDown; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.IndexShardMissingException; import org.elasticsearch.index.engine.Engine; -import org.elasticsearch.index.shard.IllegalIndexShardStateException; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.IndexShardException; import org.elasticsearch.index.shard.ShardId; @@ -53,9 +51,6 @@ import java.io.IOException; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; public class SyncedFlushService extends AbstractComponent { diff --git a/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java b/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java index 83b9a51b0c8..3c3b398730f 100644 --- a/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java +++ b/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java @@ -28,8 +28,6 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.FileSystemUtils; -import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; @@ -38,7 +36,6 @@ import java.io.InputStream; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.*; /** @@ -226,12 +223,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 ImmutableSettings.settingsBuilder().loadFromPath(file).put(defaults).build(); + return Settings.settingsBuilder().loadFromPath(file).put(defaults).build(); } file = dir.resolve("settings.json"); if (Files.exists(file)) { - return ImmutableSettings.settingsBuilder().loadFromPath(file).put(defaults).build(); + return Settings.settingsBuilder().loadFromPath(file).put(defaults).build(); } return defaults; diff --git a/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java b/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java index 7ed2e7f776b..9acdce3f8ab 100644 --- a/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java +++ b/src/main/java/org/elasticsearch/indices/analysis/IndicesAnalysisService.java @@ -31,7 +31,7 @@ import java.io.Closeable; import java.util.Locale; import java.util.Map; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; /** * A node level registry of analyzers, to be reused by different indices which use default analyzers. diff --git a/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerService.java b/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerService.java index cf9db03463d..b08efaf3e55 100644 --- a/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerService.java +++ b/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerService.java @@ -19,7 +19,6 @@ package org.elasticsearch.indices.breaker; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.settings.Settings; diff --git a/src/main/java/org/elasticsearch/indices/breaker/NoneCircuitBreakerService.java b/src/main/java/org/elasticsearch/indices/breaker/NoneCircuitBreakerService.java index 73d3504b009..c686412bc29 100644 --- a/src/main/java/org/elasticsearch/indices/breaker/NoneCircuitBreakerService.java +++ b/src/main/java/org/elasticsearch/indices/breaker/NoneCircuitBreakerService.java @@ -21,7 +21,7 @@ package org.elasticsearch.indices.breaker; import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.breaker.NoopCircuitBreaker; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; /** * Class that returns a breaker that never breaks @@ -31,7 +31,7 @@ public class NoneCircuitBreakerService extends CircuitBreakerService { private final CircuitBreaker breaker = new NoopCircuitBreaker(CircuitBreaker.FIELDDATA); public NoneCircuitBreakerService() { - super(ImmutableSettings.EMPTY); + super(Settings.EMPTY); } @Override diff --git a/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java b/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java index e95715ddd1f..77832bb052d 100644 --- a/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java +++ b/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java @@ -24,7 +24,6 @@ import com.carrotsearch.hppc.ObjectContainer; import com.carrotsearch.hppc.cursors.ObjectCursor; import com.google.common.base.Predicate; import com.google.common.collect.Lists; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterService; diff --git a/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java b/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java index 013859bab62..26ce397eda5 100644 --- a/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java +++ b/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java @@ -40,7 +40,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.CancellableThreads; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.index.IndexShardMissingException; -import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.RecoveryEngineException; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.IllegalIndexShardStateException; @@ -48,7 +47,6 @@ import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.IndexShardClosedException; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.store.Store; -import org.elasticsearch.index.store.StoreFileMetaData; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.indices.IndicesLifecycle; import org.elasticsearch.threadpool.ThreadPool; @@ -57,7 +55,6 @@ import org.elasticsearch.transport.*; import java.io.IOException; import java.util.Arrays; import java.util.Collections; -import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; diff --git a/src/main/java/org/elasticsearch/indices/store/IndicesStore.java b/src/main/java/org/elasticsearch/indices/store/IndicesStore.java index 36c9be862ee..b5ba372c22c 100644 --- a/src/main/java/org/elasticsearch/indices/store/IndicesStore.java +++ b/src/main/java/org/elasticsearch/indices/store/IndicesStore.java @@ -31,13 +31,11 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; -import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.IndexShardState; @@ -129,7 +127,7 @@ public class IndicesStore extends AbstractComponent implements ClusterStateListe } IndicesStore() { - super(ImmutableSettings.EMPTY); + super(Settings.EMPTY); nodeSettingsService = null; indicesService = null; this.clusterService = null; diff --git a/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java b/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java index c1766a30f51..04cfa6bda3d 100644 --- a/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java +++ b/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java @@ -19,11 +19,8 @@ package org.elasticsearch.indices.store; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.FailedNodeException; import org.elasticsearch.action.support.ActionFilters; @@ -32,7 +29,6 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.Nullable; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -42,7 +38,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.gateway.AsyncShardFetch; import org.elasticsearch.index.IndexService; -import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardPath; @@ -56,7 +51,6 @@ import org.elasticsearch.transport.TransportService; import java.io.IOException; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReferenceArray; diff --git a/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java b/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java index c611b7bc586..6d3540eef46 100644 --- a/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java +++ b/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java @@ -24,7 +24,6 @@ import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; import org.apache.lucene.search.Scorer; import org.apache.lucene.search.SimpleCollector; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkRequest; @@ -43,8 +42,6 @@ import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.fieldvisitor.UidAndRoutingFieldsVisitor; import org.elasticsearch.index.mapper.DocumentMapper; -import org.elasticsearch.index.mapper.FieldMapper; -import org.elasticsearch.index.mapper.FieldMappers; import org.elasticsearch.index.mapper.Uid; import org.elasticsearch.index.mapper.internal.TTLFieldMapper; import org.elasticsearch.index.mapper.internal.UidFieldMapper; diff --git a/src/main/java/org/elasticsearch/monitor/MonitorModule.java b/src/main/java/org/elasticsearch/monitor/MonitorModule.java index 112967cdcbc..23a64ccabb0 100644 --- a/src/main/java/org/elasticsearch/monitor/MonitorModule.java +++ b/src/main/java/org/elasticsearch/monitor/MonitorModule.java @@ -20,9 +20,6 @@ package org.elasticsearch.monitor; import org.elasticsearch.common.inject.AbstractModule; -import org.elasticsearch.common.inject.Scopes; -import org.elasticsearch.common.inject.assistedinject.FactoryProvider; -import org.elasticsearch.common.inject.multibindings.MapBinder; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.fs.FsProbe; @@ -45,8 +42,6 @@ import org.elasticsearch.monitor.process.ProcessService; import org.elasticsearch.monitor.process.SigarProcessProbe; import org.elasticsearch.monitor.sigar.SigarService; -import java.util.Map; - /** * */ diff --git a/src/main/java/org/elasticsearch/monitor/MonitorService.java b/src/main/java/org/elasticsearch/monitor/MonitorService.java index df8926b9083..8307e7fd4e5 100644 --- a/src/main/java/org/elasticsearch/monitor/MonitorService.java +++ b/src/main/java/org/elasticsearch/monitor/MonitorService.java @@ -19,7 +19,6 @@ package org.elasticsearch.monitor; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; diff --git a/src/main/java/org/elasticsearch/monitor/fs/FsService.java b/src/main/java/org/elasticsearch/monitor/fs/FsService.java index c0a3e447cfd..506b42e549b 100644 --- a/src/main/java/org/elasticsearch/monitor/fs/FsService.java +++ b/src/main/java/org/elasticsearch/monitor/fs/FsService.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.SingleObjectCache; -import org.elasticsearch.monitor.os.OsStats; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/monitor/fs/JmxFsProbe.java b/src/main/java/org/elasticsearch/monitor/fs/JmxFsProbe.java index c3012e8bda7..b38f4dbf071 100644 --- a/src/main/java/org/elasticsearch/monitor/fs/JmxFsProbe.java +++ b/src/main/java/org/elasticsearch/monitor/fs/JmxFsProbe.java @@ -25,11 +25,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.NodeEnvironment.NodePath; -import java.io.File; import java.io.IOException; -import java.nio.file.FileStore; -import java.nio.file.Files; -import java.nio.file.Path; public class JmxFsProbe extends AbstractComponent implements FsProbe { diff --git a/src/main/java/org/elasticsearch/monitor/fs/SigarFsProbe.java b/src/main/java/org/elasticsearch/monitor/fs/SigarFsProbe.java index 16acc8489fd..38625dee111 100644 --- a/src/main/java/org/elasticsearch/monitor/fs/SigarFsProbe.java +++ b/src/main/java/org/elasticsearch/monitor/fs/SigarFsProbe.java @@ -32,8 +32,6 @@ import org.hyperic.sigar.FileSystemUsage; import org.hyperic.sigar.Sigar; import org.hyperic.sigar.SigarException; -import java.io.File; -import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; diff --git a/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java b/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java index 64b0eeeefe3..1efd3c7418f 100644 --- a/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java +++ b/src/main/java/org/elasticsearch/monitor/jvm/JvmMonitorService.java @@ -20,7 +20,6 @@ package org.elasticsearch.monitor.jvm; import com.google.common.collect.ImmutableMap; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; diff --git a/src/main/java/org/elasticsearch/node/Node.java b/src/main/java/org/elasticsearch/node/Node.java index 1089ad92c5d..820c3a84534 100644 --- a/src/main/java/org/elasticsearch/node/Node.java +++ b/src/main/java/org/elasticsearch/node/Node.java @@ -44,7 +44,6 @@ import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.network.NetworkModule; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.util.BigArraysModule; @@ -103,7 +102,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * A node represent a node within a cluster (cluster.name). The {@link #client()} can be used @@ -124,7 +123,7 @@ public class Node implements Releasable { private final Client client; public Node() { - this(ImmutableSettings.Builder.EMPTY_SETTINGS, true); + this(Settings.Builder.EMPTY_SETTINGS, true); } public Node(Settings preparedSettings, boolean loadConfigSettings) { diff --git a/src/main/java/org/elasticsearch/node/NodeBuilder.java b/src/main/java/org/elasticsearch/node/NodeBuilder.java index d6040fb38b5..edd89efbee4 100644 --- a/src/main/java/org/elasticsearch/node/NodeBuilder.java +++ b/src/main/java/org/elasticsearch/node/NodeBuilder.java @@ -19,7 +19,6 @@ package org.elasticsearch.node; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; /** @@ -30,7 +29,7 @@ import org.elasticsearch.common.settings.Settings; * elasticsearch.yml or elasticsearch.json). Loading settings can be disabled by calling * {@link #loadConfigSettings(boolean)} with false. *

- *

Explicit settings can be passed by using the {@link #settings(Settings)} method. + *

Explicit settings can be passed by using the {@link #settings(org.elasticsearch.common.settings.Settings)} method. *

*

In any case, settings will be resolved from system properties as well that are either prefixed with es. * or elasticsearch.. @@ -56,7 +55,7 @@ import org.elasticsearch.common.settings.Settings; */ public class NodeBuilder { - private final ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder(); + private final Settings.Builder settings = Settings.settingsBuilder(); private boolean loadConfigSettings = true; @@ -70,14 +69,14 @@ public class NodeBuilder { /** * Set addition settings simply by working directly against the settings builder. */ - public ImmutableSettings.Builder settings() { + public Settings.Builder settings() { return settings; } /** * Set addition settings simply by working directly against the settings builder. */ - public ImmutableSettings.Builder getSettings() { + public Settings.Builder getSettings() { return settings; } diff --git a/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java b/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java index fcb6f3919c6..5b8cebc7547 100644 --- a/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java +++ b/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java @@ -23,7 +23,6 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.Names; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.FailedToResolveConfigException; @@ -31,7 +30,7 @@ import org.elasticsearch.env.FailedToResolveConfigException; import java.util.Map; import static org.elasticsearch.common.Strings.cleanPath; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * @@ -43,7 +42,7 @@ public class InternalSettingsPreparer { String[] ignorePrefixes = new String[]{"es.default.", "elasticsearch.default."}; boolean useSystemProperties = !pSettings.getAsBoolean("config.ignore_system_properties", false); // just create enough settings to build the environment - ImmutableSettings.Builder settingsBuilder = settingsBuilder().put(pSettings); + Settings.Builder settingsBuilder = settingsBuilder().put(pSettings); if (useSystemProperties) { settingsBuilder.putProperties("elasticsearch.default.", System.getProperties()) .putProperties("es.default.", System.getProperties()) diff --git a/src/main/java/org/elasticsearch/node/settings/NodeSettingsService.java b/src/main/java/org/elasticsearch/node/settings/NodeSettingsService.java index da7b81b3a42..8a96e9f1b8f 100644 --- a/src/main/java/org/elasticsearch/node/settings/NodeSettingsService.java +++ b/src/main/java/org/elasticsearch/node/settings/NodeSettingsService.java @@ -25,7 +25,6 @@ import org.elasticsearch.cluster.ClusterStateListener; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.logging.ESLoggerFactory; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import java.util.Map; @@ -37,7 +36,7 @@ import java.util.concurrent.CopyOnWriteArrayList; */ public class NodeSettingsService extends AbstractComponent implements ClusterStateListener { - private static volatile Settings globalSettings = ImmutableSettings.Builder.EMPTY_SETTINGS; + private static volatile Settings globalSettings = Settings.Builder.EMPTY_SETTINGS; /** * Returns the global (static) settings last updated by a node. Note, if you have multiple diff --git a/src/main/java/org/elasticsearch/plugins/AbstractPlugin.java b/src/main/java/org/elasticsearch/plugins/AbstractPlugin.java index 01c446d8f15..0beff2444c5 100644 --- a/src/main/java/org/elasticsearch/plugins/AbstractPlugin.java +++ b/src/main/java/org/elasticsearch/plugins/AbstractPlugin.java @@ -22,7 +22,6 @@ package org.elasticsearch.plugins; import com.google.common.collect.ImmutableList; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import java.io.Closeable; @@ -116,7 +115,7 @@ public abstract class AbstractPlugin implements Plugin { @Override public Settings additionalSettings() { - return ImmutableSettings.Builder.EMPTY_SETTINGS; + return Settings.Builder.EMPTY_SETTINGS; } } diff --git a/src/main/java/org/elasticsearch/plugins/PluginManager.java b/src/main/java/org/elasticsearch/plugins/PluginManager.java index cee8fde738e..f8802b658c2 100644 --- a/src/main/java/org/elasticsearch/plugins/PluginManager.java +++ b/src/main/java/org/elasticsearch/plugins/PluginManager.java @@ -45,7 +45,7 @@ import java.util.*; import static org.elasticsearch.common.Strings.hasLength; import static org.elasticsearch.common.io.FileSystemUtils.moveFilesWithoutOverwriting; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; /** * diff --git a/src/main/java/org/elasticsearch/plugins/PluginsService.java b/src/main/java/org/elasticsearch/plugins/PluginsService.java index 6c82608530d..42146d6c26b 100644 --- a/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -38,7 +38,6 @@ import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.env.Environment; @@ -223,7 +222,7 @@ public class PluginsService extends AbstractComponent { } public Settings updatedSettings() { - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder() + Settings.Builder builder = Settings.settingsBuilder() .put(this.settings); for (Tuple plugin : plugins) { builder.put(plugin.v2().additionalSettings()); diff --git a/src/main/java/org/elasticsearch/repositories/RepositoriesService.java b/src/main/java/org/elasticsearch/repositories/RepositoriesService.java index 5f948a3fdec..a74998aa63e 100644 --- a/src/main/java/org/elasticsearch/repositories/RepositoriesService.java +++ b/src/main/java/org/elasticsearch/repositories/RepositoriesService.java @@ -47,7 +47,7 @@ import java.util.List; import java.util.Map; import static com.google.common.collect.Maps.newHashMap; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; /** * Service responsible for maintaining and providing access to snapshot repositories on nodes. diff --git a/src/main/java/org/elasticsearch/repositories/RepositoryModule.java b/src/main/java/org/elasticsearch/repositories/RepositoryModule.java index 629828442e5..1edbf4046be 100644 --- a/src/main/java/org/elasticsearch/repositories/RepositoryModule.java +++ b/src/main/java/org/elasticsearch/repositories/RepositoryModule.java @@ -21,16 +21,12 @@ package org.elasticsearch.repositories; import com.google.common.collect.ImmutableList; import org.elasticsearch.common.Classes; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Modules; import org.elasticsearch.common.inject.SpawnModules; -import org.elasticsearch.common.settings.NoClassSettingsException; import org.elasticsearch.common.settings.Settings; -import java.util.Locale; - import static org.elasticsearch.common.Strings.toCamelCase; /** diff --git a/src/main/java/org/elasticsearch/rest/BaseRestHandler.java b/src/main/java/org/elasticsearch/rest/BaseRestHandler.java index b291c4366de..8cf9237702e 100644 --- a/src/main/java/org/elasticsearch/rest/BaseRestHandler.java +++ b/src/main/java/org/elasticsearch/rest/BaseRestHandler.java @@ -22,7 +22,6 @@ package org.elasticsearch.rest; import org.elasticsearch.action.*; import org.elasticsearch.client.Client; import org.elasticsearch.client.FilterClient; -import org.elasticsearch.client.support.AbstractClient; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; diff --git a/src/main/java/org/elasticsearch/rest/RestController.java b/src/main/java/org/elasticsearch/rest/RestController.java index bdbd45451fb..f2e36d2b22c 100644 --- a/src/main/java/org/elasticsearch/rest/RestController.java +++ b/src/main/java/org/elasticsearch/rest/RestController.java @@ -20,7 +20,6 @@ package org.elasticsearch.rest; import com.google.common.collect.ImmutableSet; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/verify/RestVerifyRepositoryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/verify/RestVerifyRepositoryAction.java index bbc39cbd2f3..200d9dc9825 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/verify/RestVerifyRepositoryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/verify/RestVerifyRepositoryAction.java @@ -19,21 +19,16 @@ package org.elasticsearch.rest.action.admin.cluster.repositories.verify; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.*; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; import org.elasticsearch.rest.action.support.RestToXContentListener; import static org.elasticsearch.client.Requests.verifyRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; -import static org.elasticsearch.rest.RestRequest.Method.PUT; /** * Registers repositories diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java index 718d16c4705..40061435883 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.Client; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.*; import org.elasticsearch.rest.action.support.AcknowledgedRestListener; @@ -59,10 +58,10 @@ public class RestUpdateSettingsAction extends BaseRestHandler { updateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", updateSettingsRequest.masterNodeTimeout())); updateSettingsRequest.indicesOptions(IndicesOptions.fromRequest(request, updateSettingsRequest.indicesOptions())); - ImmutableSettings.Builder updateSettings = ImmutableSettings.settingsBuilder(); + Settings.Builder updateSettings = Settings.settingsBuilder(); String bodySettingsStr = request.content().toUtf8(); if (Strings.hasText(bodySettingsStr)) { - Settings buildSettings = ImmutableSettings.settingsBuilder().loadFromSource(bodySettingsStr).build(); + Settings buildSettings = Settings.settingsBuilder().loadFromSource(bodySettingsStr).build(); for (Map.Entry entry : buildSettings.getAsMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java index 1dd086eb3ce..6ea428bc31a 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.optimize.OptimizeResponse; import org.elasticsearch.action.admin.indices.segments.*; import org.elasticsearch.client.Client; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index c15e8c28c8c..3776841d981 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.rest.action.cat; -import com.carrotsearch.hppc.ObjectIntHashMap; import com.carrotsearch.hppc.ObjectIntScatterMap; import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; diff --git a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java index 8bdbef325ef..5b567b0e32c 100644 --- a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java @@ -19,7 +19,6 @@ package org.elasticsearch.rest.action.main; -import org.apache.lucene.util.Constants; import org.elasticsearch.Build; import org.elasticsearch.Version; import org.elasticsearch.client.Client; diff --git a/src/main/java/org/elasticsearch/river/RiverModule.java b/src/main/java/org/elasticsearch/river/RiverModule.java index 50752550b55..83a686903b2 100644 --- a/src/main/java/org/elasticsearch/river/RiverModule.java +++ b/src/main/java/org/elasticsearch/river/RiverModule.java @@ -25,8 +25,8 @@ import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.inject.Modules; import org.elasticsearch.common.inject.SpawnModules; -import org.elasticsearch.common.settings.NoClassSettingsException; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.NoClassSettingsException; import java.util.Locale; import java.util.Map; diff --git a/src/main/java/org/elasticsearch/river/RiversManager.java b/src/main/java/org/elasticsearch/river/RiversManager.java index 42d7021a5f3..c1fc6da82b2 100644 --- a/src/main/java/org/elasticsearch/river/RiversManager.java +++ b/src/main/java/org/elasticsearch/river/RiversManager.java @@ -19,7 +19,6 @@ package org.elasticsearch.river; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; diff --git a/src/main/java/org/elasticsearch/river/RiversService.java b/src/main/java/org/elasticsearch/river/RiversService.java index fdb2589a540..268956eecf8 100644 --- a/src/main/java/org/elasticsearch/river/RiversService.java +++ b/src/main/java/org/elasticsearch/river/RiversService.java @@ -22,7 +22,6 @@ package org.elasticsearch.river; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.WriteConsistencyLevel; diff --git a/src/main/java/org/elasticsearch/river/cluster/RiverClusterService.java b/src/main/java/org/elasticsearch/river/cluster/RiverClusterService.java index 11a0350a40d..3a5208da457 100644 --- a/src/main/java/org/elasticsearch/river/cluster/RiverClusterService.java +++ b/src/main/java/org/elasticsearch/river/cluster/RiverClusterService.java @@ -19,7 +19,6 @@ package org.elasticsearch.river.cluster; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.component.AbstractLifecycleComponent; diff --git a/src/main/java/org/elasticsearch/river/routing/RiversRouter.java b/src/main/java/org/elasticsearch/river/routing/RiversRouter.java index 288d6ff0d16..065d71d077c 100644 --- a/src/main/java/org/elasticsearch/river/routing/RiversRouter.java +++ b/src/main/java/org/elasticsearch/river/routing/RiversRouter.java @@ -22,7 +22,6 @@ package org.elasticsearch.river.routing; import com.carrotsearch.hppc.cursors.ObjectCursor; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.NoShardAvailableActionException; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.client.Client; diff --git a/src/main/java/org/elasticsearch/snapshots/RestoreService.java b/src/main/java/org/elasticsearch/snapshots/RestoreService.java index 9b0dfc70b64..9aabab8580b 100644 --- a/src/main/java/org/elasticsearch/snapshots/RestoreService.java +++ b/src/main/java/org/elasticsearch/snapshots/RestoreService.java @@ -46,7 +46,6 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; @@ -208,7 +207,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis createIndexService.validateIndexName(renamedIndex, currentState); createIndexService.validateIndexSettings(renamedIndex, snapshotIndexMetaData.settings()); IndexMetaData.Builder indexMdBuilder = IndexMetaData.builder(snapshotIndexMetaData).state(IndexMetaData.State.OPEN).index(renamedIndex); - indexMdBuilder.settings(ImmutableSettings.settingsBuilder().put(snapshotIndexMetaData.settings()).put(IndexMetaData.SETTING_UUID, Strings.randomBase64UUID())); + indexMdBuilder.settings(Settings.settingsBuilder().put(snapshotIndexMetaData.settings()).put(IndexMetaData.SETTING_UUID, Strings.randomBase64UUID())); if (!request.includeAliases() && !snapshotIndexMetaData.aliases().isEmpty()) { // Remove all aliases - they shouldn't be restored indexMdBuilder.removeAllAliases(); @@ -242,7 +241,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis aliases.add(alias.value); } } - indexMdBuilder.settings(ImmutableSettings.settingsBuilder().put(snapshotIndexMetaData.settings()).put(IndexMetaData.SETTING_UUID, currentIndexMetaData.uuid())); + indexMdBuilder.settings(Settings.settingsBuilder().put(snapshotIndexMetaData.settings()).put(IndexMetaData.SETTING_UUID, currentIndexMetaData.uuid())); IndexMetaData updatedIndexMetaData = indexMdBuilder.index(renamedIndex).build(); rtBuilder.addAsRestore(updatedIndexMetaData, restoreSource); blocks.removeIndexBlock(renamedIndex, INDEX_CLOSED_BLOCK); @@ -334,7 +333,7 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis if (changeSettings.names().isEmpty() && ignoreSettings.length == 0) { return indexMetaData; } - Settings normalizedChangeSettings = ImmutableSettings.settingsBuilder().put(changeSettings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); + Settings normalizedChangeSettings = Settings.settingsBuilder().put(changeSettings).normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build(); IndexMetaData.Builder builder = IndexMetaData.builder(indexMetaData); Map settingsMap = newHashMap(indexMetaData.settings().getAsMap()); List simpleMatchPatterns = newArrayList(); @@ -369,14 +368,14 @@ public class RestoreService extends AbstractComponent implements ClusterStateLis } } - return builder.settings(ImmutableSettings.builder().put(settingsMap)).build(); + return builder.settings(Settings.builder().put(settingsMap)).build(); } private void restoreGlobalStateIfRequested(MetaData.Builder mdBuilder) { if (request.includeGlobalState()) { if (metaData.persistentSettings() != null) { boolean changed = false; - ImmutableSettings.Builder persistentSettings = ImmutableSettings.settingsBuilder().put(); + Settings.Builder persistentSettings = Settings.settingsBuilder().put(); for (Map.Entry entry : metaData.persistentSettings().getAsMap().entrySet()) { if (dynamicSettings.isDynamicOrLoggingSetting(entry.getKey())) { String error = dynamicSettings.validateDynamicSetting(entry.getKey(), entry.getValue()); diff --git a/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java b/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java index e651107f20a..cdf068cecee 100644 --- a/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java +++ b/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.apache.lucene.util.CollectionUtil; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.action.support.IndicesOptions; diff --git a/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index 199b34aba15..750d670ad7f 100644 --- a/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -26,11 +26,9 @@ import com.google.common.util.concurrent.MoreExecutors; import org.apache.lucene.util.Counter; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.component.AbstractComponent; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.common.unit.SizeValue; @@ -52,7 +50,7 @@ import java.util.Queue; import java.util.concurrent.*; import static org.elasticsearch.common.collect.MapBuilder.newMapBuilder; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.unit.SizeValue.parseSizeValue; import static org.elasticsearch.common.unit.TimeValue.timeValueMinutes; @@ -97,7 +95,7 @@ public class ThreadPool extends AbstractComponent { public ThreadPool(String name) { - this(ImmutableSettings.builder().put("name", name).build()); + this(Settings.builder().put("name", name).build()); } public ThreadPool(Settings settings) { @@ -141,7 +139,7 @@ public class ThreadPool extends AbstractComponent { if (executors.containsKey(entry.getKey())) { continue; } - executors.put(entry.getKey(), build(entry.getKey(), entry.getValue(), ImmutableSettings.EMPTY)); + executors.put(entry.getKey(), build(entry.getKey(), entry.getValue(), Settings.EMPTY)); } executors.put(Names.SAME, new ExecutorHolder(MoreExecutors.directExecutor(), new Info(Names.SAME, "same"))); @@ -304,7 +302,7 @@ public class ThreadPool extends AbstractComponent { return previousExecutorHolder; } if (settings == null) { - settings = ImmutableSettings.Builder.EMPTY_SETTINGS; + settings = Settings.Builder.EMPTY_SETTINGS; } Info previousInfo = previousExecutorHolder != null ? previousExecutorHolder.info : null; String type = settings.get("type", previousInfo != null ? previousInfo.getType() : defaultSettings.get("type")); @@ -453,7 +451,7 @@ public class ThreadPool extends AbstractComponent { } ExecutorHolder oldExecutorHolder = executors.get(entry.getKey()); - ExecutorHolder newExecutorHolder = rebuild(entry.getKey(), oldExecutorHolder, entry.getValue(), ImmutableSettings.EMPTY); + ExecutorHolder newExecutorHolder = rebuild(entry.getKey(), oldExecutorHolder, entry.getValue(), Settings.EMPTY); // Can't introduce new thread pools at runtime, because The oldExecutorHolder variable will be null in the // case the settings contains a thread pool not defined in the initial settings in the constructor. The if // statement will then fail and so this prevents the addition of new thread groups at runtime, which is desired. diff --git a/src/main/java/org/elasticsearch/threadpool/ThreadPoolModule.java b/src/main/java/org/elasticsearch/threadpool/ThreadPoolModule.java index b767af62275..9a507f883ac 100644 --- a/src/main/java/org/elasticsearch/threadpool/ThreadPoolModule.java +++ b/src/main/java/org/elasticsearch/threadpool/ThreadPoolModule.java @@ -20,7 +20,6 @@ package org.elasticsearch.threadpool; import org.elasticsearch.common.inject.AbstractModule; -import org.elasticsearch.common.settings.Settings; /** * diff --git a/src/main/java/org/elasticsearch/transport/TransportService.java b/src/main/java/org/elasticsearch/transport/TransportService.java index 269240259b9..9856005660b 100644 --- a/src/main/java/org/elasticsearch/transport/TransportService.java +++ b/src/main/java/org/elasticsearch/transport/TransportService.java @@ -48,7 +48,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; /** * diff --git a/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java b/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java index 31c633acf7d..fc3f484bca7 100644 --- a/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java +++ b/src/main/java/org/elasticsearch/transport/netty/NettyTransport.java @@ -42,7 +42,6 @@ import org.elasticsearch.common.netty.OpenChannelsHandler; import org.elasticsearch.common.netty.ReleaseChannelFutureListener; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.network.NetworkUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress; @@ -82,7 +81,7 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import static org.elasticsearch.common.network.NetworkService.TcpSettings.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -246,7 +245,7 @@ public class NettyTransport extends AbstractLifecycleComponent implem Map profiles = settings.getGroups("transport.profiles", true); if (!profiles.containsKey(DEFAULT_PROFILE)) { profiles = Maps.newHashMap(profiles); - profiles.put(DEFAULT_PROFILE, ImmutableSettings.EMPTY); + profiles.put(DEFAULT_PROFILE, Settings.EMPTY); } Settings fallbackSettings = createFallbackSettings(); @@ -353,7 +352,7 @@ public class NettyTransport extends AbstractLifecycleComponent implem } private Settings createFallbackSettings() { - ImmutableSettings.Builder fallbackSettingsBuilder = settingsBuilder(); + Settings.Builder fallbackSettingsBuilder = settingsBuilder(); String fallbackBindHost = settings.get("transport.netty.bind_host", settings.get("transport.bind_host", settings.get("transport.host"))); if (fallbackBindHost != null) { diff --git a/src/main/java/org/elasticsearch/tribe/TribeService.java b/src/main/java/org/elasticsearch/tribe/TribeService.java index d0cfe765817..540d3254e5c 100644 --- a/src/main/java/org/elasticsearch/tribe/TribeService.java +++ b/src/main/java/org/elasticsearch/tribe/TribeService.java @@ -39,7 +39,6 @@ import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.discovery.DiscoveryService; @@ -80,7 +79,7 @@ public class TribeService extends AbstractLifecycleComponent { if (settings.get(TRIBE_NAME) != null) { // if its a node client started by this service as tribe, remove any tribe group setting // to avoid recursive configuration - ImmutableSettings.Builder sb = ImmutableSettings.builder().put(settings); + Settings.Builder sb = Settings.builder().put(settings); for (String s : settings.getAsMap().keySet()) { if (s.startsWith("tribe.") && !s.equals(TRIBE_NAME)) { sb.remove(s); @@ -93,7 +92,7 @@ public class TribeService extends AbstractLifecycleComponent { return settings; } // its a tribe configured node..., force settings - ImmutableSettings.Builder sb = ImmutableSettings.builder().put(settings); + Settings.Builder sb = Settings.builder().put(settings); sb.put("node.client", true); // this node should just act as a node client sb.put("discovery.type", "local"); // a tribe node should not use zen discovery sb.put("discovery.initial_state_timeout", 0); // nothing is going to be discovered, since no master will be elected @@ -125,7 +124,7 @@ public class TribeService extends AbstractLifecycleComponent { nodesSettings.remove("blocks"); // remove prefix settings that don't indicate a client nodesSettings.remove("on_conflict"); // remove prefix settings that don't indicate a client for (Map.Entry entry : nodesSettings.entrySet()) { - ImmutableSettings.Builder sb = ImmutableSettings.builder().put(entry.getValue()); + Settings.Builder sb = Settings.builder().put(entry.getValue()); sb.put("node.name", settings.get("name") + "/" + entry.getKey()); sb.put("path.home", settings.get("path.home")); // pass through ES home dir sb.put(TRIBE_NAME, entry.getKey()); @@ -256,7 +255,7 @@ public class TribeService extends AbstractLifecycleComponent { // always make sure to update the metadata and routing table, in case // there are changes in them (new mapping, shards moving from initializing to started) routingTable.add(tribeState.routingTable().index(index.index())); - Settings tribeSettings = ImmutableSettings.builder().put(tribeIndex.settings()).put(TRIBE_NAME, tribeName).build(); + Settings tribeSettings = Settings.builder().put(tribeIndex.settings()).put(TRIBE_NAME, tribeName).build(); metaData.put(IndexMetaData.builder(tribeIndex).settings(tribeSettings)); } } @@ -310,7 +309,7 @@ public class TribeService extends AbstractLifecycleComponent { } private void addNewIndex(ClusterState tribeState, ClusterBlocks.Builder blocks, MetaData.Builder metaData, RoutingTable.Builder routingTable, IndexMetaData tribeIndex) { - Settings tribeSettings = ImmutableSettings.builder().put(tribeIndex.settings()).put(TRIBE_NAME, tribeName).build(); + Settings tribeSettings = Settings.builder().put(tribeIndex.settings()).put(TRIBE_NAME, tribeName).build(); metaData.put(IndexMetaData.builder(tribeIndex).settings(tribeSettings)); routingTable.add(tribeState.routingTable().index(tribeIndex.index())); if (Regex.simpleMatch(blockIndicesMetadata, tribeIndex.index())) { diff --git a/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java b/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java index 90e37447bb5..ebb5bb84623 100644 --- a/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java +++ b/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.watcher; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; diff --git a/src/test/java/org/elasticsearch/VersionTests.java b/src/test/java/org/elasticsearch/VersionTests.java index 65d6a4f25e2..5b8c8c5d4ea 100644 --- a/src/test/java/org/elasticsearch/VersionTests.java +++ b/src/test/java/org/elasticsearch/VersionTests.java @@ -21,7 +21,7 @@ package org.elasticsearch; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.VersionUtils; import org.hamcrest.Matchers; @@ -119,13 +119,13 @@ public class VersionTests extends ElasticsearchTestCase { @Test(expected = IllegalStateException.class) public void testVersionNoPresentInSettings() { - Version.indexCreated(ImmutableSettings.builder().build()); + Version.indexCreated(Settings.builder().build()); } public void testIndexCreatedVersion() { // an actual index has a IndexMetaData.SETTING_UUID final Version version = randomFrom(Version.V_0_18_0, Version.V_0_90_13, Version.V_1_3_0); - assertEquals(version, Version.indexCreated(ImmutableSettings.builder().put(IndexMetaData.SETTING_UUID, "foo").put(IndexMetaData.SETTING_VERSION_CREATED, version).build())); + assertEquals(version, Version.indexCreated(Settings.builder().put(IndexMetaData.SETTING_UUID, "foo").put(IndexMetaData.SETTING_VERSION_CREATED, version).build())); } public void testMinCompatVersion() { diff --git a/src/test/java/org/elasticsearch/action/IndicesRequestTests.java b/src/test/java/org/elasticsearch/action/IndicesRequestTests.java index 37f61da4679..62df5e8fd54 100644 --- a/src/test/java/org/elasticsearch/action/IndicesRequestTests.java +++ b/src/test/java/org/elasticsearch/action/IndicesRequestTests.java @@ -89,7 +89,6 @@ import org.elasticsearch.action.update.UpdateAction; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilders; @@ -130,7 +129,7 @@ public class IndicesRequestTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, InterceptingTransportService.class.getName()) .build(); @@ -607,7 +606,7 @@ public class IndicesRequestTests extends ElasticsearchIntegrationTest { public void testUpdateSettings() { interceptTransportActions(UpdateSettingsAction.NAME); - UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(randomIndicesOrAliases()).settings(ImmutableSettings.builder().put("refresh_interval", -1)); + UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(randomIndicesOrAliases()).settings(Settings.builder().put("refresh_interval", -1)); internalCluster().clientNodeClient().admin().indices().updateSettings(updateSettingsRequest).actionGet(); clearInterceptedActions(); diff --git a/src/test/java/org/elasticsearch/action/RejectionActionTests.java b/src/test/java/org/elasticsearch/action/RejectionActionTests.java index effe0b1785b..273caa52296 100644 --- a/src/test/java/org/elasticsearch/action/RejectionActionTests.java +++ b/src/test/java/org/elasticsearch/action/RejectionActionTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; import org.elasticsearch.index.query.QueryBuilders; @@ -46,7 +45,7 @@ public class RejectionActionTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("threadpool.search.size", 1) .put("threadpool.search.queue_size", 1) diff --git a/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksTests.java b/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksTests.java index efdd0cf4b08..0fa72040da9 100644 --- a/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksTests.java +++ b/src/test/java/org/elasticsearch/action/admin/cluster/repositories/RepositoryBlocksTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.cluster.repositories; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.junit.Test; @@ -48,7 +48,7 @@ public class RepositoryBlocksTests extends ElasticsearchIntegrationTest { assertBlocked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())), MetaData.CLUSTER_READ_ONLY_BLOCK); + .setSettings(Settings.settingsBuilder().put("location", randomRepoPath())), MetaData.CLUSTER_READ_ONLY_BLOCK); } finally { setClusterReadOnly(false); } @@ -57,7 +57,7 @@ public class RepositoryBlocksTests extends ElasticsearchIntegrationTest { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); } @Test @@ -65,7 +65,7 @@ public class RepositoryBlocksTests extends ElasticsearchIntegrationTest { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); // This test checks that the Get Repository operation is never blocked, even if the cluster is read only. try { @@ -82,7 +82,7 @@ public class RepositoryBlocksTests extends ElasticsearchIntegrationTest { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); logger.info("--> deleting a repository is blocked when the cluster is read only"); try { @@ -101,7 +101,7 @@ public class RepositoryBlocksTests extends ElasticsearchIntegrationTest { assertAcked(client().admin().cluster().preparePutRepository("test-repo-blocks") .setType("fs") .setVerify(false) - .setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.settingsBuilder().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/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksTests.java b/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksTests.java index 8817eb90a67..e01f0915938 100644 --- a/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksTests.java +++ b/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/SnapshotBlocksTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; @@ -61,7 +61,7 @@ public class SnapshotBlocksTests extends ElasticsearchIntegrationTest { logger.info("--> register a repository"); assertAcked(client().admin().cluster().preparePutRepository(REPOSITORY_NAME) .setType("fs") - .setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath()))); + .setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); logger.info("--> verify the repository"); VerifyRepositoryResponse verifyResponse = client().admin().cluster().prepareVerifyRepository(REPOSITORY_NAME).get(); diff --git a/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java b/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java index 86b8368853a..9945eceaa5c 100644 --- a/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java +++ b/src/test/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.client.Requests; import org.elasticsearch.common.Priority; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.store.Store; import org.elasticsearch.monitor.sigar.SigarService; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -34,7 +34,7 @@ import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.is; @@ -61,17 +61,17 @@ public class ClusterStatsTests extends ElasticsearchIntegrationTest { ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get(); assertCounts(response.getNodesStats().getCounts(), 1, 0, 0, 1, 0); - internalCluster().startNode(ImmutableSettings.builder().put("node.data", false)); + internalCluster().startNode(Settings.builder().put("node.data", false)); waitForNodes(2); response = client().admin().cluster().prepareClusterStats().get(); assertCounts(response.getNodesStats().getCounts(), 2, 1, 0, 1, 0); - internalCluster().startNode(ImmutableSettings.builder().put("node.master", false)); + internalCluster().startNode(Settings.builder().put("node.master", false)); waitForNodes(3); response = client().admin().cluster().prepareClusterStats().get(); assertCounts(response.getNodesStats().getCounts(), 3, 1, 1, 1, 0); - internalCluster().startNode(ImmutableSettings.builder().put("node.client", true)); + internalCluster().startNode(Settings.builder().put("node.client", true)); waitForNodes(4); response = client().admin().cluster().prepareClusterStats().get(); assertCounts(response.getNodesStats().getCounts(), 4, 1, 1, 1, 1); diff --git a/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexTests.java b/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexTests.java index a8318101bf2..5b020f2ab39 100644 --- a/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexTests.java +++ b/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; @@ -42,7 +42,7 @@ public class CreateIndexTests extends ElasticsearchIntegrationTest{ @Test public void testCreationDate_Given() { - prepareCreate("test").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_CREATION_DATE, 4l)).get(); + prepareCreate("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_CREATION_DATE, 4l)).get(); ClusterStateResponse response = client().admin().cluster().prepareState().get(); ClusterState state = response.getState(); assertThat(state, notNullValue()); @@ -105,7 +105,7 @@ public class CreateIndexTests extends ElasticsearchIntegrationTest{ @Test public void testInvalidShardCountSettings() throws Exception { try { - prepareCreate("test").setSettings(ImmutableSettings.builder() + prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, randomIntBetween(-10, 0)) .build()) .get(); @@ -116,7 +116,7 @@ public class CreateIndexTests extends ElasticsearchIntegrationTest{ } try { - prepareCreate("test").setSettings(ImmutableSettings.builder() + prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(-10, -1)) .build()) .get(); @@ -127,7 +127,7 @@ public class CreateIndexTests extends ElasticsearchIntegrationTest{ } try { - prepareCreate("test").setSettings(ImmutableSettings.builder() + prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, randomIntBetween(-10, 0)) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(-10, -1)) .build()) @@ -154,7 +154,7 @@ public class CreateIndexTests extends ElasticsearchIntegrationTest{ @Test public void testInvalidShardCountSettingsWithoutPrefix() throws Exception { try { - prepareCreate("test").setSettings(ImmutableSettings.builder() + prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS.substring(IndexMetaData.INDEX_SETTING_PREFIX.length()), randomIntBetween(-10, 0)) .build()) .get(); @@ -164,7 +164,7 @@ public class CreateIndexTests extends ElasticsearchIntegrationTest{ e.getMessage().contains("index must have 1 or more primary shards"), equalTo(true)); } try { - prepareCreate("test").setSettings(ImmutableSettings.builder() + prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS.substring(IndexMetaData.INDEX_SETTING_PREFIX.length()), randomIntBetween(-10, -1)) .build()) .get(); @@ -174,7 +174,7 @@ public class CreateIndexTests extends ElasticsearchIntegrationTest{ e.getMessage().contains("index must have 0 or more replica shards"), equalTo(true)); } try { - prepareCreate("test").setSettings(ImmutableSettings.builder() + prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS.substring(IndexMetaData.INDEX_SETTING_PREFIX.length()), randomIntBetween(-10, 0)) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS.substring(IndexMetaData.INDEX_SETTING_PREFIX.length()), randomIntBetween(-10, -1)) .build()) diff --git a/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexTests.java b/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexTests.java index 2b4f4bcab6b..d2e996d6235 100644 --- a/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexTests.java +++ b/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature; import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.search.warmer.IndexWarmersMetaData.Entry; @@ -49,7 +48,7 @@ public class GetIndexTests extends ElasticsearchIntegrationTest { @Override protected void setupSuiteScopeCluster() throws Exception { assertAcked(prepareCreate("idx").addAlias(new Alias("alias_idx")).addMapping("type1", "{\"type1\":{}}") - .setSettings(ImmutableSettings.builder().put("number_of_shards", 1)).get()); + .setSettings(Settings.builder().put("number_of_shards", 1)).get()); ensureSearchable("idx"); assertAcked(client().admin().indices().preparePutWarmer("warmer1").setSearchRequest(client().prepareSearch("idx")).get()); createIndex("empty_idx"); diff --git a/src/test/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentsRequestTests.java b/src/test/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentsRequestTests.java index e46ca1572ce..df9fbda67cc 100644 --- a/src/test/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentsRequestTests.java +++ b/src/test/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentsRequestTests.java @@ -19,12 +19,9 @@ package org.elasticsearch.action.admin.indices.segments; -import org.elasticsearch.action.ListenableActionFuture; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.engine.Segment; -import org.elasticsearch.indices.IndexClosedException; import org.elasticsearch.test.ElasticsearchSingleNodeTest; import org.junit.Before; import org.junit.Test; @@ -35,7 +32,7 @@ public class IndicesSegmentsRequestTests extends ElasticsearchSingleNodeTest { @Before public void setupIndex() { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() // don't allow any merges so that the num docs is the expected segments .put("index.merge.policy.segments_per_tier", 1000000f) .build(); diff --git a/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsTests.java b/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsTests.java index 5140df378dd..800a49453cf 100644 --- a/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsTests.java +++ b/src/test/java/org/elasticsearch/action/bulk/BulkProcessorClusterSettingsTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.action.bulk; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; @@ -32,7 +31,7 @@ public class BulkProcessorClusterSettingsTests extends ElasticsearchIntegrationT @Test public void testBulkProcessorAutoCreateRestrictions() throws Exception { // See issue #8125 - Settings settings = ImmutableSettings.settingsBuilder().put("action.auto_create_index", false).build(); + Settings settings = Settings.settingsBuilder().put("action.auto_create_index", false).build(); internalCluster().startNode(settings); diff --git a/src/test/java/org/elasticsearch/action/bulk/BulkProcessorTests.java b/src/test/java/org/elasticsearch/action/bulk/BulkProcessorTests.java index 920ae42333a..ad1e9d97719 100644 --- a/src/test/java/org/elasticsearch/action/bulk/BulkProcessorTests.java +++ b/src/test/java/org/elasticsearch/action/bulk/BulkProcessorTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -158,7 +157,7 @@ public class BulkProcessorTests extends ElasticsearchIntegrationTest { //https://github.com/elasticsearch/elasticsearch/issues/5038 public void testBulkProcessorConcurrentRequestsNoNodeAvailableException() throws Exception { //we create a transport client with no nodes to make sure it throws NoNodeAvailableException - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.home", createTempDir().toString()) .build(); Client transportClient = TransportClient.builder().settings(settings).build(); @@ -232,7 +231,7 @@ public class BulkProcessorTests extends ElasticsearchIntegrationTest { public void testBulkProcessorConcurrentRequestsReadOnlyIndex() throws Exception { createIndex("test-ro"); assertAcked(client().admin().indices().prepareUpdateSettings("test-ro") - .setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_BLOCKS_WRITE, true))); + .setSettings(Settings.builder().put(IndexMetaData.SETTING_BLOCKS_WRITE, true))); ensureGreen(); int bulkActions = randomIntBetween(10, 100); diff --git a/src/test/java/org/elasticsearch/action/count/CountRequestBuilderTests.java b/src/test/java/org/elasticsearch/action/count/CountRequestBuilderTests.java index ceabdd58965..98ab1632e2c 100644 --- a/src/test/java/org/elasticsearch/action/count/CountRequestBuilderTests.java +++ b/src/test/java/org/elasticsearch/action/count/CountRequestBuilderTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.support.QuerySourceBuilder; import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -48,7 +47,7 @@ public class CountRequestBuilderTests extends ElasticsearchTestCase { public static void initClient() { //this client will not be hit by any request, but it needs to be a non null proper client //that is why we create it but we don't add any transport address to it - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.home", createTempDir().toString()) .build(); client = TransportClient.builder().settings(settings).build(); diff --git a/src/test/java/org/elasticsearch/action/search/SearchRequestBuilderTests.java b/src/test/java/org/elasticsearch/action/search/SearchRequestBuilderTests.java index dec0e8238ea..900c2787804 100644 --- a/src/test/java/org/elasticsearch/action/search/SearchRequestBuilderTests.java +++ b/src/test/java/org/elasticsearch/action/search/SearchRequestBuilderTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.action.search; import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -47,7 +46,7 @@ public class SearchRequestBuilderTests extends ElasticsearchTestCase { public static void initClient() { //this client will not be hit by any request, but it needs to be a non null proper client //that is why we create it but we don't add any transport address to it - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.home", createTempDir().toString()) .build(); client = TransportClient.builder().settings(settings).build(); diff --git a/src/test/java/org/elasticsearch/action/support/TransportActionFilterChainTests.java b/src/test/java/org/elasticsearch/action/support/TransportActionFilterChainTests.java index e32eb6cdb7c..a5a5bc45122 100644 --- a/src/test/java/org/elasticsearch/action/support/TransportActionFilterChainTests.java +++ b/src/test/java/org/elasticsearch/action/support/TransportActionFilterChainTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Before; import org.junit.Test; @@ -64,7 +64,7 @@ public class TransportActionFilterChainTests extends ElasticsearchTestCase { String actionName = randomAsciiOfLength(randomInt(30)); ActionFilters actionFilters = new ActionFilters(filters); - TransportAction transportAction = new TransportAction(ImmutableSettings.EMPTY, actionName, null, actionFilters) { + TransportAction transportAction = new TransportAction(Settings.EMPTY, actionName, null, actionFilters) { @Override protected void doExecute(TestRequest request, ActionListener listener) { listener.onResponse(new TestResponse()); @@ -146,7 +146,7 @@ public class TransportActionFilterChainTests extends ElasticsearchTestCase { String actionName = randomAsciiOfLength(randomInt(30)); ActionFilters actionFilters = new ActionFilters(filters); - TransportAction transportAction = new TransportAction(ImmutableSettings.EMPTY, actionName, null, actionFilters) { + TransportAction transportAction = new TransportAction(Settings.EMPTY, actionName, null, actionFilters) { @Override protected void doExecute(TestRequest request, ActionListener listener) { listener.onResponse(new TestResponse()); @@ -231,7 +231,7 @@ public class TransportActionFilterChainTests extends ElasticsearchTestCase { String actionName = randomAsciiOfLength(randomInt(30)); ActionFilters actionFilters = new ActionFilters(filters); - TransportAction transportAction = new TransportAction(ImmutableSettings.EMPTY, actionName, null, actionFilters) { + TransportAction transportAction = new TransportAction(Settings.EMPTY, actionName, null, actionFilters) { @Override protected void doExecute(TestRequest request, ActionListener listener) { listener.onResponse(new TestResponse()); @@ -289,7 +289,7 @@ public class TransportActionFilterChainTests extends ElasticsearchTestCase { String actionName = randomAsciiOfLength(randomInt(30)); ActionFilters actionFilters = new ActionFilters(filters); - TransportAction transportAction = new TransportAction(ImmutableSettings.EMPTY, actionName, null, actionFilters) { + TransportAction transportAction = new TransportAction(Settings.EMPTY, actionName, null, actionFilters) { @Override protected void doExecute(TestRequest request, ActionListener listener) { listener.onResponse(new TestResponse()); diff --git a/src/test/java/org/elasticsearch/action/support/replication/ShardReplicationOperationTests.java b/src/test/java/org/elasticsearch/action/support/replication/ShardReplicationOperationTests.java index 9720fae0292..fd95cffa2ad 100644 --- a/src/test/java/org/elasticsearch/action/support/replication/ShardReplicationOperationTests.java +++ b/src/test/java/org/elasticsearch/action/support/replication/ShardReplicationOperationTests.java @@ -54,7 +54,6 @@ import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.lease.Releasable; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.index.shard.IndexShardNotStartedException; @@ -119,7 +118,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { clusterService = new TestClusterService(threadPool); transportService = new TransportService(transport, threadPool); transportService.start(); - action = new Action(ImmutableSettings.EMPTY, "testAction", transportService, clusterService, threadPool); + action = new Action(Settings.EMPTY, "testAction", transportService, clusterService, threadPool); count.set(1); } @@ -215,7 +214,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { } discoBuilder.localNodeId(newNode(0).id()); discoBuilder.masterNodeId(newNode(1).id()); // we need a non-local master to test shard failures - IndexMetaData indexMetaData = IndexMetaData.builder(index).settings(ImmutableSettings.builder() + IndexMetaData indexMetaData = IndexMetaData.builder(index).settings(Settings.builder() .put(SETTING_VERSION_CREATED, Version.CURRENT) .put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas) .put(SETTING_CREATION_DATE, System.currentTimeMillis())).build(); @@ -333,7 +332,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { @Test public void testWriteConsistency() throws ExecutionException, InterruptedException { - action = new ActionWithConsistency(ImmutableSettings.EMPTY, "testActionWithConsistency", transportService, clusterService, threadPool); + action = new ActionWithConsistency(Settings.EMPTY, "testActionWithConsistency", transportService, clusterService, threadPool); final String index = "test"; final ShardId shardId = new ShardId(index, 0); final int assignedReplicas = randomInt(2); @@ -430,7 +429,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { ClusterState state = stateWithStartedPrimary(index, true, randomInt(5)); MetaData.Builder metaData = MetaData.builder(state.metaData()); - ImmutableSettings.Builder settings = ImmutableSettings.builder().put(metaData.get(index).settings()); + Settings.Builder settings = Settings.builder().put(metaData.get(index).settings()); settings.put(IndexMetaData.SETTING_SHADOW_REPLICAS, true); metaData.put(IndexMetaData.builder(metaData.get(index)).settings(settings)); clusterService.setState(ClusterState.builder(state).metaData(metaData)); @@ -532,7 +531,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { * TODO: I could also write an action that asserts that the counter is 2 in the shard operation. * However, this failure would only become apparent once listener.get is called. Seems a little implicit. * */ - action = new ActionWithDelay(ImmutableSettings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); + action = new ActionWithDelay(Settings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); final TransportShardReplicationOperationAction.PrimaryPhase primaryPhase = action.new PrimaryPhase(request, listener); Thread t = new Thread() { public void run() { @@ -592,7 +591,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { final ShardId shardId = new ShardId("test", 0); clusterService.setState(state(shardId.index().getName(), true, ShardRoutingState.STARTED, ShardRoutingState.STARTED)); - action = new ActionWithDelay(ImmutableSettings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); + action = new ActionWithDelay(Settings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); final Action.ReplicaOperationTransportHandler replicaOperationTransportHandler = action.new ReplicaOperationTransportHandler(); Thread t = new Thread() { public void run() { @@ -616,7 +615,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { // operation should have finished and counter decreased because no outstanding replica requests assertIndexShardCounter(1); // now check if this also works if operation throws exception - action = new ActionWithExceptions(ImmutableSettings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); + action = new ActionWithExceptions(Settings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); final Action.ReplicaOperationTransportHandler replicaOperationTransportHandlerForException = action.new ReplicaOperationTransportHandler(); try { replicaOperationTransportHandlerForException.messageReceived(new Request(shardId), createTransportChannel()); @@ -628,7 +627,7 @@ public class ShardReplicationOperationTests extends ElasticsearchTestCase { @Test public void testCounterDecrementedIfShardOperationThrowsException() throws InterruptedException, ExecutionException, IOException { - action = new ActionWithExceptions(ImmutableSettings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); + action = new ActionWithExceptions(Settings.EMPTY, "testActionWithExceptions", transportService, clusterService, threadPool); final String index = "test"; final ShardId shardId = new ShardId(index, 0); clusterService.setState(state(index, true, diff --git a/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTests.java b/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTests.java index 0e2daa9481f..31d5af8d8bc 100644 --- a/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTests.java +++ b/src/test/java/org/elasticsearch/action/termvectors/AbstractTermVectorsTests.java @@ -38,7 +38,7 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.common.inject.internal.Join; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -193,7 +193,7 @@ public abstract class AbstractTermVectorsTests extends ElasticsearchIntegrationT field.addToMappings(mappingBuilder); } mappingBuilder.endObject().endObject().endObject(); - ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder() + Settings.Builder settings = Settings.settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer.tv_test.tokenizer", "standard") .putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase"); diff --git a/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsCheckDocFreqTests.java b/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsCheckDocFreqTests.java index f85428cfbae..7021885b2d2 100644 --- a/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsCheckDocFreqTests.java +++ b/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsCheckDocFreqTests.java @@ -24,9 +24,7 @@ import org.apache.lucene.index.PostingsEnum; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.io.BytesStream; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -54,7 +52,7 @@ public class GetTermVectorsCheckDocFreqTests extends ElasticsearchIntegrationTes @Override public Settings indexSettings() { - return ImmutableSettings.builder() + return Settings.builder() .put(super.indexSettings()) .put("index.analysis.analyzer.tv_test.tokenizer", "whitespace") .putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase") diff --git a/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java b/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java index 492e91289d4..7eec3a65d22 100644 --- a/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java +++ b/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.common.Strings; import org.elasticsearch.common.lucene.uid.Versions; -import org.elasticsearch.common.settings.ImmutableSettings; +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; @@ -45,7 +45,7 @@ import java.io.IOException; import java.util.*; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -790,7 +790,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testArtificialVsExisting() throws ExecutionException, InterruptedException, IOException { // setup indices - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "standard"); assertAcked(prepareCreate("test") @@ -849,7 +849,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testArtificialNoDoc() throws IOException { // setup indices - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "standard"); assertAcked(prepareCreate("test") @@ -878,7 +878,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testArtificialNonExistingField() throws Exception { // setup indices - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "standard"); assertAcked(prepareCreate("test") @@ -946,7 +946,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { mapping.endObject().endObject().endObject(); // setup indices with mapping - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "standard"); assertAcked(prepareCreate("test") @@ -1023,7 +1023,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testDfs() throws ExecutionException, InterruptedException, IOException { logger.info("Setting up the index ..."); - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "standard") .put("index.number_of_shards", randomIntBetween(2, 10)); // we need at least 2 shards @@ -1128,7 +1128,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testTermVectorsWithVersion() { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); ensureGreen(); TermVectorsResponse response = client().prepareTermVectors("test", "type1", "1").get(); @@ -1232,7 +1232,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testFilterLength() throws ExecutionException, InterruptedException, IOException { logger.info("Setting up the index ..."); - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "keyword"); assertAcked(prepareCreate("test") @@ -1271,7 +1271,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testFilterTermFreq() throws ExecutionException, InterruptedException, IOException { logger.info("Setting up the index ..."); - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "keyword"); assertAcked(prepareCreate("test") @@ -1312,7 +1312,7 @@ public class GetTermVectorsTests extends AbstractTermVectorsTests { @Test public void testFilterDocFreq() throws ExecutionException, InterruptedException, IOException { logger.info("Setting up the index ..."); - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer", "keyword") .put("index.number_of_shards", 1); // no dfs diff --git a/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsTests.java b/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsTests.java index 58a96aa5e1f..2fdd8df3541 100644 --- a/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsTests.java +++ b/src/test/java/org/elasticsearch/action/termvectors/MultiTermVectorsTests.java @@ -25,7 +25,7 @@ import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.common.lucene.uid.Versions; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.junit.Test; import java.io.IOException; @@ -84,7 +84,7 @@ public class MultiTermVectorsTests extends AbstractTermVectorsTests { @Test public void testMultiTermVectorsWithVersion() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); ensureGreen(); MultiTermVectorsResponse response = client().prepareMultiTermVectors().add(indexOrAlias(), "type1", "1").get(); diff --git a/src/test/java/org/elasticsearch/aliases/IndexAliasesTests.java b/src/test/java/org/elasticsearch/aliases/IndexAliasesTests.java index 922dda803d5..0e72a35e1d6 100644 --- a/src/test/java/org/elasticsearch/aliases/IndexAliasesTests.java +++ b/src/test/java/org/elasticsearch/aliases/IndexAliasesTests.java @@ -62,7 +62,7 @@ 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.ImmutableSettings.settingsBuilder; +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; diff --git a/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java b/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java index 73571a8730a..a225024b1c2 100644 --- a/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.IndexAlreadyExistsException; import org.elasticsearch.node.Node; @@ -44,10 +43,10 @@ public class AliasesBenchmark { int BASE_ALIAS_COUNT = 100000; int NUM_ADD_ALIAS_REQUEST = 1000; - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("node.master", false).build(); Node node1 = NodeBuilder.nodeBuilder().settings( - ImmutableSettings.settingsBuilder().put(settings).put("node.master", true) + Settings.settingsBuilder().put(settings).put("node.master", true) ).node(); Node[] otherNodes = new Node[NUM_ADDITIONAL_NODES]; diff --git a/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java b/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java index c2c4b03a91f..f6b0497b090 100644 --- a/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java @@ -21,10 +21,8 @@ package org.elasticsearch.benchmark.breaker; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.common.breaker.CircuitBreaker; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.IndexAlreadyExistsException; import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; @@ -36,7 +34,7 @@ import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; import static junit.framework.Assert.assertNotNull; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; @@ -125,7 +123,7 @@ public class CircuitBreakerBenchmark { } public static void main(String args[]) throws Exception { - Node node = NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder()).node(); + Node node = NodeBuilder.nodeBuilder().settings(Settings.settingsBuilder()).node(); final Client client = node.client(); try { try { diff --git a/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java b/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java index 67030822fbe..bcb21573171 100644 --- a/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/cluster/ClusterAllocationRerouteBenchmark.java @@ -29,7 +29,7 @@ import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ElasticsearchAllocationTestCase; @@ -48,7 +48,7 @@ public class ClusterAllocationRerouteBenchmark { final int numReplicas = 2; final int numberOfNodes = 30; final int numberOfTags = 2; - AllocationService strategy = ElasticsearchAllocationTestCase.createAllocationService(ImmutableSettings.builder() + AllocationService strategy = ElasticsearchAllocationTestCase.createAllocationService(Settings.builder() .put("cluster.routing.allocation.awareness.attributes", "tag") .build(), new Random(1)); diff --git a/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java b/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java index 9d4e5af5d68..236c8821b3c 100644 --- a/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java @@ -27,11 +27,10 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.node.Node; -import org.elasticsearch.transport.TransportModule; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java b/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java index 4e278f1d0da..f5a126eeab7 100644 --- a/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java @@ -34,7 +34,7 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; diff --git a/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java b/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java index 85383dd46b5..66c4e62bdbc 100644 --- a/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java @@ -40,7 +40,7 @@ import java.util.concurrent.atomic.AtomicBoolean; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** diff --git a/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java b/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java index 558f8e76628..6c8f605293b 100644 --- a/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java @@ -35,7 +35,7 @@ import org.joda.time.PeriodType; import java.util.Random; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; public class ScriptComparisonBenchmark { diff --git a/src/test/java/org/elasticsearch/benchmark/scripts/score/BasicScriptBenchmark.java b/src/test/java/org/elasticsearch/benchmark/scripts/score/BasicScriptBenchmark.java index 054a16439aa..a832ffdd9c2 100644 --- a/src/test/java/org/elasticsearch/benchmark/scripts/score/BasicScriptBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/scripts/score/BasicScriptBenchmark.java @@ -27,11 +27,10 @@ import org.elasticsearch.client.Client; import org.elasticsearch.common.StopWatch; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.lucene.search.function.CombineFunction; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.functionscore.script.ScriptScoreFunctionBuilder; import org.joda.time.DateTime; @@ -40,7 +39,6 @@ import java.io.IOException; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Paths; import java.security.SecureRandom; import java.util.*; import java.util.Map.Entry; @@ -215,7 +213,7 @@ public class BasicScriptBenchmark { .prepareCreate("test") .addMapping("type1", mapping) .setSettings( - ImmutableSettings.settingsBuilder().put("index.analysis.analyzer.payload_float.tokenizer", "whitespace") + Settings.settingsBuilder().put("index.analysis.analyzer.payload_float.tokenizer", "whitespace") .putArray("index.analysis.analyzer.payload_float.filter", "delimited_float") .put("index.analysis.filter.delimited_float.delimiter", "|") .put("index.analysis.filter.delimited_float.encoding", "float") diff --git a/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java b/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java index 4a7757f093c..23da127ba8b 100644 --- a/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java @@ -29,7 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** diff --git a/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java b/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java index 922e3c51065..889a45c4589 100644 --- a/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java @@ -28,7 +28,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** diff --git a/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java b/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java index 7db644ddc17..786f943b2e5 100644 --- a/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java @@ -29,7 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** diff --git a/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java b/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java index 77d498e903a..213a522c80d 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java @@ -39,7 +39,7 @@ import java.util.List; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java index 8df5d160653..40e278159c5 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.common.StopWatch; import org.elasticsearch.common.settings.Settings; @@ -38,7 +37,7 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.cardinality; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java index c5f3b95a795..69eadffb52d 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java @@ -25,11 +25,9 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.benchmark.search.aggregations.TermsAggregationSearchBenchmark.StatsResult; import org.elasticsearch.client.Client; import org.elasticsearch.common.jna.Natives; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.SizeValue; @@ -44,7 +42,7 @@ import java.util.*; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; @@ -157,7 +155,7 @@ public class GlobalOrdinalsBenchmark { } client.admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put("logger.index.fielddata.ordinals", "DEBUG")) + .setTransientSettings(Settings.builder().put("logger.index.fielddata.ordinals", "DEBUG")) .get(); client.admin().indices().prepareRefresh(INDEX_NAME).execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java index b1100abd171..03fb38344d2 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java @@ -36,7 +36,7 @@ import java.util.Random; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java index 7de95e102a5..1bf8a33c095 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java @@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java index 21b05ce22f1..62bb62642a9 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java @@ -19,6 +19,7 @@ package org.elasticsearch.benchmark.search.aggregations; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.aggregations.metrics.percentiles.Percentile; import com.google.common.collect.Maps; @@ -26,10 +27,8 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.common.StopWatch; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.SizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -44,7 +43,7 @@ import static org.elasticsearch.client.Requests.createIndexRequest; import static org.elasticsearch.client.Requests.getRequest; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.percentiles; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java index a8a6ec35794..8e7d24697bb 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; import org.elasticsearch.common.StopWatch; @@ -39,7 +38,7 @@ import java.util.concurrent.ThreadLocalRandom; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +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; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java index d003dc0cc9e..96c80b5051c 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java @@ -27,7 +27,6 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; import org.elasticsearch.common.StopWatch; @@ -50,7 +49,7 @@ import java.util.concurrent.ThreadLocalRandom; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java index ea876a008e2..f57c9848886 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java @@ -26,7 +26,6 @@ import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; import org.elasticsearch.common.jna.Natives; @@ -49,7 +48,7 @@ import java.util.concurrent.ThreadLocalRandom; import static org.elasticsearch.benchmark.search.aggregations.TermsAggregationSearchBenchmark.Method; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java index 26a64255ac2..55d3db53dd0 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java @@ -50,7 +50,7 @@ import java.util.concurrent.ThreadLocalRandom; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java index 32f34ec5c96..ef0ebd5525b 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java @@ -36,7 +36,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.fielddata.IndexFieldData; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.indices.IndexAlreadyExistsException; import org.elasticsearch.node.Node; import org.elasticsearch.search.aggregations.AggregationBuilders; @@ -49,7 +48,7 @@ import java.util.concurrent.ThreadLocalRandom; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java index dfd04b541a9..b6df252adcb 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java @@ -35,7 +35,7 @@ import java.util.Random; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.filteredQuery; import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; diff --git a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java index c69618f7e46..e03da516b85 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java @@ -35,7 +35,7 @@ import java.util.Arrays; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.filteredQuery; import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery; import static org.elasticsearch.index.query.QueryBuilders.hasParentQuery; diff --git a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java index 78bec43ea05..966ca4fe060 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java @@ -38,7 +38,7 @@ import java.util.Arrays; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.filteredQuery; import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery; diff --git a/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java index c73bbd75f10..f43d581b507 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java @@ -20,10 +20,9 @@ package org.elasticsearch.benchmark.search.geo; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.common.geo.GeoDistance; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.SizeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; @@ -61,7 +60,7 @@ public class GeoDistanceSearchBenchmark { .startObject("properties").startObject("location").field("type", "geo_point").field("lat_lon", true).endObject().endObject() .endObject().endObject().string(); client.admin().indices().prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) + .setSettings(Settings.settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)) .addMapping("type1", mapping) .execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java b/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java index 75770c1ce9e..c01ee21e784 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java @@ -37,7 +37,7 @@ import org.elasticsearch.search.sort.SortOrder; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java index 093467352cb..a6909a36df8 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java @@ -35,7 +35,7 @@ import java.util.Locale; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** diff --git a/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java b/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java index ed72fa24395..1f532345992 100644 --- a/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java +++ b/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java @@ -36,8 +36,8 @@ import java.util.concurrent.atomic.AtomicLong; import static org.elasticsearch.client.Requests.searchRequest; 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.ImmutableSettings.settingsBuilder; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.elasticsearch.index.query.QueryBuilders.constantScoreQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java b/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java index c1109a9d533..32c35cc0858 100644 --- a/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java +++ b/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java @@ -35,7 +35,7 @@ import java.util.Random; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java b/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java index 346f5a82800..610745c51d9 100644 --- a/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java +++ b/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadIndexingStress.java @@ -30,7 +30,7 @@ import java.io.IOException; import static org.elasticsearch.client.Requests.createIndexRequest; 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.ImmutableSettings.settingsBuilder; +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.node.NodeBuilder.nodeBuilder; diff --git a/src/test/java/org/elasticsearch/benchmark/transport/BenchmarkNettyLargeMessages.java b/src/test/java/org/elasticsearch/benchmark/transport/BenchmarkNettyLargeMessages.java index 5a127c44a60..fcc755b4132 100644 --- a/src/test/java/org/elasticsearch/benchmark/transport/BenchmarkNettyLargeMessages.java +++ b/src/test/java/org/elasticsearch/benchmark/transport/BenchmarkNettyLargeMessages.java @@ -24,7 +24,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.settings.DynamicSettings; import org.elasticsearch.common.network.NetworkService; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.unit.ByteSizeUnit; @@ -50,7 +49,7 @@ public class BenchmarkNettyLargeMessages { final int NUMBER_OF_CLIENTS = 5; final byte[] payload = new byte[(int) payloadSize.bytes()]; - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .build(); NetworkService networkService = new NetworkService(settings); diff --git a/src/test/java/org/elasticsearch/benchmark/transport/TransportBenchmark.java b/src/test/java/org/elasticsearch/benchmark/transport/TransportBenchmark.java index 4fb24db7f91..ff5c9c62261 100644 --- a/src/test/java/org/elasticsearch/benchmark/transport/TransportBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/transport/TransportBenchmark.java @@ -23,7 +23,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.StopWatch; import org.elasticsearch.common.network.NetworkService; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -51,7 +50,7 @@ public class TransportBenchmark { NETTY { @Override public Transport newTransport(Settings settings, ThreadPool threadPool) { - return new NettyTransport(settings, threadPool, new NetworkService(ImmutableSettings.EMPTY), BigArrays.NON_RECYCLING_INSTANCE, Version.CURRENT); + return new NettyTransport(settings, threadPool, new NetworkService(Settings.EMPTY), BigArrays.NON_RECYCLING_INSTANCE, Version.CURRENT); } }; @@ -69,7 +68,7 @@ public class TransportBenchmark { final Type type = Type.NETTY; - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .build(); final ThreadPool serverThreadPool = new ThreadPool("server"); diff --git a/src/test/java/org/elasticsearch/blocks/SimpleBlocksTests.java b/src/test/java/org/elasticsearch/blocks/SimpleBlocksTests.java index 3fbdfa142ac..b70ba625414 100644 --- a/src/test/java/org/elasticsearch/blocks/SimpleBlocksTests.java +++ b/src/test/java/org/elasticsearch/blocks/SimpleBlocksTests.java @@ -27,14 +27,12 @@ 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.cluster.metadata.MetaData; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; import java.util.HashMap; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.notNullValue; @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST) diff --git a/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java b/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java index feda1af309e..e9396381147 100644 --- a/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java +++ b/src/test/java/org/elasticsearch/bootstrap/SecurityTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.bootstrap; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.test.ElasticsearchTestCase; @@ -37,7 +36,7 @@ public class SecurityTests extends ElasticsearchTestCase { Path path = createTempDir(); // make a fake ES home and ensure we only grant permissions to that. Path esHome = path.resolve("esHome"); - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder(); + Settings.Builder settingsBuilder = Settings.builder(); settingsBuilder.put("path.home", esHome.toString()); Settings settings = settingsBuilder.build(); @@ -66,7 +65,7 @@ public class SecurityTests extends ElasticsearchTestCase { public void testEnvironmentPaths() throws Exception { Path path = createTempDir(); - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder(); + Settings.Builder settingsBuilder = Settings.builder(); settingsBuilder.put("path.home", path.resolve("home").toString()); settingsBuilder.put("path.conf", path.resolve("conf").toString()); settingsBuilder.put("path.plugins", path.resolve("plugins").toString()); diff --git a/src/test/java/org/elasticsearch/bwcompat/BasicBackwardsCompatibilityTest.java b/src/test/java/org/elasticsearch/bwcompat/BasicBackwardsCompatibilityTest.java index f1a7788f0d7..77360425f26 100644 --- a/src/test/java/org/elasticsearch/bwcompat/BasicBackwardsCompatibilityTest.java +++ b/src/test/java/org/elasticsearch/bwcompat/BasicBackwardsCompatibilityTest.java @@ -49,7 +49,6 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -152,7 +151,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa if (backwardsCluster().numNewDataNodes() == 0) { backwardsCluster().startNewNode(); } - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings()))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings()))); ensureYellow(); assertAllShardsOnNodes("test", backwardsCluster().backwardsNodePattern()); int numDocs = randomIntBetween(100, 150); @@ -206,7 +205,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa */ @Test public void testNoRecoveryFromNewNodes() throws ExecutionException, InterruptedException { - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().backwardsNodePattern()).put(indexSettings()))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().backwardsNodePattern()).put(indexSettings()))); if (backwardsCluster().numNewDataNodes() == 0) { backwardsCluster().startNewNode(); } @@ -274,7 +273,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa */ @Test public void testIndexUpgradeSingleNode() throws Exception { - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings()))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings()))); ensureYellow(); int numDocs = randomIntBetween(100, 150); IndexRequestBuilder[] docs = new IndexRequestBuilder[numDocs]; @@ -284,7 +283,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa indexRandom(true, docs); assertAllShardsOnNodes("test", backwardsCluster().backwardsNodePattern()); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); backwardsCluster().allowOnAllNodes("test"); CountResponse countResponse = client().prepareCount().get(); assertHitCount(countResponse, numDocs); @@ -296,7 +295,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa } indexRandom(true, docs); } - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); ensureYellow(); final int numIters = randomIntBetween(1, 20); for (int i = 0; i < numIters; i++) { @@ -316,7 +315,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa String[] indices = new String[randomIntBetween(1, 3)]; for (int i = 0; i < indices.length; i++) { indices[i] = "test" + i; - assertAcked(prepareCreate(indices[i]).setSettings(ImmutableSettings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings()))); + assertAcked(prepareCreate(indices[i]).setSettings(Settings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings()))); } int numDocs = randomIntBetween(100, 150); @@ -329,7 +328,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa for (String index : indices) { assertAllShardsOnNodes(index, backwardsCluster().backwardsNodePattern()); } - client().admin().indices().prepareUpdateSettings(indices).setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); + client().admin().indices().prepareUpdateSettings(indices).setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); backwardsCluster().allowOnAllNodes(indices); logClusterState(); boolean upgraded; @@ -347,7 +346,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa } indexRandom(true, docs); } while (upgraded); - client().admin().indices().prepareUpdateSettings(indices).setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); + client().admin().indices().prepareUpdateSettings(indices).setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); ensureYellow(); CountResponse countResponse = client().prepareCount().get(); assertHitCount(countResponse, numDocs); @@ -389,7 +388,7 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa try { assertAcked(prepareCreate("test"). - setSettings(ImmutableSettings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings())) + setSettings(Settings.builder().put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()).put(indexSettings())) .addMapping("type", mapping)); } catch (MapperParsingException ex) { assertThat(ex.getCause(), instanceOf(IllegalArgumentException.class)); diff --git a/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatTests.java b/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatTests.java index e67890bf030..ba208eb739e 100644 --- a/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatTests.java +++ b/src/test/java/org/elasticsearch/bwcompat/ClusterStateBackwardsCompatTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.block.ClusterBlocks; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest; import org.junit.Test; @@ -102,7 +101,7 @@ public class ClusterStateBackwardsCompatTests extends ElasticsearchBackwardsComp } private TransportClient newTransportClient() { - Settings settings = ImmutableSettings.settingsBuilder().put("client.transport.ignore_cluster_name", true) + Settings settings = Settings.settingsBuilder().put("client.transport.ignore_cluster_name", true) .put("node.name", "transport_client_" + getTestName()).build(); return TransportClient.builder().settings(settings).build(); } diff --git a/src/test/java/org/elasticsearch/bwcompat/GetIndexBackwardsCompatibilityTests.java b/src/test/java/org/elasticsearch/bwcompat/GetIndexBackwardsCompatibilityTests.java index 8cfc7f8198f..5da2c1ff96c 100644 --- a/src/test/java/org/elasticsearch/bwcompat/GetIndexBackwardsCompatibilityTests.java +++ b/src/test/java/org/elasticsearch/bwcompat/GetIndexBackwardsCompatibilityTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.action.admin.indices.get.GetIndexResponse; import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.warmer.IndexWarmersMetaData.Entry; import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest; @@ -81,7 +80,7 @@ public class GetIndexBackwardsCompatibilityTests extends ElasticsearchBackwardsC @Test public void testGetSettings() throws Exception { - CreateIndexResponse createIndexResponse = prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_shards", 1)).execute().actionGet(); + CreateIndexResponse createIndexResponse = prepareCreate("test").setSettings(Settings.builder().put("number_of_shards", 1)).execute().actionGet(); assertAcked(createIndexResponse); GetIndexResponse getIndexResponse = client().admin().indices().prepareGetIndex().addIndices("test").addFeatures(Feature.SETTINGS) .execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatTests.java b/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatTests.java index 63b45909944..5220b6c7cc8 100644 --- a/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatTests.java +++ b/src/test/java/org/elasticsearch/bwcompat/NodesStatsBasicBackwardsCompatTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequestBuilder; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -42,7 +41,7 @@ public class NodesStatsBasicBackwardsCompatTests extends ElasticsearchBackwardsC NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet(); - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("client.transport.ignore_cluster_name", true) .put("node.name", "transport_client_" + getTestName()).build(); @@ -61,7 +60,7 @@ public class NodesStatsBasicBackwardsCompatTests extends ElasticsearchBackwardsC NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet(); - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("node.name", "transport_client_" + getTestName()) .put("client.transport.ignore_cluster_name", true).build(); diff --git a/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java b/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java index 1f7134d8649..32fef09363e 100644 --- a/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java +++ b/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java @@ -33,7 +33,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.MultiDataPathUpgrader; @@ -110,7 +109,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio @Override public Settings nodeSettings(int ord) { - return ImmutableSettings.builder() + return Settings.builder() .put(Node.HTTP_ENABLED, true) // for _upgrade .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) // disable merging so no segments will be upgraded .put(RecoverySettings.INDICES_RECOVERY_CONCURRENT_SMALL_FILE_STREAMS, 30) // increase recovery speed for small files @@ -122,13 +121,13 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio Path baseTempDir = createTempDir(); // start single data path node - ImmutableSettings.Builder nodeSettings = ImmutableSettings.builder() + Settings.Builder nodeSettings = Settings.builder() .put("path.data", baseTempDir.resolve("single-path").toAbsolutePath()) .put("node.master", false); // workaround for dangling index loading issue when node is master ListenableFuture singleDataPathNode = internalCluster().startNodeAsync(nodeSettings.build()); // start multi data path node - nodeSettings = ImmutableSettings.builder() + nodeSettings = Settings.builder() .put("path.data", baseTempDir.resolve("multi-path1").toAbsolutePath() + "," + baseTempDir.resolve("multi-path2").toAbsolutePath()) .put("node.master", false); // workaround for dangling index loading issue when node is master ListenableFuture multiDataPathNode = internalCluster().startNodeAsync(nodeSettings.build()); @@ -396,7 +395,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio } void assertRealtimeGetWorks(String indexName) { - assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(ImmutableSettings.builder() + assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(Settings.builder() .put("refresh_interval", -1) .build())); SearchRequestBuilder searchReq = client().prepareSearch(indexName).setQuery(QueryBuilders.matchAllQuery()); @@ -408,7 +407,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio Map source = getRsp.getSourceAsMap(); assertThat(source, Matchers.hasKey("foo")); - assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(ImmutableSettings.builder() + assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(Settings.builder() .put("refresh_interval", EngineConfig.DEFAULT_REFRESH_INTERVAL) .build())); } @@ -417,7 +416,7 @@ public class OldIndexBackwardsCompatibilityTests extends ElasticsearchIntegratio final int numReplicas = 1; final long startTime = System.currentTimeMillis(); logger.debug("--> creating [{}] replicas for index [{}]", numReplicas, indexName); - assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(ImmutableSettings.builder() + assertAcked(client().admin().indices().prepareUpdateSettings(indexName).setSettings(Settings.builder() .put("number_of_replicas", numReplicas) ).execute().actionGet()); ensureGreen(TimeValue.timeValueMinutes(2), indexName); diff --git a/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesTests.java b/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesTests.java index 6298cdfcb8f..d27b361b16d 100644 --- a/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesTests.java +++ b/src/test/java/org/elasticsearch/bwcompat/RecoveryWithUnsupportedIndicesTests.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.bwcompat; -import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.junit.Test; diff --git a/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatTests.java b/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatTests.java index f0248461b74..3c41dd77c42 100644 --- a/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatTests.java +++ b/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.snapshots.AbstractSnapshotTests; @@ -48,7 +47,7 @@ import java.util.SortedSet; import java.util.TreeSet; import static com.google.common.collect.Lists.newArrayList; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/bwcompat/StaticIndexBackwardCompatibilityTest.java b/src/test/java/org/elasticsearch/bwcompat/StaticIndexBackwardCompatibilityTest.java index c8c64c848a9..2fcd9572a65 100644 --- a/src/test/java/org/elasticsearch/bwcompat/StaticIndexBackwardCompatibilityTest.java +++ b/src/test/java/org/elasticsearch/bwcompat/StaticIndexBackwardCompatibilityTest.java @@ -25,8 +25,6 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; -import java.nio.file.Paths; - import static org.hamcrest.Matchers.greaterThanOrEqualTo; /** diff --git a/src/test/java/org/elasticsearch/bwcompat/TransportClientBackwardsCompatibilityTest.java b/src/test/java/org/elasticsearch/bwcompat/TransportClientBackwardsCompatibilityTest.java index 195165715aa..11e01b2c1eb 100644 --- a/src/test/java/org/elasticsearch/bwcompat/TransportClientBackwardsCompatibilityTest.java +++ b/src/test/java/org/elasticsearch/bwcompat/TransportClientBackwardsCompatibilityTest.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.index.query.QueryBuilders; @@ -43,7 +42,7 @@ public class TransportClientBackwardsCompatibilityTest extends ElasticsearchBack @Test public void testSniffMode() throws ExecutionException, InterruptedException { - Settings settings = ImmutableSettings.builder().put(requiredSettings()).put("client.transport.nodes_sampler_interval", "1s") + Settings settings = Settings.builder().put(requiredSettings()).put("client.transport.nodes_sampler_interval", "1s") .put("name", "transport_client_sniff_mode").put(ClusterName.SETTING, cluster().getClusterName()) .put("client.transport.sniff", true).build(); diff --git a/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityTest.java b/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityTest.java index 2844ae10a6e..d8019a64c65 100644 --- a/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityTest.java +++ b/src/test/java/org/elasticsearch/bwcompat/UnicastBackwardsCompatibilityTest.java @@ -20,7 +20,6 @@ package org.elasticsearch.bwcompat; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest; import org.junit.Test; @@ -31,7 +30,7 @@ public class UnicastBackwardsCompatibilityTest extends ElasticsearchBackwardsCom @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("transport.tcp.port", 9380 + nodeOrdinal) .put("discovery.zen.ping.multicast.enabled", false) @@ -41,7 +40,7 @@ public class UnicastBackwardsCompatibilityTest extends ElasticsearchBackwardsCom @Override protected Settings externalNodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.externalNodeSettings(nodeOrdinal)) .put("transport.tcp.port", 9390 + nodeOrdinal) .put("discovery.zen.ping.multicast.enabled", false) diff --git a/src/test/java/org/elasticsearch/client/AbstractClientHeadersTests.java b/src/test/java/org/elasticsearch/client/AbstractClientHeadersTests.java index c9c7a9fdf52..c75e0e62489 100644 --- a/src/test/java/org/elasticsearch/client/AbstractClientHeadersTests.java +++ b/src/test/java/org/elasticsearch/client/AbstractClientHeadersTests.java @@ -48,7 +48,6 @@ import org.elasticsearch.action.indexedscripts.delete.DeleteIndexedScriptRespons import org.elasticsearch.action.search.SearchAction; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.support.Headers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.threadpool.ThreadPool; @@ -67,7 +66,7 @@ import static org.hamcrest.Matchers.*; */ public abstract class AbstractClientHeadersTests extends ElasticsearchTestCase { - protected static final Settings HEADER_SETTINGS = ImmutableSettings.builder() + protected static final Settings HEADER_SETTINGS = Settings.builder() .put(Headers.PREFIX + ".key1", "val1") .put(Headers.PREFIX + ".key2", "val 2") .build(); @@ -90,7 +89,7 @@ public abstract class AbstractClientHeadersTests extends ElasticsearchTestCase { @Before public void initClient() { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put(HEADER_SETTINGS) .put("path.home", createTempDir().toString()) .build(); diff --git a/src/test/java/org/elasticsearch/client/node/NodeClientHeadersTests.java b/src/test/java/org/elasticsearch/client/node/NodeClientHeadersTests.java index 9f8dc0cf2f6..be2df27197b 100644 --- a/src/test/java/org/elasticsearch/client/node/NodeClientHeadersTests.java +++ b/src/test/java/org/elasticsearch/client/node/NodeClientHeadersTests.java @@ -30,8 +30,6 @@ import org.elasticsearch.client.Client; import org.elasticsearch.client.support.Headers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; -import org.junit.After; -import org.junit.Before; import java.util.HashMap; diff --git a/src/test/java/org/elasticsearch/client/node/NodeClientTests.java b/src/test/java/org/elasticsearch/client/node/NodeClientTests.java index 4658d24b3fa..265b9184a2c 100644 --- a/src/test/java/org/elasticsearch/client/node/NodeClientTests.java +++ b/src/test/java/org/elasticsearch/client/node/NodeClientTests.java @@ -23,7 +23,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.is; diff --git a/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java b/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java index 8400b490301..d513f5d4a5b 100644 --- a/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java +++ b/src/test/java/org/elasticsearch/client/transport/TransportClientHeadersTests.java @@ -32,7 +32,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.LocalTransportAddress; import org.elasticsearch.common.transport.TransportAddress; @@ -55,7 +54,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests { @Override protected Client buildClient(Settings headersSettings, GenericAction[] testedActions) { - TransportClient client = TransportClient.builder().settings(ImmutableSettings.builder() + TransportClient client = TransportClient.builder().settings(Settings.builder() .put("client.transport.sniff", false) .put("node.name", "transport_client_" + this.getTestName()) .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, InternalTransportService.class.getName()) @@ -68,7 +67,7 @@ public class TransportClientHeadersTests extends AbstractClientHeadersTests { @Test public void testWithSniffing() throws Exception { - TransportClient client = TransportClient.builder().settings(ImmutableSettings.builder() + TransportClient client = TransportClient.builder().settings(Settings.builder() .put("client.transport.sniff", true) .put("cluster.name", "cluster1") .put("node.name", "transport_client_" + this.getTestName() + "_1") diff --git a/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java b/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java index 884fe6ac04e..bbf372b6dff 100644 --- a/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java +++ b/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.support.Headers; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.LocalTransportAddress; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.threadpool.ThreadPool; @@ -58,9 +58,9 @@ public class TransportClientNodesServiceTests extends ElasticsearchTestCase { return new TestResponse(); } }; - transportService = new TransportService(ImmutableSettings.EMPTY, transport, threadPool); + transportService = new TransportService(Settings.EMPTY, transport, threadPool); transportService.start(); - transportClientNodesService = new TransportClientNodesService(ImmutableSettings.EMPTY, ClusterName.DEFAULT, transportService, threadPool, Headers.EMPTY, Version.CURRENT); + transportClientNodesService = new TransportClientNodesService(Settings.EMPTY, ClusterName.DEFAULT, transportService, threadPool, Headers.EMPTY, Version.CURRENT); nodesCount = randomIntBetween(1, 10); for (int i = 0; i < nodesCount; i++) { diff --git a/src/test/java/org/elasticsearch/client/transport/TransportClientRetryTests.java b/src/test/java/org/elasticsearch/client/transport/TransportClientRetryTests.java index b0090fff142..724e5ff50a9 100644 --- a/src/test/java/org/elasticsearch/client/transport/TransportClientRetryTests.java +++ b/src/test/java/org/elasticsearch/client/transport/TransportClientRetryTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.action.support.PlainListenableActionFuture; import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.plugins.PluginsService; @@ -38,7 +37,7 @@ import org.junit.Test; import java.io.IOException; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.CoreMatchers.equalTo; @@ -57,7 +56,7 @@ public class TransportClientRetryTests extends ElasticsearchIntegrationTest { addresses[i++] = instance.boundAddress().publishAddress(); } - ImmutableSettings.Builder builder = settingsBuilder().put("client.transport.nodes_sampler_interval", "1s") + Settings.Builder builder = settingsBuilder().put("client.transport.nodes_sampler_interval", "1s") .put("name", "transport_client_retry_test") .put("node.mode", InternalTestCluster.nodeMode()) .put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, false) diff --git a/src/test/java/org/elasticsearch/client/transport/TransportClientTests.java b/src/test/java/org/elasticsearch/client/transport/TransportClientTests.java index 3abb071d4ee..86d39bb936b 100644 --- a/src/test/java/org/elasticsearch/client/transport/TransportClientTests.java +++ b/src/test/java/org/elasticsearch/client/transport/TransportClientTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.client.transport; import org.elasticsearch.Version; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.node.Node; @@ -31,7 +30,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.transport.TransportService; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.equalTo; @@ -44,7 +43,7 @@ public class TransportClientTests extends ElasticsearchIntegrationTest { @Test public void testPickingUpChangesInDiscoveryNode() { - String nodeName = internalCluster().startNode(ImmutableSettings.builder().put("node.data", false)); + String nodeName = internalCluster().startNode(Settings.builder().put("node.data", false)); TransportClient client = (TransportClient) internalCluster().client(nodeName); assertThat(client.connectedNodes().get(0).dataNode(), equalTo(false)); @@ -55,7 +54,7 @@ public class TransportClientTests extends ElasticsearchIntegrationTest { public void testNodeVersionIsUpdated() { TransportClient client = (TransportClient) internalCluster().client(); TransportClientNodesService nodeService = client.nodeService(); - Node node = nodeBuilder().data(false).settings(ImmutableSettings.builder() + Node node = nodeBuilder().data(false).settings(Settings.builder() .put(internalCluster().getDefaultSettings()) .put("path.home", createTempDir()) .put("node.name", "testNodeVersionIsUpdated") diff --git a/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceTests.java b/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceTests.java index 289da940b3e..87cadc4331a 100644 --- a/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceTests.java +++ b/src/test/java/org/elasticsearch/cluster/ClusterInfoServiceTests.java @@ -33,7 +33,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.store.Store; import org.elasticsearch.plugins.AbstractPlugin; @@ -53,7 +52,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -141,7 +140,7 @@ public class ClusterInfoServiceTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() // manual collection or upon cluster forming. .put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_TIMEOUT, "1s") .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()) @@ -152,7 +151,7 @@ public class ClusterInfoServiceTests extends ElasticsearchIntegrationTest { @Test public void testClusterInfoServiceCollectsInformation() throws Exception { internalCluster().startNodesAsync(2, - ImmutableSettings.builder().put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, "200ms").build()) + Settings.builder().put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, "200ms").build()) .get(); assertAcked(prepareCreate("test").setSettings(settingsBuilder().put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL, 0).build())); ensureGreen("test"); @@ -183,7 +182,7 @@ public class ClusterInfoServiceTests extends ElasticsearchIntegrationTest { public void testClusterInfoServiceInformationClearOnError() throws InterruptedException, ExecutionException { internalCluster().startNodesAsync(2, // manually control publishing - ImmutableSettings.builder().put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, "60m").build()) + Settings.builder().put(InternalClusterInfoService.INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL, "60m").build()) .get(); prepareCreate("test").setSettings(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1).get(); ensureGreen("test"); diff --git a/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java b/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java index 8b183212893..c60aaeffb6b 100644 --- a/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java +++ b/src/test/java/org/elasticsearch/cluster/ClusterServiceTests.java @@ -34,7 +34,6 @@ import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Singleton; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.plugins.AbstractPlugin; @@ -50,7 +49,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.*; @@ -650,7 +649,7 @@ public class ClusterServiceTests extends ElasticsearchIntegrationTest { assertThat(testService1.master(), is(true)); // start another node and set min_master_node - internalCluster().startNode(ImmutableSettings.builder().put(settings)); + internalCluster().startNode(Settings.builder().put(settings)); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); Settings transientSettings = settingsBuilder() @@ -671,7 +670,7 @@ public class ClusterServiceTests extends ElasticsearchIntegrationTest { assertThat(testService1.master(), is(false)); // bring the node back up - String node_2 = internalCluster().startNode(ImmutableSettings.builder().put(settings).put(transientSettings)); + String node_2 = internalCluster().startNode(Settings.builder().put(settings).put(transientSettings)); ClusterService clusterService2 = internalCluster().getInstance(ClusterService.class, node_2); MasterAwareService testService2 = internalCluster().getInstance(MasterAwareService.class, node_2); diff --git a/src/test/java/org/elasticsearch/cluster/ClusterStateDiffPublishingTests.java b/src/test/java/org/elasticsearch/cluster/ClusterStateDiffPublishingTests.java index 33008fd63d2..b66c235d833 100644 --- a/src/test/java/org/elasticsearch/cluster/ClusterStateDiffPublishingTests.java +++ b/src/test/java/org/elasticsearch/cluster/ClusterStateDiffPublishingTests.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.DiscoverySettings; @@ -96,7 +95,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { public MockNode createMockNode(String name, Settings settings, Version version, PublishClusterStateAction.NewClusterStateListener listener) throws Exception { MockTransportService service = buildTransportService( - ImmutableSettings.builder().put(settings).put("name", name, TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(), + Settings.builder().put(settings).put("name", name, TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(), version ); DiscoveryNode discoveryNode = new DiscoveryNode(name, name, service.boundAddress().publishAddress(), ImmutableMap.of(), version); @@ -210,10 +209,10 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { @TestLogging("cluster:DEBUG,discovery.zen.publish:DEBUG") public void testSimpleClusterStatePublishing() throws Exception { MockNewClusterStateListener mockListenerA = new MockNewClusterStateListener(); - MockNode nodeA = createMockNode("nodeA", ImmutableSettings.EMPTY, Version.CURRENT, mockListenerA); + MockNode nodeA = createMockNode("nodeA", Settings.EMPTY, Version.CURRENT, mockListenerA); MockNewClusterStateListener mockListenerB = new MockNewClusterStateListener(); - MockNode nodeB = createMockNode("nodeB", ImmutableSettings.EMPTY, Version.CURRENT, mockListenerB); + MockNode nodeB = createMockNode("nodeB", Settings.EMPTY, Version.CURRENT, mockListenerB); // Initial cluster state DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().put(nodeA.discoveryNode).localNodeId(nodeA.discoveryNode.id()).build(); @@ -258,7 +257,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { // Adding new node - this node should get full cluster state while nodeB should still be getting diffs MockNewClusterStateListener mockListenerC = new MockNewClusterStateListener(); - MockNode nodeC = createMockNode("nodeC", ImmutableSettings.EMPTY, Version.CURRENT, mockListenerC); + MockNode nodeC = createMockNode("nodeC", Settings.EMPTY, Version.CURRENT, mockListenerC); // cluster state update 3 - register node C previousClusterState = clusterState; @@ -282,7 +281,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { // cluster state update 4 - update settings previousClusterState = clusterState; - MetaData metaData = MetaData.builder(clusterState.metaData()).transientSettings(ImmutableSettings.settingsBuilder().put("foo", "bar").build()).build(); + MetaData metaData = MetaData.builder(clusterState.metaData()).transientSettings(Settings.settingsBuilder().put("foo", "bar").build()).build(); clusterState = ClusterState.builder(clusterState).metaData(metaData).incrementVersion().build(); NewClusterStateExpectation expectation = new NewClusterStateExpectation() { @Override @@ -344,7 +343,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { @TestLogging("cluster:DEBUG,discovery.zen.publish:DEBUG") public void testUnexpectedDiffPublishing() throws Exception { - MockNode nodeA = createMockNode("nodeA", ImmutableSettings.EMPTY, Version.CURRENT, new PublishClusterStateAction.NewClusterStateListener() { + MockNode nodeA = createMockNode("nodeA", Settings.EMPTY, Version.CURRENT, new PublishClusterStateAction.NewClusterStateListener() { @Override public void onNewClusterState(ClusterState clusterState, NewStateProcessed newStateProcessed) { fail("Shouldn't send cluster state to myself"); @@ -352,7 +351,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { }); MockNewClusterStateListener mockListenerB = new MockNewClusterStateListener(); - MockNode nodeB = createMockNode("nodeB", ImmutableSettings.EMPTY, Version.CURRENT, mockListenerB); + MockNode nodeB = createMockNode("nodeB", Settings.EMPTY, Version.CURRENT, mockListenerB); // Initial cluster state with both states - the second node still shouldn't get diff even though it's present in the previous cluster state DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().put(nodeA.discoveryNode).put(nodeB.discoveryNode).localNodeId(nodeA.discoveryNode.id()).build(); @@ -381,7 +380,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { @Test @TestLogging("cluster:DEBUG,discovery.zen.publish:DEBUG") public void testDisablingDiffPublishing() throws Exception { - Settings noDiffPublishingSettings = ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_DIFF_ENABLE, false).build(); + Settings noDiffPublishingSettings = Settings.builder().put(DiscoverySettings.PUBLISH_DIFF_ENABLE, false).build(); MockNode nodeA = createMockNode("nodeA", noDiffPublishingSettings, Version.CURRENT, new PublishClusterStateAction.NewClusterStateListener() { @Override @@ -421,7 +420,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { public void testSimultaneousClusterStatePublishing() throws Exception { int numberOfNodes = randomIntBetween(2, 10); int numberOfIterations = randomIntBetween(50, 200); - Settings settings = ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "100ms").put(DiscoverySettings.PUBLISH_DIFF_ENABLE, true).build(); + Settings settings = Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "100ms").put(DiscoverySettings.PUBLISH_DIFF_ENABLE, true).build(); MockNode[] nodes = new MockNode[numberOfNodes]; DiscoveryNodes.Builder discoveryNodesBuilder = DiscoveryNodes.builder(); for (int i = 0; i < nodes.length; i++) { @@ -465,7 +464,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { @TestLogging("cluster:DEBUG,discovery.zen.publish:DEBUG") public void testSerializationFailureDuringDiffPublishing() throws Exception { - MockNode nodeA = createMockNode("nodeA", ImmutableSettings.EMPTY, Version.CURRENT, new PublishClusterStateAction.NewClusterStateListener() { + MockNode nodeA = createMockNode("nodeA", Settings.EMPTY, Version.CURRENT, new PublishClusterStateAction.NewClusterStateListener() { @Override public void onNewClusterState(ClusterState clusterState, NewStateProcessed newStateProcessed) { fail("Shouldn't send cluster state to myself"); @@ -473,7 +472,7 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { }); MockNewClusterStateListener mockListenerB = new MockNewClusterStateListener(); - MockNode nodeB = createMockNode("nodeB", ImmutableSettings.EMPTY, Version.CURRENT, mockListenerB); + MockNode nodeB = createMockNode("nodeB", Settings.EMPTY, Version.CURRENT, mockListenerB); // Initial cluster state with both states - the second node still shouldn't get diff even though it's present in the previous cluster state DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().put(nodeA.discoveryNode).put(nodeB.discoveryNode).localNodeId(nodeA.discoveryNode.id()).build(); @@ -521,10 +520,10 @@ public class ClusterStateDiffPublishingTests extends ElasticsearchTestCase { private MetaData buildMetaDataForVersion(MetaData metaData, long version) { ImmutableOpenMap.Builder indices = ImmutableOpenMap.builder(metaData.indices()); - indices.put("test" + version, IndexMetaData.builder("test" + version).settings(ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) + indices.put("test" + version, IndexMetaData.builder("test" + version).settings(Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)) .numberOfShards((int) version).numberOfReplicas(0).build()); return MetaData.builder(metaData) - .transientSettings(ImmutableSettings.builder().put("test", version).build()) + .transientSettings(Settings.builder().put("test", version).build()) .indices(indices.build()) .build(); } diff --git a/src/test/java/org/elasticsearch/cluster/ClusterStateDiffTests.java b/src/test/java/org/elasticsearch/cluster/ClusterStateDiffTests.java index 86a2a06c719..5b73c82c2ed 100644 --- a/src/test/java/org/elasticsearch/cluster/ClusterStateDiffTests.java +++ b/src/test/java/org/elasticsearch/cluster/ClusterStateDiffTests.java @@ -34,7 +34,6 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.LocalTransportAddress; import org.elasticsearch.discovery.DiscoverySettings; @@ -271,7 +270,7 @@ public class ClusterStateDiffTests extends ElasticsearchIntegrationTest { } private Settings randomSettings(Settings settings) { - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); if (randomBoolean()) { builder.put(settings); } @@ -362,9 +361,9 @@ public class ClusterStateDiffTests extends ElasticsearchIntegrationTest { @Override public IndexMetaData randomCreate(String name) { IndexMetaData.Builder builder = IndexMetaData.builder(name); - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder(); + Settings.Builder settingsBuilder = Settings.builder(); setRandomSettings(getRandom(), settingsBuilder); - settingsBuilder.put(randomSettings(ImmutableSettings.EMPTY)).put(IndexMetaData.SETTING_VERSION_CREATED, randomVersion(random())); + settingsBuilder.put(randomSettings(Settings.EMPTY)).put(IndexMetaData.SETTING_VERSION_CREATED, randomVersion(random())); builder.settings(settingsBuilder); builder.numberOfShards(randomIntBetween(1, 10)).numberOfReplicas(randomInt(10)); int aliasCount = randomInt(10); @@ -382,7 +381,7 @@ public class ClusterStateDiffTests extends ElasticsearchIntegrationTest { IndexMetaData.Builder builder = IndexMetaData.builder(part); switch (randomIntBetween(0, 3)) { case 0: - builder.settings(ImmutableSettings.builder().put(part.settings()).put(randomSettings(ImmutableSettings.EMPTY))); + builder.settings(Settings.builder().put(part.settings()).put(randomSettings(Settings.EMPTY))); break; case 1: if (randomBoolean() && part.aliases().isEmpty() == false) { @@ -392,7 +391,7 @@ public class ClusterStateDiffTests extends ElasticsearchIntegrationTest { } break; case 2: - builder.settings(ImmutableSettings.builder().put(part.settings()).put(IndexMetaData.SETTING_UUID, Strings.randomBase64UUID())); + builder.settings(Settings.builder().put(part.settings()).put(IndexMetaData.SETTING_UUID, Strings.randomBase64UUID())); break; case 3: builder.putCustom(IndexWarmersMetaData.TYPE, randomWarmers()); @@ -441,7 +440,7 @@ public class ClusterStateDiffTests extends ElasticsearchIntegrationTest { IndexTemplateMetaData.Builder builder = IndexTemplateMetaData.builder(name); builder.order(randomInt(1000)) .template(randomName("temp")) - .settings(randomSettings(ImmutableSettings.EMPTY)); + .settings(randomSettings(Settings.EMPTY)); int aliasCount = randomIntBetween(0, 10); for (int i = 0; i < aliasCount; i++) { builder.putAlias(randomAlias()); diff --git a/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java b/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java index 5e5bb5ca937..68d682ddf7b 100644 --- a/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java +++ b/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.Priority; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.discovery.zen.elect.ElectMasterService; @@ -37,7 +36,7 @@ import org.junit.Test; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; @@ -295,7 +294,7 @@ public class MinimumMasterNodesTests extends ElasticsearchIntegrationTest { @Test public void testCanNotBringClusterDown() throws ExecutionException, InterruptedException { int nodeCount = scaledRandomIntBetween(1, 5); - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put("discovery.type", "zen") .put("discovery.zen.ping_timeout", "200ms") .put("discovery.initial_state_timeout", "500ms"); diff --git a/src/test/java/org/elasticsearch/cluster/NoMasterNodeTests.java b/src/test/java/org/elasticsearch/cluster/NoMasterNodeTests.java index d261b0a3b01..bacf5761760 100644 --- a/src/test/java/org/elasticsearch/cluster/NoMasterNodeTests.java +++ b/src/test/java/org/elasticsearch/cluster/NoMasterNodeTests.java @@ -43,7 +43,7 @@ import org.junit.Test; import java.util.HashMap; import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/cluster/SimpleDataNodesTests.java b/src/test/java/org/elasticsearch/cluster/SimpleDataNodesTests.java index 7e571662f19..d02bf477fe5 100644 --- a/src/test/java/org/elasticsearch/cluster/SimpleDataNodesTests.java +++ b/src/test/java/org/elasticsearch/cluster/SimpleDataNodesTests.java @@ -28,7 +28,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.junit.Test; import static org.elasticsearch.client.Requests.createIndexRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/cluster/SpecificMasterNodesTests.java b/src/test/java/org/elasticsearch/cluster/SpecificMasterNodesTests.java index 0351f0613b6..54bb8ffafc3 100644 --- a/src/test/java/org/elasticsearch/cluster/SpecificMasterNodesTests.java +++ b/src/test/java/org/elasticsearch/cluster/SpecificMasterNodesTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.cluster; import org.elasticsearch.cluster.metadata.MappingMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -40,8 +40,8 @@ import static org.hamcrest.Matchers.*; @Slow public class SpecificMasterNodesTests extends ElasticsearchIntegrationTest { - protected final ImmutableSettings.Builder settingsBuilder() { - return ImmutableSettings.builder().put("discovery.type", "zen"); + protected final Settings.Builder settingsBuilder() { + return Settings.builder().put("discovery.type", "zen"); } @Test diff --git a/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationTests.java b/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationTests.java index 55b4a932c3a..416bc90bd24 100644 --- a/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationTests.java +++ b/src/test/java/org/elasticsearch/cluster/UpdateSettingsValidationTests.java @@ -27,7 +27,7 @@ import org.junit.Test; import java.util.List; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java b/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java index 717aa891c6c..f226959dae2 100644 --- a/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java +++ b/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java @@ -30,13 +30,12 @@ import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.TEST; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -47,7 +46,7 @@ public class AckClusterUpdateSettingsTests extends ElasticsearchIntegrationTest @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) //make sure that enough concurrent reroutes can happen at the same time //we have a minimum of 2 nodes, and a maximum of 10 shards, thus 5 should be enough @@ -69,7 +68,7 @@ public class AckClusterUpdateSettingsTests extends ElasticsearchIntegrationTest private void removePublishTimeout() { //to test that the acknowledgement mechanism is working we better disable the wait for publish //otherwise the operation is most likely acknowledged even if it doesn't support ack - assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "0"))); + assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "0"))); } @Test diff --git a/src/test/java/org/elasticsearch/cluster/ack/AckTests.java b/src/test/java/org/elasticsearch/cluster/ack/AckTests.java index 00724aada21..e94f81e2263 100644 --- a/src/test/java/org/elasticsearch/cluster/ack/AckTests.java +++ b/src/test/java/org/elasticsearch/cluster/ack/AckTests.java @@ -40,7 +40,6 @@ import org.elasticsearch.cluster.routing.MutableShardRouting; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.index.query.QueryBuilders; @@ -49,7 +48,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.*; @@ -61,7 +60,7 @@ public class AckTests extends ElasticsearchIntegrationTest { protected Settings nodeSettings(int nodeOrdinal) { //to test that the acknowledgement mechanism is working we better disable the wait for publish //otherwise the operation is most likely acknowledged even if it doesn't support ack - return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put(DiscoverySettings.PUBLISH_TIMEOUT, 0).build(); } @@ -70,7 +69,7 @@ public class AckTests extends ElasticsearchIntegrationTest { createIndex("test"); assertAcked(client().admin().indices().prepareUpdateSettings("test") - .setSettings(ImmutableSettings.builder().put("refresh_interval", 9999))); + .setSettings(Settings.builder().put("refresh_interval", 9999))); for (Client client : clients()) { String refreshInterval = getLocalClusterState(client).metaData().index("test").settings().get("index.refresh_interval"); @@ -82,7 +81,7 @@ public class AckTests extends ElasticsearchIntegrationTest { public void testUpdateSettingsNoAcknowledgement() { createIndex("test"); UpdateSettingsResponse updateSettingsResponse = client().admin().indices().prepareUpdateSettings("test").setTimeout("0s") - .setSettings(ImmutableSettings.builder().put("refresh_interval", 9999)).get(); + .setSettings(Settings.builder().put("refresh_interval", 9999)).get(); assertThat(updateSettingsResponse.isAcknowledged(), equalTo(false)); } @@ -175,7 +174,7 @@ public class AckTests extends ElasticsearchIntegrationTest { @Test public void testClusterRerouteAcknowledgement() throws InterruptedException { - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_SHARDS, between(cluster().numDataNodes(), DEFAULT_MAX_NUM_SHARDS)) .put(SETTING_NUMBER_OF_REPLICAS, 0) diff --git a/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationTests.java b/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationTests.java index cc0a275327e..19a8ac48fcc 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/AwarenessAllocationTests.java @@ -29,7 +29,6 @@ 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.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.zen.elect.ElectMasterService; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -39,7 +38,7 @@ import org.junit.Test; import java.util.List; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; @@ -57,14 +56,14 @@ public class AwarenessAllocationTests extends ElasticsearchIntegrationTest { @Test public void testSimpleAwareness() throws Exception { - Settings commonSettings = ImmutableSettings.settingsBuilder() + Settings commonSettings = Settings.settingsBuilder() .put("cluster.routing.schedule", "10ms") .put("cluster.routing.allocation.awareness.attributes", "rack_id") .build(); logger.info("--> starting 2 nodes on the same rack"); - internalCluster().startNodesAsync(2, ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1").build()).get(); + internalCluster().startNodesAsync(2, Settings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_1").build()).get(); createIndex("test1"); createIndex("test2"); @@ -77,7 +76,7 @@ public class AwarenessAllocationTests extends ElasticsearchIntegrationTest { ensureGreen(); logger.info("--> starting 1 node on a different rack"); - final String node3 = internalCluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_2").build()); + final String node3 = internalCluster().startNode(Settings.settingsBuilder().put(commonSettings).put("node.rack_id", "rack_2").build()); // On slow machines the initial relocation might be delayed assertThat(awaitBusy(new Predicate() { @@ -109,17 +108,17 @@ public class AwarenessAllocationTests extends ElasticsearchIntegrationTest { @Test @Slow public void testAwarenessZones() throws Exception { - Settings commonSettings = ImmutableSettings.settingsBuilder() + Settings commonSettings = Settings.settingsBuilder() .put("cluster.routing.allocation.awareness.force.zone.values", "a,b") .put("cluster.routing.allocation.awareness.attributes", "zone") .build(); logger.info("--> starting 4 nodes on different zones"); List nodes = internalCluster().startNodesAsync( - ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build(), - ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build(), - ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build(), - ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build() + Settings.settingsBuilder().put(commonSettings).put("node.zone", "a").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build(), + Settings.settingsBuilder().put(commonSettings).put("node.zone", "b").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build(), + Settings.settingsBuilder().put(commonSettings).put("node.zone", "b").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build(), + Settings.settingsBuilder().put(commonSettings).put("node.zone", "a").put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 3).build() ).get(); String A_0 = nodes.get(0); String B_0 = nodes.get(1); @@ -149,15 +148,15 @@ public class AwarenessAllocationTests extends ElasticsearchIntegrationTest { @Test @Slow public void testAwarenessZonesIncrementalNodes() throws Exception { - Settings commonSettings = ImmutableSettings.settingsBuilder() + Settings commonSettings = Settings.settingsBuilder() .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( - ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "a").build(), - ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build() + Settings.settingsBuilder().put(commonSettings).put("node.zone", "a").build(), + Settings.settingsBuilder().put(commonSettings).put("node.zone", "b").build() ).get(); String A_0 = nodes.get(0); String B_0 = nodes.get(1); @@ -180,7 +179,7 @@ public class AwarenessAllocationTests extends ElasticsearchIntegrationTest { assertThat(counts.get(B_0), equalTo(5)); logger.info("--> starting another node in zone 'b'"); - String B_1 = internalCluster().startNode(ImmutableSettings.settingsBuilder().put(commonSettings).put("node.zone", "b").build()); + String B_1 = internalCluster().startNode(Settings.settingsBuilder().put(commonSettings).put("node.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(); @@ -225,7 +224,7 @@ public class AwarenessAllocationTests extends ElasticsearchIntegrationTest { 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(ImmutableSettings.settingsBuilder().put("cluster.routing.allocation.awareness.attributes", "").build()).get(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.settingsBuilder().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/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java b/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java index 69098eeafde..b5181b64883 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java @@ -51,7 +51,7 @@ import java.util.List; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked; diff --git a/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java b/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java index 455f6f796e1..dbc97dddfbf 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java @@ -33,7 +33,7 @@ import org.junit.Test; import java.util.List; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java b/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java index cecb6a4a498..ac5741e93f4 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java @@ -22,14 +22,13 @@ package org.elasticsearch.cluster.allocation; import org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator; import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocatorModule; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.hamcrest.Matchers.instanceOf; @@ -37,7 +36,7 @@ import static org.hamcrest.Matchers.instanceOf; public class ShardsAllocatorModuleTests extends ElasticsearchIntegrationTest { public void testLoadDefaultShardsAllocator() throws IOException { - assertAllocatorInstance(ImmutableSettings.Builder.EMPTY_SETTINGS, BalancedShardsAllocator.class); + assertAllocatorInstance(Settings.Builder.EMPTY_SETTINGS, BalancedShardsAllocator.class); } public void testLoadByShortKeyShardsAllocator() throws IOException { diff --git a/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationTests.java b/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationTests.java index 688a27a7174..06659cbd67b 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/SimpleAllocationTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java b/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java index d270402e10d..c5063bfc80c 100644 --- a/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java +++ b/src/test/java/org/elasticsearch/cluster/metadata/ToAndFromJsonMetaDataTests.java @@ -28,7 +28,7 @@ import org.junit.Test; import java.io.IOException; import static org.elasticsearch.cluster.metadata.AliasMetaData.newAliasMetaDataBuilder; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java b/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java index 8b6ebff1e62..c86508f756c 100644 --- a/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java +++ b/src/test/java/org/elasticsearch/cluster/node/DiscoveryNodeFiltersTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.cluster.node; import com.google.common.collect.ImmutableMap; import org.elasticsearch.Version; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.test.ElasticsearchTestCase; @@ -38,7 +37,7 @@ public class DiscoveryNodeFiltersTests extends ElasticsearchTestCase { @Test public void nameMatch() { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("xxx.name", "name1") .build(); DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings); @@ -52,7 +51,7 @@ public class DiscoveryNodeFiltersTests extends ElasticsearchTestCase { @Test public void idMatch() { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("xxx._id", "id1") .build(); DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings); @@ -66,7 +65,7 @@ public class DiscoveryNodeFiltersTests extends ElasticsearchTestCase { @Test public void idOrNameMatch() { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("xxx._id", "id1,blah") .put("xxx.name", "blah,name2") .build(); @@ -84,7 +83,7 @@ public class DiscoveryNodeFiltersTests extends ElasticsearchTestCase { @Test public void tagAndGroupMatch() { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("xxx.tag", "A") .put("xxx.group", "B") .build(); @@ -108,7 +107,7 @@ public class DiscoveryNodeFiltersTests extends ElasticsearchTestCase { @Test public void starMatch() { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("xxx.name", "*") .build(); DiscoveryNodeFilters filters = DiscoveryNodeFilters.buildFromSettings(OR, "xxx.", settings); diff --git a/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityTests.java b/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityTests.java index 9fa24cb79e3..f2957d75d08 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.test.ElasticsearchTestCase; @@ -40,7 +39,7 @@ public class RoutingBackwardCompatibilityTests extends ElasticsearchTestCase { public void testBackwardCompatibility() throws Exception { Path baseDir = createTempDir(); - Node node = new Node(ImmutableSettings.builder().put("path.home", baseDir.toString()).build(), false); + Node node = new Node(Settings.builder().put("path.home", baseDir.toString()).build(), false); try { try (BufferedReader reader = new BufferedReader(new InputStreamReader(RoutingBackwardCompatibilityTests.class.getResourceAsStream("/org/elasticsearch/cluster/routing/shard_routes.txt"), "UTF-8"))) { for (String line = reader.readLine(); line != null; line = reader.readLine()) { diff --git a/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityUponUpgradeTests.java b/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityUponUpgradeTests.java index b0ec52e3bbd..54a8c964e53 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityUponUpgradeTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/RoutingBackwardCompatibilityUponUpgradeTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.search.SearchHit; @@ -51,7 +50,7 @@ public class RoutingBackwardCompatibilityUponUpgradeTests extends ElasticsearchI private void test(String name, Class expectedHashFunction, boolean expectedUseType) throws Exception { Path zippedIndexDir = getDataPath("/org/elasticsearch/cluster/routing/" + name + ".zip"); Settings baseSettings = prepareBackwardsDataDir(zippedIndexDir); - internalCluster().startNode(ImmutableSettings.builder() + internalCluster().startNode(Settings.builder() .put(baseSettings) .put(Node.HTTP_ENABLED, true) .build()); diff --git a/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTest.java b/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTest.java index f6f6c6cc38e..23fad2de2ec 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTest.java +++ b/src/test/java/org/elasticsearch/cluster/routing/RoutingTableTest.java @@ -27,7 +27,6 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.node.DiscoveryNodes.Builder; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.test.ElasticsearchAllocationTestCase; @@ -35,7 +34,7 @@ import org.junit.Before; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; @@ -49,7 +48,7 @@ public class RoutingTableTest extends ElasticsearchAllocationTestCase { private int numberOfReplicas; private int shardsPerIndex; private int totalNumberOfShards; - private final static Settings DEFAULT_SETTINGS = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + private final static Settings DEFAULT_SETTINGS = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); private final AllocationService ALLOCATION_SERVICE = createAllocationService(settingsBuilder() .put("cluster.routing.allocation.concurrent_recoveries", 10) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 10) diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java index 53e9dd89cee..46424270fa9 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java @@ -33,7 +33,7 @@ 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.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.hamcrest.Matcher; import org.hamcrest.Matchers; @@ -44,14 +44,14 @@ 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class AddIncrementallyTests extends ElasticsearchAllocationTestCase { private final ESLogger logger = Loggers.getLogger(AddIncrementallyTests.class); @Test public void testAddNodesAndIndices() { - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()); AllocationService service = createAllocationService(settings.build()); @@ -95,7 +95,7 @@ public class AddIncrementallyTests extends ElasticsearchAllocationTestCase { @Test public void testMinimalRelocations() { - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()) .put("cluster.routing.allocation.node_concurrent_recoveries", 2); AllocationService service = createAllocationService(settings.build()); @@ -165,7 +165,7 @@ public class AddIncrementallyTests extends ElasticsearchAllocationTestCase { @Test public void testMinimalRelocationsNoLimit() { - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()) .put("cluster.routing.allocation.node_concurrent_recoveries", 100) .put("cluster.routing.allocation.node_initial_primaries_recoveries", 100); diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java index 959088bdd3b..2b7607422b8 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocatePostApiFlagTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java index 62583a274cc..24cd971848d 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AllocationCommandsTests.java @@ -44,7 +44,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java index 1f2ed79ce74..c8d1926b6d3 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/AwarenessAllocationTests.java @@ -35,7 +35,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java index 7775b57858d..53167a4cf28 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceConfigurationTests.java @@ -34,7 +34,7 @@ import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocators; 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.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.gateway.NoopGatewayAllocator; import org.elasticsearch.node.settings.NodeSettingsService; import org.elasticsearch.test.ElasticsearchAllocationTestCase; @@ -43,7 +43,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class BalanceConfigurationTests extends ElasticsearchAllocationTestCase { @@ -61,7 +61,7 @@ public class BalanceConfigurationTests extends ElasticsearchAllocationTestCase { final float replicaBalance = 0.0f; final float balanceTreshold = 1.0f; - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()); settings.put(BalancedShardsAllocator.SETTING_INDEX_BALANCE_FACTOR, indexBalance); settings.put(BalancedShardsAllocator.SETTING_SHARD_BALANCE_FACTOR, replicaBalance); @@ -87,7 +87,7 @@ public class BalanceConfigurationTests extends ElasticsearchAllocationTestCase { final float replicaBalance = 1.0f; final float balanceTreshold = 1.0f; - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE, ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString()); settings.put(BalancedShardsAllocator.SETTING_INDEX_BALANCE_FACTOR, indexBalance); settings.put(BalancedShardsAllocator.SETTING_SHARD_BALANCE_FACTOR, replicaBalance); @@ -277,7 +277,7 @@ public class BalanceConfigurationTests extends ElasticsearchAllocationTestCase { @Test public void testPersistedSettings() { - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); settings.put(BalancedShardsAllocator.SETTING_INDEX_BALANCE_FACTOR, 0.2); settings.put(BalancedShardsAllocator.SETTING_SHARD_BALANCE_FACTOR, 0.3); settings.put(BalancedShardsAllocator.SETTING_THRESHOLD, 2.0); @@ -315,9 +315,9 @@ public class BalanceConfigurationTests extends ElasticsearchAllocationTestCase { @Test public void testNoRebalanceOnPrimaryOverload() { - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); AllocationService strategy = new AllocationService(settings.build(), randomAllocationDeciders(settings.build(), - new NodeSettingsService(ImmutableSettings.Builder.EMPTY_SETTINGS), getRandom()), new ShardsAllocators(settings.build(), + new NodeSettingsService(Settings.Builder.EMPTY_SETTINGS), getRandom()), new ShardsAllocators(settings.build(), NoopGatewayAllocator.INSTANCE, new ShardsAllocator() { @Override diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTest.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTest.java index 658256adf29..481a036eafa 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTest.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/BalanceUnbalancedClusterTest.java @@ -36,7 +36,7 @@ import java.util.HashMap; import java.util.Map; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * see issue #9023 diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestBase.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestBase.java index 7f99aa55548..2ab363abd87 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestBase.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/CatAllocationTestBase.java @@ -40,7 +40,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * A base testscase that allows to run tests based on the output of the CAT API diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java index 95c789de23e..d738a8cbd65 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ClusterRebalanceRoutingTests.java @@ -33,7 +33,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java index 12b582f8e61..2cf4f13a3b9 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ConcurrentRebalanceRoutingTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java index 6c90b33e9d0..5fc7cb58ab7 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/DeadNodesAllocationTests.java @@ -34,7 +34,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java index fe48742dc16..fb6a3198ce4 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/DisableAllocationTests.java @@ -33,7 +33,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java index 218cf61ffc7..eb341deded8 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ElectReplicaAsPrimaryDuringRelocationTests.java @@ -34,7 +34,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java index c327e31d95a..5eab884605d 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java @@ -35,7 +35,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; public class FailedNodeRoutingTests extends ElasticsearchAllocationTestCase { diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java index 0a2120b5062..505de07e16d 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedShardsRoutingTests.java @@ -37,7 +37,7 @@ import org.junit.Test; import java.util.ArrayList; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java index 1e4aff91e67..786a0f9e569 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterRoutingTests.java @@ -37,7 +37,7 @@ import org.junit.Test; import java.util.List; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java index a2e26148887..85bcfb8a3ee 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/IndexBalanceTests.java @@ -33,7 +33,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java index 371bdc3bc1f..006fa12208b 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java @@ -41,7 +41,7 @@ import java.util.Collections; import java.util.List; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.VersionUtils.randomVersion; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java index 32eea349482..1c5b2ea7eb7 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferLocalPrimariesToRelocatingPrimariesTests.java @@ -30,7 +30,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java index 8f1368585c9..d9607e9ac44 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PreferPrimaryAllocationTests.java @@ -31,7 +31,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java index 3a7d2fe0987..7d900e889fd 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryElectionRoutingTests.java @@ -33,7 +33,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java index fd6c473020f..ae3df569264 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/PrimaryNotRelocatedWhileBeingRecoveredTests.java @@ -33,7 +33,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java index b652ca3d56f..df15051c226 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RandomAllocationDeciderTests.java @@ -35,7 +35,7 @@ import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; import org.elasticsearch.cluster.routing.allocation.decider.Decision; import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.gateway.NoopGatewayAllocator; import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.hamcrest.Matchers; @@ -46,7 +46,7 @@ import java.util.HashSet; import java.util.Random; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; public class RandomAllocationDeciderTests extends ElasticsearchAllocationTestCase { @@ -59,8 +59,8 @@ public class RandomAllocationDeciderTests extends ElasticsearchAllocationTestCas @Test public void testRandomDecisions() { RandomAllocationDecider randomAllocationDecider = new RandomAllocationDecider(getRandom()); - AllocationService strategy = new AllocationService(settingsBuilder().build(), new AllocationDeciders(ImmutableSettings.EMPTY, - new HashSet<>(Arrays.asList(new SameShardAllocationDecider(ImmutableSettings.EMPTY), + AllocationService strategy = new AllocationService(settingsBuilder().build(), new AllocationDeciders(Settings.EMPTY, + new HashSet<>(Arrays.asList(new SameShardAllocationDecider(Settings.EMPTY), randomAllocationDecider))), new ShardsAllocators(NoopGatewayAllocator.INSTANCE), ClusterInfoService.EMPTY); int indices = scaledRandomIntBetween(1, 20); Builder metaBuilder = MetaData.builder(); @@ -169,7 +169,7 @@ public class RandomAllocationDeciderTests extends ElasticsearchAllocationTestCas private final Random random; public RandomAllocationDecider(Random random) { - super(ImmutableSettings.EMPTY); + super(Settings.EMPTY); this.random = random; } diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java index 1b71dac8a82..a8d44c1df12 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RebalanceAfterActiveTests.java @@ -34,7 +34,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java index a9b85a91b90..268fed8876f 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ReplicaAllocatedAfterPrimaryTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java index f9dcb51eacc..620ad859c8e 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/RoutingNodesIntegrityTests.java @@ -35,7 +35,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java index 4f393ea2dac..355f917b1c1 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SameShardRoutingTests.java @@ -34,12 +34,11 @@ import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.test.ElasticsearchAllocationTestCase; -import org.elasticsearch.test.junit.annotations.TestLogging; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java index 3eb79550219..4ca86bfcf75 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardVersioningTests.java @@ -33,7 +33,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; public class ShardVersioningTests extends ElasticsearchAllocationTestCase { diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java index 2db0af17dd2..68732d9fa64 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ShardsLimitAllocationTests.java @@ -36,7 +36,7 @@ import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java index ebd72660d92..7044d34ec7c 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardNoReplicasRoutingTests.java @@ -42,7 +42,7 @@ import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Sets.newHashSet; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; import static org.elasticsearch.cluster.routing.allocation.RoutingNodesUtils.numberOfShardsOfType; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java index 78868fc0835..9b5b955d426 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/SingleShardOneReplicaRoutingTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java index 9b17987d1a3..54ac32c01ac 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/TenShardsOneReplicaRoutingTests.java @@ -33,7 +33,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java index dd75a7f0455..7479bd1db36 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/ThrottlingAllocationTests.java @@ -31,7 +31,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java index 29ec0f0ac5d..4749ab5ad86 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/UpdateNumberOfReplicasTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java index 3eb177643cd..c1a83da0b78 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java @@ -37,7 +37,6 @@ import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocators; import org.elasticsearch.cluster.routing.allocation.command.AllocationCommand; import org.elasticsearch.cluster.routing.allocation.command.AllocationCommands; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.gateway.NoopGatewayAllocator; import org.elasticsearch.common.transport.LocalTransportAddress; @@ -51,7 +50,7 @@ import java.util.HashSet; import java.util.Map; import static org.elasticsearch.cluster.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -80,9 +79,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { shardSizes.put("[test][0][r]", 10L); final ClusterInfo clusterInfo = new ClusterInfo(ImmutableMap.copyOf(usages), ImmutableMap.copyOf(shardSizes)); - AllocationDeciders deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); ClusterInfoService cis = new ClusterInfoService() { @@ -178,9 +177,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, "60%") .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, 0.7).build(); - deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); strategy = new AllocationService(settingsBuilder() @@ -209,9 +208,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, 0.5) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, 0.6).build(); - deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); strategy = new AllocationService(settingsBuilder() @@ -275,9 +274,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { shardSizes.put("[test][0][r]", 10L); final ClusterInfo clusterInfo = new ClusterInfo(ImmutableMap.copyOf(usages), ImmutableMap.copyOf(shardSizes)); - AllocationDeciders deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); ClusterInfoService cis = new ClusterInfoService() { @@ -410,9 +409,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, "40b") .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, "30b").build(); - deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); strategy = new AllocationService(settingsBuilder() @@ -441,9 +440,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, "50b") .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, "40b").build(); - deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); strategy = new AllocationService(settingsBuilder() @@ -536,9 +535,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { shardSizes.put("[test][0][p]", 10L); // 10 bytes final ClusterInfo clusterInfo = new ClusterInfo(ImmutableMap.copyOf(usages), ImmutableMap.copyOf(shardSizes)); - AllocationDeciders deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); ClusterInfoService cis = new ClusterInfoService() { @@ -603,9 +602,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { shardSizes.put("[test][0][r]", 10L); // 10 bytes final ClusterInfo clusterInfo = new ClusterInfo(ImmutableMap.copyOf(usages), ImmutableMap.copyOf(shardSizes)); - AllocationDeciders deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); ClusterInfoService cis = new ClusterInfoService() { @@ -663,7 +662,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { @Test public void averageUsageUnitTest() { RoutingNode rn = new RoutingNode("node1", newNode("node1")); - DiskThresholdDecider decider = new DiskThresholdDecider(ImmutableSettings.EMPTY); + DiskThresholdDecider decider = new DiskThresholdDecider(Settings.EMPTY); Map usages = new HashMap<>(); usages.put("node2", new DiskUsage("node2", "n2", 100, 50)); // 50% used @@ -677,7 +676,7 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { @Test public void freeDiskPercentageAfterShardAssignedUnitTest() { RoutingNode rn = new RoutingNode("node1", newNode("node1")); - DiskThresholdDecider decider = new DiskThresholdDecider(ImmutableSettings.EMPTY); + DiskThresholdDecider decider = new DiskThresholdDecider(Settings.EMPTY); Map usages = new HashMap<>(); usages.put("node2", new DiskUsage("node2", "n2", 100, 50)); // 50% used @@ -707,9 +706,9 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { shardSizes.put("[test2][0][r]", 1L); final ClusterInfo clusterInfo = new ClusterInfo(ImmutableMap.copyOf(usages), ImmutableMap.copyOf(shardSizes)); - AllocationDeciders deciders = new AllocationDeciders(ImmutableSettings.EMPTY, + AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), + new SameShardAllocationDecider(Settings.EMPTY), new DiskThresholdDecider(diskSettings)))); ClusterInfoService cis = new ClusterInfoService() { @@ -882,8 +881,8 @@ public class DiskThresholdDeciderTests extends ElasticsearchAllocationTestCase { // noop } }; - AllocationDeciders deciders = new AllocationDeciders(ImmutableSettings.EMPTY, new HashSet<>(Arrays.asList( - new SameShardAllocationDecider(ImmutableSettings.EMPTY), diskThresholdDecider + AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList( + new SameShardAllocationDecider(Settings.EMPTY), diskThresholdDecider ))); AllocationService strategy = new AllocationService(settingsBuilder() .put("cluster.routing.allocation.concurrent_recoveries", 10) diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderUnitTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderUnitTests.java index 3809a9f7b27..4424af66fa6 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderUnitTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderUnitTests.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableMap; import org.elasticsearch.cluster.ClusterInfo; import org.elasticsearch.cluster.ClusterInfoService; import org.elasticsearch.cluster.DiskUsage; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.node.settings.NodeSettingsService; @@ -42,7 +41,7 @@ public class DiskThresholdDeciderUnitTests extends ElasticsearchTestCase { @Test public void testDynamicSettings() { - NodeSettingsService nss = new NodeSettingsService(ImmutableSettings.EMPTY); + NodeSettingsService nss = new NodeSettingsService(Settings.EMPTY); ClusterInfoService cis = new ClusterInfoService() { @Override @@ -57,7 +56,7 @@ public class DiskThresholdDeciderUnitTests extends ElasticsearchTestCase { // noop } }; - DiskThresholdDecider decider = new DiskThresholdDecider(ImmutableSettings.EMPTY, nss, cis, null); + DiskThresholdDecider decider = new DiskThresholdDecider(Settings.EMPTY, nss, cis, null); assertThat(decider.getFreeBytesThresholdHigh(), equalTo(ByteSizeValue.parseBytesSizeValue("0b"))); assertThat(decider.getFreeDiskThresholdHigh(), equalTo(10.0d)); @@ -69,7 +68,7 @@ public class DiskThresholdDeciderUnitTests extends ElasticsearchTestCase { DiskThresholdDecider.ApplySettings applySettings = decider.newApplySettings(); - Settings newSettings = ImmutableSettings.builder() + Settings newSettings = Settings.builder() .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, false) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS, false) .put(DiskThresholdDecider.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, "70%") diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIntegrationTest.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIntegrationTest.java index d753e8e8655..12924234cea 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIntegrationTest.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationDeciderIntegrationTest.java @@ -18,14 +18,12 @@ */ package org.elasticsearch.cluster.routing.allocation.decider; -import com.carrotsearch.randomizedtesting.annotations.Repeat; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.test.ElasticsearchIntegrationTest; -import org.elasticsearch.test.junit.annotations.TestLogging; import java.util.Set; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java index d36c0f820c9..52c4bb27a1e 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/EnableAllocationTests.java @@ -33,7 +33,6 @@ import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDeci import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.Rebalance; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.settings.NodeSettingsService; import org.elasticsearch.test.ElasticsearchAllocationTestCase; @@ -48,7 +47,7 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE; import static org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** @@ -172,7 +171,7 @@ public class EnableAllocationTests extends ElasticsearchAllocationTestCase { .build(); NodeSettingsService nodeSettingsService = new NodeSettingsService(build); AllocationService strategy = createAllocationService(build, nodeSettingsService, getRandom()); - Settings indexSettings = useClusterSetting ? ImmutableSettings.EMPTY : settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, Rebalance.NONE).build(); + Settings indexSettings = useClusterSetting ? Settings.EMPTY : settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, Rebalance.NONE).build(); logger.info("Building initial routing table"); MetaData metaData = MetaData.builder() @@ -275,7 +274,7 @@ public class EnableAllocationTests extends ElasticsearchAllocationTestCase { .build(); NodeSettingsService nodeSettingsService = new NodeSettingsService(build); AllocationService strategy = createAllocationService(build, nodeSettingsService, getRandom()); - Settings indexSettings = useClusterSetting ? ImmutableSettings.EMPTY : settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, Rebalance.NONE).build(); + Settings indexSettings = useClusterSetting ? Settings.EMPTY : settingsBuilder().put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, Rebalance.NONE).build(); logger.info("Building initial routing table"); MetaData metaData = MetaData.builder() diff --git a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java index eff8a14eb6d..db4bb576552 100644 --- a/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java +++ b/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.fs.FsStats; import org.elasticsearch.node.settings.NodeSettingsService; @@ -46,7 +45,7 @@ import java.util.concurrent.CountDownLatch; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Maps.newHashMap; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -55,7 +54,7 @@ public class MockDiskUsagesTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) // Use the mock internal cluster info service, which has fake-able disk usages .put(ClusterModule.CLUSTER_SERVICE_IMPL, MockInternalClusterInfoService.class.getName()) diff --git a/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsTests.java b/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsTests.java index 3aae8923ff5..9cc64db81b6 100644 --- a/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsTests.java +++ b/src/test/java/org/elasticsearch/cluster/settings/ClusterSettingsTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequ import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.routing.allocation.decider.DisableAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.indices.store.IndicesStore; @@ -31,7 +30,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.hamcrest.Matchers; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.TEST; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -48,7 +47,7 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { ClusterUpdateSettingsResponse response = client().admin().cluster() .prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put(key1, value1).build()) + .setTransientSettings(Settings.builder().put(key1, value1).build()) .get(); assertAcked(response); @@ -63,8 +62,8 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { String key2 = DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_ALLOCATION; boolean value2 = true; - Settings transientSettings1 = ImmutableSettings.builder().put(key1, value1).build(); - Settings persistentSettings1 = ImmutableSettings.builder().put(key2, value2).build(); + Settings transientSettings1 = Settings.builder().put(key1, value1).build(); + Settings persistentSettings1 = Settings.builder().put(key2, value2).build(); ClusterUpdateSettingsResponse response1 = client().admin().cluster() .prepareUpdateSettings() @@ -79,8 +78,8 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { assertThat(response1.getPersistentSettings().get(key1), nullValue()); assertThat(response1.getPersistentSettings().get(key2), notNullValue()); - Settings transientSettings2 = ImmutableSettings.builder().put(key1, value1).put(key2, value2).build(); - Settings persistentSettings2 = ImmutableSettings.EMPTY; + Settings transientSettings2 = Settings.builder().put(key1, value1).put(key2, value2).build(); + Settings persistentSettings2 = Settings.EMPTY; ClusterUpdateSettingsResponse response2 = client().admin().cluster() .prepareUpdateSettings() @@ -95,8 +94,8 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { assertThat(response2.getPersistentSettings().get(key1), nullValue()); assertThat(response2.getPersistentSettings().get(key2), nullValue()); - Settings transientSettings3 = ImmutableSettings.EMPTY; - Settings persistentSettings3 = ImmutableSettings.builder().put(key1, value1).put(key2, value2).build(); + Settings transientSettings3 = Settings.EMPTY; + Settings persistentSettings3 = Settings.builder().put(key1, value1).put(key2, value2).build(); ClusterUpdateSettingsResponse response3 = client().admin().cluster() .prepareUpdateSettings() @@ -121,7 +120,7 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { ClusterUpdateSettingsResponse response = client().admin().cluster() .prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "1s").build()) + .setTransientSettings(Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "1s").build()) .get(); assertAcked(response); @@ -130,7 +129,7 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { response = client().admin().cluster() .prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "whatever").build()) + .setTransientSettings(Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "whatever").build()) .get(); assertAcked(response); @@ -139,7 +138,7 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { response = client().admin().cluster() .prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, -1).build()) + .setTransientSettings(Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, -1).build()) .get(); assertAcked(response); @@ -150,10 +149,10 @@ public class ClusterSettingsTests extends ElasticsearchIntegrationTest { @Test public void testClusterUpdateSettingsWithBlocks() { String key1 = "cluster.routing.allocation.enable"; - Settings transientSettings = ImmutableSettings.builder().put(key1, false).build(); + Settings transientSettings = Settings.builder().put(key1, false).build(); String key2 = "cluster.routing.allocation.node_concurrent_recoveries"; - Settings persistentSettings = ImmutableSettings.builder().put(key2, "5").build(); + Settings persistentSettings = Settings.builder().put(key2, "5").build(); ClusterUpdateSettingsRequestBuilder request = client().admin().cluster().prepareUpdateSettings() .setTransientSettings(transientSettings) diff --git a/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringTests.java b/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringTests.java index 515122c9f20..e8876577ce4 100644 --- a/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringTests.java +++ b/src/test/java/org/elasticsearch/cluster/settings/SettingsFilteringTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.plugins.AbstractPlugin; @@ -44,7 +43,7 @@ public class SettingsFilteringTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put("plugin.types", SettingsFilteringPlugin.class.getName()) .build(); @@ -95,7 +94,7 @@ public class SettingsFilteringTests extends ElasticsearchIntegrationTest { @Test public void testSettingsFiltering() { - assertAcked(client().admin().indices().prepareCreate("test-idx").setSettings(ImmutableSettings.builder() + assertAcked(client().admin().indices().prepareCreate("test-idx").setSettings(Settings.builder() .put("filter_test.foo", "test") .put("filter_test.bar1", "test") .put("filter_test.bar2", "test") diff --git a/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java b/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java index f337bf5b67c..2daaa66d7e3 100644 --- a/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java +++ b/src/test/java/org/elasticsearch/cluster/shards/ClusterSearchShardsTests.java @@ -30,7 +30,7 @@ import org.junit.Test; import java.util.Arrays; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java b/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java index 8411e21eb24..8bde8877d28 100644 --- a/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java +++ b/src/test/java/org/elasticsearch/cluster/structure/RoutingIteratorTests.java @@ -32,13 +32,13 @@ import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.routing.allocation.decider.AwarenessAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.cluster.routing.OperationRouting; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.test.ElasticsearchAllocationTestCase; import org.junit.Test; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; public class RoutingIteratorTests extends ElasticsearchAllocationTestCase { @@ -293,7 +293,7 @@ public class RoutingIteratorTests extends ElasticsearchAllocationTestCase { routingTable = strategy.applyStartedShards(clusterState, clusterState.routingNodes().shardsWithState(INITIALIZING)).routingTable(); clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build(); - OperationRouting operationRouting = new OperationRouting(ImmutableSettings.Builder.EMPTY_SETTINGS, new AwarenessAllocationDecider()); + OperationRouting operationRouting = new OperationRouting(Settings.Builder.EMPTY_SETTINGS, new AwarenessAllocationDecider()); GroupShardsIterator shardIterators = operationRouting.searchShards(clusterState, new String[]{"test"}, new String[]{"test"}, null, "_shards:0"); assertThat(shardIterators.size(), equalTo(1)); diff --git a/src/test/java/org/elasticsearch/codecs/CodecTests.java b/src/test/java/org/elasticsearch/codecs/CodecTests.java index 0af133670b7..3dfbf8acc82 100644 --- a/src/test/java/org/elasticsearch/codecs/CodecTests.java +++ b/src/test/java/org/elasticsearch/codecs/CodecTests.java @@ -23,7 +23,7 @@ import org.apache.lucene.codecs.Codec; import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.mapper.DocumentMapperParser; @@ -47,7 +47,7 @@ public class CodecTests extends ElasticsearchSingleNodeTest { .endObject().endObject().string(); int i = 0; for (Version v : VersionUtils.allVersions()) { - IndexService indexService = createIndex("test-" + i++, ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, v).build()); + IndexService indexService = createIndex("test-" + i++, Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, v).build()); DocumentMapperParser parser = indexService.mapperService().documentMapperParser(); try { parser.parse(mapping); @@ -70,7 +70,7 @@ public class CodecTests extends ElasticsearchSingleNodeTest { .endObject().endObject().string(); int i = 0; for (Version v : VersionUtils.allVersions()) { - IndexService indexService = createIndex("test-" + i++, ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, v).build()); + IndexService indexService = createIndex("test-" + i++, Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, v).build()); DocumentMapperParser parser = indexService.mapperService().documentMapperParser(); try { parser.parse(mapping); diff --git a/src/test/java/org/elasticsearch/common/blobstore/BlobStoreTest.java b/src/test/java/org/elasticsearch/common/blobstore/BlobStoreTest.java index 10fd9ef1405..bcffd188b65 100644 --- a/src/test/java/org/elasticsearch/common/blobstore/BlobStoreTest.java +++ b/src/test/java/org/elasticsearch/common/blobstore/BlobStoreTest.java @@ -23,7 +23,6 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.common.blobstore.fs.FsBlobStore; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -142,7 +141,7 @@ public class BlobStoreTest extends ElasticsearchTestCase { protected BlobStore newBlobStore() throws IOException { Path tempDir = createTempDir(); - Settings settings = randomBoolean() ? ImmutableSettings.EMPTY : ImmutableSettings.builder().put("buffer_size", new ByteSizeValue(randomIntBetween(1, 100), ByteSizeUnit.KB)).build(); + Settings settings = randomBoolean() ? Settings.EMPTY : Settings.builder().put("buffer_size", new ByteSizeValue(randomIntBetween(1, 100), ByteSizeUnit.KB)).build(); FsBlobStore store = new FsBlobStore(settings, tempDir); return store; } diff --git a/src/test/java/org/elasticsearch/common/breaker/MemoryCircuitBreakerTests.java b/src/test/java/org/elasticsearch/common/breaker/MemoryCircuitBreakerTests.java index d8dea675bd0..27946bacf4b 100644 --- a/src/test/java/org/elasticsearch/common/breaker/MemoryCircuitBreakerTests.java +++ b/src/test/java/org/elasticsearch/common/breaker/MemoryCircuitBreakerTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.common.breaker; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.indices.breaker.BreakerSettings; import org.elasticsearch.indices.breaker.CircuitBreakerService; @@ -91,7 +91,7 @@ public class MemoryCircuitBreakerTests extends ElasticsearchTestCase { final AtomicReference lastException = new AtomicReference<>(null); final AtomicReference breakerRef = new AtomicReference<>(null); - final CircuitBreakerService service = new HierarchyCircuitBreakerService(ImmutableSettings.EMPTY, new NodeSettingsService(ImmutableSettings.EMPTY)) { + final CircuitBreakerService service = new HierarchyCircuitBreakerService(Settings.EMPTY, new NodeSettingsService(Settings.EMPTY)) { @Override public CircuitBreaker getBreaker(String name) { @@ -152,7 +152,7 @@ public class MemoryCircuitBreakerTests extends ElasticsearchTestCase { final AtomicInteger parentTripped = new AtomicInteger(0); final AtomicReference breakerRef = new AtomicReference<>(null); - final CircuitBreakerService service = new HierarchyCircuitBreakerService(ImmutableSettings.EMPTY, new NodeSettingsService(ImmutableSettings.EMPTY)) { + final CircuitBreakerService service = new HierarchyCircuitBreakerService(Settings.EMPTY, new NodeSettingsService(Settings.EMPTY)) { @Override public CircuitBreaker getBreaker(String name) { diff --git a/src/test/java/org/elasticsearch/common/bytes/PagedBytesReferenceTest.java b/src/test/java/org/elasticsearch/common/bytes/PagedBytesReferenceTest.java index 1ffbb8d9a0d..aa0f4110392 100644 --- a/src/test/java/org/elasticsearch/common/bytes/PagedBytesReferenceTest.java +++ b/src/test/java/org/elasticsearch/common/bytes/PagedBytesReferenceTest.java @@ -21,11 +21,9 @@ package org.elasticsearch.common.bytes; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefBuilder; -import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.ByteArray; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; diff --git a/src/test/java/org/elasticsearch/common/cli/CheckFileCommandTests.java b/src/test/java/org/elasticsearch/common/cli/CheckFileCommandTests.java index 0d131af78ae..4914f589c5a 100644 --- a/src/test/java/org/elasticsearch/common/cli/CheckFileCommandTests.java +++ b/src/test/java/org/elasticsearch/common/cli/CheckFileCommandTests.java @@ -23,7 +23,6 @@ import com.google.common.base.Charsets; import com.google.common.collect.Sets; import com.google.common.jimfs.Configuration; import com.google.common.jimfs.Jimfs; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.test.ElasticsearchTestCase; @@ -130,7 +129,7 @@ public class CheckFileCommandTests extends ElasticsearchTestCase { try (FileSystem fs = Jimfs.newFileSystem(configuration)) { Path path = fs.getPath(randomAsciiOfLength(10)); - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.home", createTempDir().toString()) .build(); new CreateFileCommand(captureOutputTerminal, path).execute(settings, new Environment(settings)); @@ -148,7 +147,7 @@ public class CheckFileCommandTests extends ElasticsearchTestCase { Path path = fs.getPath(randomAsciiOfLength(10)); Files.write(path, "anything".getBytes(Charsets.UTF_8)); - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.home", createTempDir().toString()) .build(); new DeleteFileCommand(captureOutputTerminal, path).execute(settings, new Environment(settings)); @@ -180,10 +179,10 @@ public class CheckFileCommandTests extends ElasticsearchTestCase { public CliTool.ExitStatus execute(FileSystem fs) throws Exception { this.fs = fs; this.paths = new Path[] { writePath(fs, "p1", "anything"), writePath(fs, "p2", "anything"), writePath(fs, "p3", "anything") }; - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.home", baseDir.toString()) .build(); - return super.execute(ImmutableSettings.EMPTY, new Environment(settings)); + return super.execute(Settings.EMPTY, new Environment(settings)); } private Path writePath(FileSystem fs, String name, String content) throws IOException { diff --git a/src/test/java/org/elasticsearch/common/compress/CompressedStreamTests.java b/src/test/java/org/elasticsearch/common/compress/CompressedStreamTests.java index d2d98e91814..89763cc25e8 100644 --- a/src/test/java/org/elasticsearch/common/compress/CompressedStreamTests.java +++ b/src/test/java/org/elasticsearch/common/compress/CompressedStreamTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.common.io.stream.ByteBufferStreamInput; import org.elasticsearch.common.io.stream.OutputStreamStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import java.io.ByteArrayOutputStream; @@ -43,7 +43,7 @@ public class CompressedStreamTests extends ElasticsearchTestCase { @Override public void setUp() throws Exception { super.setUp(); - CompressorFactory.configure(ImmutableSettings.settingsBuilder().put("compress.default.type", "lzf").build()); + CompressorFactory.configure(Settings.settingsBuilder().put("compress.default.type", "lzf").build()); } public void testRandom() throws IOException { diff --git a/src/test/java/org/elasticsearch/common/compress/CompressedStringTests.java b/src/test/java/org/elasticsearch/common/compress/CompressedStringTests.java index 1e1718ffa1c..4d9de6736e7 100644 --- a/src/test/java/org/elasticsearch/common/compress/CompressedStringTests.java +++ b/src/test/java/org/elasticsearch/common/compress/CompressedStringTests.java @@ -23,7 +23,7 @@ import org.apache.lucene.util.TestUtil; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Assert; import org.junit.Test; @@ -51,7 +51,7 @@ public class CompressedStringTests extends ElasticsearchTestCase { } public void simpleTests(String compressor) throws IOException { - CompressorFactory.configure(ImmutableSettings.settingsBuilder().put("compress.default.type", compressor).build()); + CompressorFactory.configure(Settings.settingsBuilder().put("compress.default.type", compressor).build()); String str = "this is a simple string"; CompressedString cstr = new CompressedString(str); assertThat(cstr.string(), equalTo(str)); @@ -66,7 +66,7 @@ public class CompressedStringTests extends ElasticsearchTestCase { public void testRandom() throws IOException { String compressor = "lzf"; - CompressorFactory.configure(ImmutableSettings.settingsBuilder().put("compress.default.type", compressor).build()); + CompressorFactory.configure(Settings.settingsBuilder().put("compress.default.type", compressor).build()); Random r = getRandom(); for (int i = 0; i < 1000; i++) { String string = TestUtil.randomUnicodeString(r, 10000); diff --git a/src/test/java/org/elasticsearch/common/logging/log4j/Log4jESLoggerTests.java b/src/test/java/org/elasticsearch/common/logging/log4j/Log4jESLoggerTests.java index 24df66c77e8..d854b2bd33d 100644 --- a/src/test/java/org/elasticsearch/common/logging/log4j/Log4jESLoggerTests.java +++ b/src/test/java/org/elasticsearch/common/logging/log4j/Log4jESLoggerTests.java @@ -24,17 +24,13 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.spi.LocationInfo; import org.apache.log4j.spi.LoggingEvent; -import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.After; import org.junit.Test; -import java.net.URL; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -54,7 +50,7 @@ public class Log4jESLoggerTests extends ElasticsearchTestCase { LogConfigurator.reset(); Path configDir = getDataPath("config"); // Need to set custom path.conf so we can use a custom logging.yml file for the test - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.conf", configDir.toAbsolutePath()) .put("path.home", createTempDir().toString()) .build(); diff --git a/src/test/java/org/elasticsearch/common/logging/log4j/LoggingConfigurationTests.java b/src/test/java/org/elasticsearch/common/logging/log4j/LoggingConfigurationTests.java index 1010ea734b3..4997ea6974c 100644 --- a/src/test/java/org/elasticsearch/common/logging/log4j/LoggingConfigurationTests.java +++ b/src/test/java/org/elasticsearch/common/logging/log4j/LoggingConfigurationTests.java @@ -21,23 +21,17 @@ package org.elasticsearch.common.logging.log4j; import org.apache.log4j.Appender; import org.apache.log4j.Logger; -import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.test.ElasticsearchTestCase; import org.hamcrest.Matchers; -import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; @@ -57,7 +51,7 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase { String level = Log4jESLoggerFactory.getLogger("test").getLevel(); try { Path configDir = getDataPath("config"); - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.conf", configDir.toAbsolutePath()) .put("path.home", createTempDir().toString()) .build(); @@ -88,12 +82,12 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase { Path loggingConf = tmpDir.resolve(loggingConfiguration("json")); Files.write(loggingConf, "{\"json\": \"foo\"}".getBytes(StandardCharsets.UTF_8)); Environment environment = new Environment( - ImmutableSettings.builder() + Settings.builder() .put("path.conf", tmpDir.toAbsolutePath()) .put("path.home", createTempDir().toString()) .build()); - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); LogConfigurator.resolveConfig(environment, builder); Settings logSettings = builder.build(); @@ -106,12 +100,12 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase { Path loggingConf = tmpDir.resolve(loggingConfiguration("properties")); Files.write(loggingConf, "key: value".getBytes(StandardCharsets.UTF_8)); Environment environment = new Environment( - ImmutableSettings.builder() + Settings.builder() .put("path.conf", tmpDir.toAbsolutePath()) .put("path.home", createTempDir().toString()) .build()); - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); LogConfigurator.resolveConfig(environment, builder); Settings logSettings = builder.build(); @@ -126,12 +120,12 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase { Files.write(loggingConf1, "yml: bar".getBytes(StandardCharsets.UTF_8)); Files.write(loggingConf2, "yaml: bar".getBytes(StandardCharsets.UTF_8)); Environment environment = new Environment( - ImmutableSettings.builder() + Settings.builder() .put("path.conf", tmpDir.toAbsolutePath()) .put("path.home", createTempDir().toString()) .build()); - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); LogConfigurator.resolveConfig(environment, builder); Settings logSettings = builder.build(); @@ -145,12 +139,12 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase { Path invalidSuffix = tmpDir.resolve(loggingConfiguration(randomFrom(LogConfigurator.ALLOWED_SUFFIXES)) + randomInvalidSuffix()); Files.write(invalidSuffix, "yml: bar".getBytes(StandardCharsets.UTF_8)); Environment environment = new Environment( - ImmutableSettings.builder() + Settings.builder() .put("path.conf", invalidSuffix.toAbsolutePath()) .put("path.home", createTempDir().toString()) .build()); - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); LogConfigurator.resolveConfig(environment, builder); Settings logSettings = builder.build(); diff --git a/src/test/java/org/elasticsearch/common/settings/ImmutableSettingsTests.java b/src/test/java/org/elasticsearch/common/settings/ImmutableSettingsTests.java index 4d44f635513..f8a542a9cc6 100644 --- a/src/test/java/org/elasticsearch/common/settings/ImmutableSettingsTests.java +++ b/src/test/java/org/elasticsearch/common/settings/ImmutableSettingsTests.java @@ -31,7 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/common/settings/SettingsFilterTests.java b/src/test/java/org/elasticsearch/common/settings/SettingsFilterTests.java index 29bdb34f7e3..7c138102979 100644 --- a/src/test/java/org/elasticsearch/common/settings/SettingsFilterTests.java +++ b/src/test/java/org/elasticsearch/common/settings/SettingsFilterTests.java @@ -33,7 +33,7 @@ public class SettingsFilterTests extends ElasticsearchTestCase { @Test public void testAddingAndRemovingFilters() { - SettingsFilter settingsFilter = new SettingsFilter(ImmutableSettings.EMPTY); + SettingsFilter settingsFilter = new SettingsFilter(Settings.EMPTY); settingsFilter.addFilter("foo"); settingsFilter.addFilter("bar"); settingsFilter.addFilter("baz"); @@ -52,51 +52,51 @@ public class SettingsFilterTests extends ElasticsearchTestCase { @Test public void testSettingsFiltering() throws IOException { - testFiltering(ImmutableSettings.builder() + testFiltering(Settings.builder() .put("foo", "foo_test") .put("foo1", "foo1_test") .put("bar", "bar_test") .put("bar1", "bar1_test") .put("bar.2", "bar2_test") .build(), - ImmutableSettings.builder() + Settings.builder() .put("foo1", "foo1_test") .build(), "foo,bar*" ); - testFiltering(ImmutableSettings.builder() + testFiltering(Settings.builder() .put("foo", "foo_test") .put("foo1", "foo1_test") .put("bar", "bar_test") .put("bar1", "bar1_test") .put("bar.2", "bar2_test") .build(), - ImmutableSettings.builder() + Settings.builder() .put("foo", "foo_test") .put("foo1", "foo1_test") .build(), "bar*" ); - testFiltering(ImmutableSettings.builder() + testFiltering(Settings.builder() .put("foo", "foo_test") .put("foo1", "foo1_test") .put("bar", "bar_test") .put("bar1", "bar1_test") .put("bar.2", "bar2_test") .build(), - ImmutableSettings.builder() + Settings.builder() .build(), "foo,bar*,foo*" ); - testFiltering(ImmutableSettings.builder() + testFiltering(Settings.builder() .put("foo", "foo_test") .put("bar", "bar_test") .put("baz", "baz_test") .build(), - ImmutableSettings.builder() + Settings.builder() .put("foo", "foo_test") .put("bar", "bar_test") .put("baz", "baz_test") @@ -105,7 +105,7 @@ public class SettingsFilterTests extends ElasticsearchTestCase { } private void testFiltering(Settings source, Settings filtered, String... patterns) throws IOException { - SettingsFilter settingsFilter = new SettingsFilter(ImmutableSettings.EMPTY); + SettingsFilter settingsFilter = new SettingsFilter(Settings.EMPTY); for (String pattern : patterns) { settingsFilter.addFilter(pattern); } @@ -122,7 +122,7 @@ public class SettingsFilterTests extends ElasticsearchTestCase { source.toXContent(xContentBuilder, request); xContentBuilder.endObject(); String filteredSettingsString = xContentBuilder.string(); - filteredSettings = ImmutableSettings.builder().loadFromSource(filteredSettingsString).build(); + filteredSettings = Settings.builder().loadFromSource(filteredSettingsString).build(); assertThat(filteredSettings.getAsMap().entrySet(), equalTo(filtered.getAsMap().entrySet())); } } diff --git a/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java b/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java index c237b96a6b3..5d492a6d6ac 100644 --- a/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java +++ b/src/test/java/org/elasticsearch/common/settings/loader/JsonSettingsLoaderTests.java @@ -23,7 +23,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java b/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java index d541d15462a..a9c77e9b310 100644 --- a/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java +++ b/src/test/java/org/elasticsearch/common/settings/loader/YamlSettingsLoaderTests.java @@ -23,7 +23,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/common/util/BigArraysTests.java b/src/test/java/org/elasticsearch/common/util/BigArraysTests.java index 2e9497e5fd9..40fe288c81c 100644 --- a/src/test/java/org/elasticsearch/common/util/BigArraysTests.java +++ b/src/test/java/org/elasticsearch/common/util/BigArraysTests.java @@ -23,7 +23,7 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.breaker.CircuitBreakingException; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; import org.elasticsearch.node.settings.NodeSettingsService; @@ -335,10 +335,10 @@ public class BigArraysTests extends ElasticsearchSingleNodeTest { final int size = scaledRandomIntBetween(5, 1 << 22); for (String type : Arrays.asList("Byte", "Int", "Long", "Float", "Double", "Object")) { HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService( - ImmutableSettings.builder() + Settings.builder() .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, size - 1) .build(), - new NodeSettingsService(ImmutableSettings.EMPTY)); + new NodeSettingsService(Settings.EMPTY)); BigArrays bigArrays = new BigArrays(null, hcbs).withCircuitBreaking(); Method create = BigArrays.class.getMethod("new" + type + "Array", long.class); try { @@ -355,10 +355,10 @@ public class BigArraysTests extends ElasticsearchSingleNodeTest { for (String type : Arrays.asList("Byte", "Int", "Long", "Float", "Double", "Object")) { final long maxSize = randomIntBetween(1 << 10, 1 << 22); HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService( - ImmutableSettings.builder() + Settings.builder() .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, maxSize) .build(), - new NodeSettingsService(ImmutableSettings.EMPTY)); + new NodeSettingsService(Settings.EMPTY)); BigArrays bigArrays = new BigArrays(null, hcbs).withCircuitBreaking(); Method create = BigArrays.class.getMethod("new" + type + "Array", long.class); final int size = scaledRandomIntBetween(1, 20); diff --git a/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelTests.java b/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelTests.java index a6d058745d3..5019f6eaee7 100644 --- a/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelTests.java +++ b/src/test/java/org/elasticsearch/consistencylevel/WriteConsistencyLevelTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.WriteConsistencyLevel; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.common.Priority; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -41,7 +41,7 @@ public class WriteConsistencyLevelTests extends ElasticsearchIntegrationTest { @Test public void testWriteConsistencyLevelReplication2() throws Exception { - prepareCreate("test", 1, ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 2)).execute().actionGet(); + prepareCreate("test", 1, Settings.settingsBuilder().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/src/test/java/org/elasticsearch/count/query/CountQueryTests.java b/src/test/java/org/elasticsearch/count/query/CountQueryTests.java index e06b8fa607d..e693be7c8bb 100644 --- a/src/test/java/org/elasticsearch/count/query/CountQueryTests.java +++ b/src/test/java/org/elasticsearch/count/query/CountQueryTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.ShardOperationFailedException; import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.BoolQueryBuilder; @@ -249,7 +248,7 @@ public class CountQueryTests extends ElasticsearchIntegrationTest { } private void typeFilterTests(String index) throws Exception { - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); assertAcked(prepareCreate("test").setSettings(indexSettings) .addMapping("type1", jsonBuilder().startObject().startObject("type1") .startObject("_type").field("index", index).endObject() @@ -283,7 +282,7 @@ public class CountQueryTests extends ElasticsearchIntegrationTest { } private void idsQueryTests(String index) throws Exception { - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); assertAcked(prepareCreate("test").setSettings(indexSettings) .addMapping("type1", jsonBuilder().startObject().startObject("type1") .startObject("_id").field("index", index).endObject() diff --git a/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsTests.java b/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsTests.java index b0e5aa8cec8..6792298bab2 100644 --- a/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsTests.java +++ b/src/test/java/org/elasticsearch/discovery/DiscoveryWithServiceDisruptionsTests.java @@ -38,7 +38,6 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Priority; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.discovery.zen.ZenDiscovery; @@ -139,7 +138,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati return nodes; } - final static Settings DEFAULT_SETTINGS = ImmutableSettings.builder() + final static Settings DEFAULT_SETTINGS = Settings.builder() .put(FaultDetection.SETTING_PING_TIMEOUT, "1s") // for hitting simulated network failures quickly .put(FaultDetection.SETTING_PING_RETRIES, "1") // for hitting simulated network failures quickly .put("discovery.zen.join_timeout", "10s") // still long to induce failures but to long so test won't time out @@ -163,7 +162,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati minimumMasterNode = numberOfNodes / 2 + 1; } // TODO: Rarely use default settings form some of these - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put(DEFAULT_SETTINGS) .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, minimumMasterNode) .build(); @@ -178,7 +177,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati minimumMasterNode = numberOfNodes / 2 + 1; } // TODO: Rarely use default settings form some of these - Settings nodeSettings = ImmutableSettings.builder() + Settings nodeSettings = Settings.builder() .put(DEFAULT_SETTINGS) .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, minimumMasterNode) .build(); @@ -271,7 +270,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati startCluster(3); // Makes sure that the get request can be executed on each node locally: - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 2) )); @@ -323,7 +322,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati logger.info("Verify no master block with {} set to {}", DiscoverySettings.NO_MASTER_BLOCK, "all"); client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put(DiscoverySettings.NO_MASTER_BLOCK, "all")) + .setTransientSettings(Settings.builder().put(DiscoverySettings.NO_MASTER_BLOCK, "all")) .get(); networkPartition.startDisrupting(); @@ -351,7 +350,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati final List nodes = startCluster(3); assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1 + randomInt(2)) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomInt(2)) )); @@ -421,7 +420,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati final List nodes = startCluster(3); assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1 + randomInt(2)) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomInt(2)) )); @@ -712,7 +711,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati List nodes = startCluster(3); assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 2) ) @@ -890,7 +889,7 @@ public class DiscoveryWithServiceDisruptionsTests extends ElasticsearchIntegrati // don't wait for initial state, wat want to add the disruption while the cluster is forming.. internalCluster().startNodesAsync(3, - ImmutableSettings.builder() + Settings.builder() .put(DiscoveryService.SETTING_INITIAL_STATE_TIMEOUT, "1ms") .put(DiscoverySettings.PUBLISH_TIMEOUT, "3s") .build()).get(); diff --git a/src/test/java/org/elasticsearch/discovery/ZenFaultDetectionTests.java b/src/test/java/org/elasticsearch/discovery/ZenFaultDetectionTests.java index e7e76622116..ae240b68477 100644 --- a/src/test/java/org/elasticsearch/discovery/ZenFaultDetectionTests.java +++ b/src/test/java/org/elasticsearch/discovery/ZenFaultDetectionTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.zen.fd.FaultDetection; import org.elasticsearch.discovery.zen.fd.MasterFaultDetection; @@ -64,9 +63,9 @@ public class ZenFaultDetectionTests extends ElasticsearchTestCase { public void setUp() throws Exception { super.setUp(); threadPool = new ThreadPool(getClass().getName()); - serviceA = build(ImmutableSettings.builder().put("name", "TS_A").build(), version0); + serviceA = build(Settings.builder().put("name", "TS_A").build(), version0); nodeA = new DiscoveryNode("TS_A", "TS_A", serviceA.boundAddress().publishAddress(), ImmutableMap.of(), version0); - serviceB = build(ImmutableSettings.builder().put("name", "TS_B").build(), version1); + serviceB = build(Settings.builder().put("name", "TS_B").build(), version1); nodeB = new DiscoveryNode("TS_B", "TS_B", serviceB.boundAddress().publishAddress(), ImmutableMap.of(), version1); // wait till all nodes are properly connected and the event has been sent, so tests in this class @@ -106,7 +105,7 @@ public class ZenFaultDetectionTests extends ElasticsearchTestCase { } protected MockTransportService build(Settings settings, Version version) { - MockTransportService transportService = new MockTransportService(ImmutableSettings.EMPTY, new LocalTransport(settings, threadPool, version), threadPool); + MockTransportService transportService = new MockTransportService(Settings.EMPTY, new LocalTransport(settings, threadPool, version), threadPool); transportService.start(); return transportService; } @@ -131,7 +130,7 @@ public class ZenFaultDetectionTests extends ElasticsearchTestCase { @Test public void testNodesFaultDetectionConnectOnDisconnect() throws InterruptedException { - ImmutableSettings.Builder settings = ImmutableSettings.builder(); + Settings.Builder settings = Settings.builder(); boolean shouldRetry = randomBoolean(); // make sure we don't ping again after the initial ping settings.put(FaultDetection.SETTING_CONNECT_ON_NETWORK_DISCONNECT, shouldRetry) @@ -181,7 +180,7 @@ public class ZenFaultDetectionTests extends ElasticsearchTestCase { @Test public void testMasterFaultDetectionConnectOnDisconnect() throws InterruptedException { - ImmutableSettings.Builder settings = ImmutableSettings.builder(); + Settings.Builder settings = Settings.builder(); boolean shouldRetry = randomBoolean(); // make sure we don't ping settings.put(FaultDetection.SETTING_CONNECT_ON_NETWORK_DISCONNECT, shouldRetry) diff --git a/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryTests.java b/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryTests.java index f1e7a249c59..dc925078567 100644 --- a/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryTests.java +++ b/src/test/java/org/elasticsearch/discovery/ZenUnicastDiscoveryTests.java @@ -22,13 +22,11 @@ package org.elasticsearch.discovery; import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import org.elasticsearch.test.discovery.ClusterDiscoveryConfiguration; -import org.elasticsearch.test.junit.annotations.TestLogging; import org.junit.Before; import org.junit.Test; @@ -84,7 +82,7 @@ public class ZenUnicastDiscoveryTests extends ElasticsearchIntegrationTest { int currentNumNodes = randomIntBetween(3, 5); final int min_master_nodes = currentNumNodes / 2 + 1; int currentNumOfUnicastHosts = randomIntBetween(min_master_nodes, currentNumNodes); - final Settings settings = ImmutableSettings.settingsBuilder().put("discovery.zen.minimum_master_nodes", min_master_nodes).build(); + final Settings settings = Settings.settingsBuilder().put("discovery.zen.minimum_master_nodes", min_master_nodes).build(); discoveryConfig = new ClusterDiscoveryConfiguration.UnicastZen(currentNumNodes, currentNumOfUnicastHosts, settings); List nodes = internalCluster().startNodesAsync(currentNumNodes).get(); diff --git a/src/test/java/org/elasticsearch/discovery/zen/ElectMasterServiceTest.java b/src/test/java/org/elasticsearch/discovery/zen/ElectMasterServiceTest.java index df8f67c536f..a4ac5ff023d 100644 --- a/src/test/java/org/elasticsearch/discovery/zen/ElectMasterServiceTest.java +++ b/src/test/java/org/elasticsearch/discovery/zen/ElectMasterServiceTest.java @@ -21,7 +21,7 @@ package org.elasticsearch.discovery.zen; import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.discovery.zen.elect.ElectMasterService; import org.elasticsearch.test.ElasticsearchTestCase; @@ -32,7 +32,7 @@ import java.util.*; public class ElectMasterServiceTest extends ElasticsearchTestCase { ElectMasterService electMasterService() { - return new ElectMasterService(ImmutableSettings.EMPTY); + return new ElectMasterService(Settings.EMPTY); } List generateRandomNodes() { diff --git a/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryTests.java b/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryTests.java index 228faa8cf4d..565c964bf52 100644 --- a/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryTests.java +++ b/src/test/java/org/elasticsearch/discovery/zen/ZenDiscoveryTests.java @@ -32,7 +32,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Priority; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.LocalTransportAddress; import org.elasticsearch.discovery.Discovery; @@ -62,7 +61,7 @@ public class ZenDiscoveryTests extends ElasticsearchIntegrationTest { @Test public void testChangeRejoinOnMasterOptionIsDynamic() throws Exception { - Settings nodeSettings = ImmutableSettings.settingsBuilder() + Settings nodeSettings = Settings.settingsBuilder() .put("discovery.type", "zen") // <-- To override the local setting if set externally .build(); String nodeName = internalCluster().startNode(nodeSettings); @@ -70,7 +69,7 @@ public class ZenDiscoveryTests extends ElasticsearchIntegrationTest { assertThat(zenDiscovery.isRejoinOnMasterGone(), is(true)); client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put(ZenDiscovery.SETTING_REJOIN_ON_MASTER_GONE, false)) + .setTransientSettings(Settings.builder().put(ZenDiscovery.SETTING_REJOIN_ON_MASTER_GONE, false)) .get(); assertThat(zenDiscovery.isRejoinOnMasterGone(), is(false)); @@ -78,18 +77,18 @@ public class ZenDiscoveryTests extends ElasticsearchIntegrationTest { @Test public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Exception { - Settings defaultSettings = ImmutableSettings.builder() + Settings defaultSettings = Settings.builder() .put(FaultDetection.SETTING_PING_TIMEOUT, "1s") .put(FaultDetection.SETTING_PING_RETRIES, "1") .put("discovery.type", "zen") .build(); - Settings masterNodeSettings = ImmutableSettings.builder() + Settings masterNodeSettings = Settings.builder() .put("node.data", false) .put(defaultSettings) .build(); internalCluster().startNodesAsync(2, masterNodeSettings).get(); - Settings dateNodeSettings = ImmutableSettings.builder() + Settings dateNodeSettings = Settings.builder() .put("node.master", false) .put(defaultSettings) .build(); @@ -126,18 +125,18 @@ public class ZenDiscoveryTests extends ElasticsearchIntegrationTest { @Test @TestLogging(value = "action.admin.cluster.health:TRACE") public void testNodeFailuresAreProcessedOnce() throws ExecutionException, InterruptedException, IOException { - Settings defaultSettings = ImmutableSettings.builder() + Settings defaultSettings = Settings.builder() .put(FaultDetection.SETTING_PING_TIMEOUT, "1s") .put(FaultDetection.SETTING_PING_RETRIES, "1") .put("discovery.type", "zen") .build(); - Settings masterNodeSettings = ImmutableSettings.builder() + Settings masterNodeSettings = Settings.builder() .put("node.data", false) .put(defaultSettings) .build(); String master = internalCluster().startNode(masterNodeSettings); - Settings dateNodeSettings = ImmutableSettings.builder() + Settings dateNodeSettings = Settings.builder() .put("node.master", false) .put(defaultSettings) .build(); @@ -170,7 +169,7 @@ public class ZenDiscoveryTests extends ElasticsearchIntegrationTest { @Test public void testNodeRejectsClusterStateWithWrongMasterNode() throws Exception { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("discovery.type", "zen") .build(); List nodeNames = internalCluster().startNodesAsync(2, settings).get(); diff --git a/src/test/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPingTests.java b/src/test/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPingTests.java index ecebc9a00df..761f900829a 100644 --- a/src/test/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPingTests.java +++ b/src/test/java/org/elasticsearch/discovery/zen/ping/multicast/MulticastZenPingTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -50,7 +49,7 @@ import static org.hamcrest.Matchers.equalTo; public class MulticastZenPingTests extends ElasticsearchTestCase { private Settings buildRandomMulticast(Settings settings) { - ImmutableSettings.Builder builder = ImmutableSettings.builder().put(settings); + Settings.Builder builder = Settings.builder().put(settings); builder.put("discovery.zen.ping.multicast.group", "224.2.3." + randomIntBetween(0, 255)); builder.put("discovery.zen.ping.multicast.port", randomIntBetween(55000, 56000)); if (randomBoolean()) { @@ -61,7 +60,7 @@ public class MulticastZenPingTests extends ElasticsearchTestCase { @Test public void testSimplePings() throws InterruptedException { - Settings settings = ImmutableSettings.EMPTY; + Settings settings = Settings.EMPTY; settings = buildRandomMulticast(settings); ThreadPool threadPool = new ThreadPool("testSimplePings"); @@ -134,7 +133,7 @@ public class MulticastZenPingTests extends ElasticsearchTestCase { @Test public void testExternalPing() throws Exception { - Settings settings = ImmutableSettings.EMPTY; + Settings settings = Settings.EMPTY; settings = buildRandomMulticast(settings); final ThreadPool threadPool = new ThreadPool("testExternalPing"); diff --git a/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingTests.java b/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingTests.java index 25a8eccd0cf..8c77529dee9 100644 --- a/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingTests.java +++ b/src/test/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPingTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.network.NetworkService; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.unit.TimeValue; @@ -50,10 +49,10 @@ public class UnicastZenPingTests extends ElasticsearchTestCase { @Test public void testSimplePings() throws InterruptedException { - Settings settings = ImmutableSettings.EMPTY; + Settings settings = Settings.EMPTY; int startPort = 11000 + randomIntBetween(0, 1000); int endPort = startPort + 10; - settings = ImmutableSettings.builder().put(settings).put("transport.tcp.port", startPort + "-" + endPort).build(); + settings = Settings.builder().put(settings).put("transport.tcp.port", startPort + "-" + endPort).build(); ThreadPool threadPool = new ThreadPool(getClass().getName()); ClusterName clusterName = new ClusterName("test"); @@ -72,7 +71,7 @@ public class UnicastZenPingTests extends ElasticsearchTestCase { InetSocketTransportAddress addressB = (InetSocketTransportAddress) transportB.boundAddress().publishAddress(); - Settings hostsSettings = ImmutableSettings.settingsBuilder().putArray("discovery.zen.ping.unicast.hosts", + Settings hostsSettings = Settings.settingsBuilder().putArray("discovery.zen.ping.unicast.hosts", addressA.address().getAddress().getHostAddress() + ":" + addressA.address().getPort(), addressB.address().getAddress().getHostAddress() + ":" + addressB.address().getPort()) .build(); diff --git a/src/test/java/org/elasticsearch/document/BulkTests.java b/src/test/java/org/elasticsearch/document/BulkTests.java index 2a8e3609302..9246bc0c069 100644 --- a/src/test/java/org/elasticsearch/document/BulkTests.java +++ b/src/test/java/org/elasticsearch/document/BulkTests.java @@ -38,7 +38,7 @@ import org.elasticsearch.action.update.UpdateRequestBuilder; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.VersionType; import org.elasticsearch.index.query.QueryBuilders; @@ -386,7 +386,7 @@ public class BulkTests extends ElasticsearchIntegrationTest { internalCluster().ensureAtLeastNumDataNodes(1 + replica); assertAcked(prepareCreate("test").setSettings( - ImmutableSettings.builder() + Settings.builder() .put(indexSettings()) .put("index.number_of_replicas", replica) )); diff --git a/src/test/java/org/elasticsearch/document/ShardInfoTests.java b/src/test/java/org/elasticsearch/document/ShardInfoTests.java index 7bd950ca3c0..3c587b9be08 100644 --- a/src/test/java/org/elasticsearch/document/ShardInfoTests.java +++ b/src/test/java/org/elasticsearch/document/ShardInfoTests.java @@ -30,8 +30,7 @@ import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -111,7 +110,7 @@ public class ShardInfoTests extends ElasticsearchIntegrationTest { logger.info("Number of copies: {}", numCopies); assertAcked(prepareCreate("idx").setSettings( - ImmutableSettings.builder() + Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numberOfPrimaryShards) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, numCopies - 1)) .addMapping("type", "_routing", "required=" + routingRequired) diff --git a/src/test/java/org/elasticsearch/env/EnvironmentTests.java b/src/test/java/org/elasticsearch/env/EnvironmentTests.java index 0d02bba4cd5..68a4bbdcbea 100644 --- a/src/test/java/org/elasticsearch/env/EnvironmentTests.java +++ b/src/test/java/org/elasticsearch/env/EnvironmentTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.env; import com.google.common.base.Charsets; import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.io.Streams; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -30,7 +29,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.net.URL; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; @@ -40,11 +39,11 @@ import static org.hamcrest.CoreMatchers.nullValue; public class EnvironmentTests extends ElasticsearchTestCase { public Environment newEnvironment() throws IOException { - return newEnvironment(ImmutableSettings.EMPTY); + return newEnvironment(Settings.EMPTY); } public Environment newEnvironment(Settings settings) throws IOException { - Settings build = ImmutableSettings.builder() + Settings build = Settings.builder() .put(settings) .put("path.home", createTempDir().toAbsolutePath()) .putArray("path.data", tmpPaths()).build(); diff --git a/src/test/java/org/elasticsearch/env/NodeEnvironmentTests.java b/src/test/java/org/elasticsearch/env/NodeEnvironmentTests.java index f84457dab3b..1651966ea28 100644 --- a/src/test/java/org/elasticsearch/env/NodeEnvironmentTests.java +++ b/src/test/java/org/elasticsearch/env/NodeEnvironmentTests.java @@ -23,7 +23,6 @@ import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.index.Index; @@ -41,17 +40,17 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.equalTo; @LuceneTestCase.SuppressFileSystems("ExtrasFS") // TODO: fix test to allow extras public class NodeEnvironmentTests extends ElasticsearchTestCase { - private final Settings idxSettings = ImmutableSettings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).build(); + private final Settings idxSettings = Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).build(); @Test public void testNodeLockSingleEnvironment() throws IOException { - NodeEnvironment env = newNodeEnvironment(ImmutableSettings.builder() + NodeEnvironment env = newNodeEnvironment(Settings.builder() .put("node.max_local_storage_nodes", 1).build()); Settings settings = env.getSettings(); String[] dataPaths = env.getSettings().getAsArray("path.data"); @@ -301,10 +300,10 @@ public class NodeEnvironmentTests extends ElasticsearchTestCase { @Test public void testCustomDataPaths() throws Exception { String[] dataPaths = tmpPaths(); - NodeEnvironment env = newNodeEnvironment(dataPaths, ImmutableSettings.EMPTY); + NodeEnvironment env = newNodeEnvironment(dataPaths, Settings.EMPTY); - Settings s1 = ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).build(); - Settings s2 = ImmutableSettings.builder().put(IndexMetaData.SETTING_DATA_PATH, "/tmp/foo").build(); + Settings s1 = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).build(); + Settings s2 = Settings.builder().put(IndexMetaData.SETTING_DATA_PATH, "/tmp/foo").build(); ShardId sid = new ShardId("myindex", 0); Index i = new Index("myindex"); @@ -325,7 +324,7 @@ public class NodeEnvironmentTests extends ElasticsearchTestCase { env.close(); NodeEnvironment env2 = newNodeEnvironment(dataPaths, - ImmutableSettings.builder().put(NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH, false).build()); + Settings.builder().put(NodeEnvironment.ADD_NODE_ID_TO_CUSTOM_PATH, false).build()); assertThat(env2.availableShardPaths(sid), equalTo(env2.availableShardPaths(sid))); assertThat(env2.resolveCustomLocation(s2, sid), equalTo(PathUtils.get("/tmp/foo/myindex/0"))); @@ -361,12 +360,12 @@ public class NodeEnvironmentTests extends ElasticsearchTestCase { @Override public NodeEnvironment newNodeEnvironment() throws IOException { - return newNodeEnvironment(ImmutableSettings.EMPTY); + return newNodeEnvironment(Settings.EMPTY); } @Override public NodeEnvironment newNodeEnvironment(Settings settings) throws IOException { - Settings build = ImmutableSettings.builder() + Settings build = Settings.builder() .put(settings) .put("path.home", createTempDir().toAbsolutePath().toString()) .put(NodeEnvironment.SETTING_CUSTOM_DATA_PATH_ENABLED, true) @@ -375,7 +374,7 @@ public class NodeEnvironmentTests extends ElasticsearchTestCase { } public NodeEnvironment newNodeEnvironment(String[] dataPaths, Settings settings) throws IOException { - Settings build = ImmutableSettings.builder() + Settings build = Settings.builder() .put(settings) .put("path.home", createTempDir().toAbsolutePath().toString()) .put(NodeEnvironment.SETTING_CUSTOM_DATA_PATH_ENABLED, true) diff --git a/src/test/java/org/elasticsearch/explain/ExplainActionTests.java b/src/test/java/org/elasticsearch/explain/ExplainActionTests.java index 695e475f6a4..79e9cef86da 100644 --- a/src/test/java/org/elasticsearch/explain/ExplainActionTests.java +++ b/src/test/java/org/elasticsearch/explain/ExplainActionTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.explain.ExplainResponse; import org.elasticsearch.common.io.stream.InputStreamStreamInput; import org.elasticsearch.common.io.stream.OutputStreamStreamOutput; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.joda.time.DateTime; @@ -51,7 +51,7 @@ public class ExplainActionTests extends ElasticsearchIntegrationTest { public void testSimple() throws Exception { assertAcked(prepareCreate("test") .addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); ensureGreen("test"); client().prepareIndex("test", "test", "1").setSource("field", "value1").get(); diff --git a/src/test/java/org/elasticsearch/fieldstats/FieldStatsTests.java b/src/test/java/org/elasticsearch/fieldstats/FieldStatsTests.java index cd5ececc18a..7b6a51982ca 100644 --- a/src/test/java/org/elasticsearch/fieldstats/FieldStatsTests.java +++ b/src/test/java/org/elasticsearch/fieldstats/FieldStatsTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.fieldstats; import org.elasticsearch.action.fieldstats.FieldStats; import org.elasticsearch.action.fieldstats.FieldStatsResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchSingleNodeTest; import java.util.ArrayList; @@ -59,7 +59,7 @@ public class FieldStatsTests extends ElasticsearchSingleNodeTest { } public void testString() { - createIndex("test", ImmutableSettings.EMPTY, "field", "value", "type=string"); + createIndex("test", Settings.EMPTY, "field", "value", "type=string"); for (int value = 0; value <= 10; value++) { client().prepareIndex("test", "test").setSource("field", String.format(Locale.ENGLISH, "%03d", value)).get(); } @@ -75,7 +75,7 @@ public class FieldStatsTests extends ElasticsearchSingleNodeTest { public void testDouble() { String fieldName = "field"; - createIndex("test", ImmutableSettings.EMPTY, fieldName, "value", "type=double"); + createIndex("test", Settings.EMPTY, fieldName, "value", "type=double"); for (double value = -1; value <= 9; value++) { client().prepareIndex("test", "test").setSource(fieldName, value).get(); } @@ -91,7 +91,7 @@ public class FieldStatsTests extends ElasticsearchSingleNodeTest { public void testFloat() { String fieldName = "field"; - createIndex("test", ImmutableSettings.EMPTY, fieldName, "value", "type=float"); + createIndex("test", Settings.EMPTY, fieldName, "value", "type=float"); for (float value = -1; value <= 9; value++) { client().prepareIndex("test", "test").setSource(fieldName, value).get(); } @@ -106,7 +106,7 @@ public class FieldStatsTests extends ElasticsearchSingleNodeTest { } private void testNumberRange(String fieldName, String fieldType, long min, long max) { - createIndex("test", ImmutableSettings.EMPTY, fieldName, "value", "type=" + fieldType); + createIndex("test", Settings.EMPTY, fieldName, "value", "type=" + fieldType); for (long value = min; value <= max; value++) { client().prepareIndex("test", "test").setSource(fieldName, value).get(); } @@ -165,11 +165,11 @@ public class FieldStatsTests extends ElasticsearchSingleNodeTest { } public void testInvalidField() { - createIndex("test1", ImmutableSettings.EMPTY, "field1", "value", "type=string"); + createIndex("test1", Settings.EMPTY, "field1", "value", "type=string"); client().prepareIndex("test1", "test").setSource("field1", "a").get(); client().prepareIndex("test1", "test").setSource("field1", "b").get(); - createIndex("test2", ImmutableSettings.EMPTY, "field2", "value", "type=string"); + createIndex("test2", Settings.EMPTY, "field2", "value", "type=string"); client().prepareIndex("test2", "test").setSource("field2", "a").get(); client().prepareIndex("test2", "test").setSource("field2", "b").get(); client().admin().indices().prepareRefresh().get(); diff --git a/src/test/java/org/elasticsearch/gateway/DanglingIndicesStateTests.java b/src/test/java/org/elasticsearch/gateway/DanglingIndicesStateTests.java index 4dd8726a96f..1983094dcc0 100644 --- a/src/test/java/org/elasticsearch/gateway/DanglingIndicesStateTests.java +++ b/src/test/java/org/elasticsearch/gateway/DanglingIndicesStateTests.java @@ -18,11 +18,9 @@ */ package org.elasticsearch.gateway; -import com.google.common.collect.ImmutableList; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.Index; @@ -41,7 +39,7 @@ import static org.hamcrest.Matchers.hasSize; */ public class DanglingIndicesStateTests extends ElasticsearchTestCase { - private static Settings indexSettings = ImmutableSettings.builder() + private static Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) @@ -50,8 +48,8 @@ public class DanglingIndicesStateTests extends ElasticsearchTestCase { @Test public void testCleanupWhenEmpty() throws Exception { try (NodeEnvironment env = newNodeEnvironment()) { - MetaStateService metaStateService = new MetaStateService(ImmutableSettings.EMPTY, env); - DanglingIndicesState danglingState = new DanglingIndicesState(ImmutableSettings.EMPTY, env, metaStateService, null); + MetaStateService metaStateService = new MetaStateService(Settings.EMPTY, env); + DanglingIndicesState danglingState = new DanglingIndicesState(Settings.EMPTY, env, metaStateService, null); assertTrue(danglingState.getDanglingIndices().isEmpty()); MetaData metaData = MetaData.builder().build(); @@ -63,8 +61,8 @@ public class DanglingIndicesStateTests extends ElasticsearchTestCase { @Test public void testDanglingProcessing() throws Exception { try (NodeEnvironment env = newNodeEnvironment()) { - MetaStateService metaStateService = new MetaStateService(ImmutableSettings.EMPTY, env); - DanglingIndicesState danglingState = new DanglingIndicesState(ImmutableSettings.EMPTY, env, metaStateService, null); + MetaStateService metaStateService = new MetaStateService(Settings.EMPTY, env); + DanglingIndicesState danglingState = new DanglingIndicesState(Settings.EMPTY, env, metaStateService, null); MetaData metaData = MetaData.builder().build(); @@ -107,8 +105,8 @@ public class DanglingIndicesStateTests extends ElasticsearchTestCase { @Test public void testRenameOfIndexState() throws Exception { try (NodeEnvironment env = newNodeEnvironment()) { - MetaStateService metaStateService = new MetaStateService(ImmutableSettings.EMPTY, env); - DanglingIndicesState danglingState = new DanglingIndicesState(ImmutableSettings.EMPTY, env, metaStateService, null); + MetaStateService metaStateService = new MetaStateService(Settings.EMPTY, env); + DanglingIndicesState danglingState = new DanglingIndicesState(Settings.EMPTY, env, metaStateService, null); MetaData metaData = MetaData.builder().build(); diff --git a/src/test/java/org/elasticsearch/gateway/GatewayIndexStateTests.java b/src/test/java/org/elasticsearch/gateway/GatewayIndexStateTests.java index 7039fe130ae..3123edb4c5f 100644 --- a/src/test/java/org/elasticsearch/gateway/GatewayIndexStateTests.java +++ b/src/test/java/org/elasticsearch/gateway/GatewayIndexStateTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.gateway; -import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; @@ -36,11 +35,10 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.indices.IndexClosedException; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; -import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.InternalTestCluster.RestartCallback; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; diff --git a/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java b/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java index 06b958d47aa..ffe4e716b5f 100644 --- a/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java +++ b/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java @@ -35,7 +35,7 @@ import org.junit.Test; import java.util.*; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/gateway/GatewayServiceTests.java b/src/test/java/org/elasticsearch/gateway/GatewayServiceTests.java index 6629c50573c..80348706801 100644 --- a/src/test/java/org/elasticsearch/gateway/GatewayServiceTests.java +++ b/src/test/java/org/elasticsearch/gateway/GatewayServiceTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.gateway; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.cluster.NoopClusterService; @@ -32,8 +32,8 @@ import java.io.IOException; public class GatewayServiceTests extends ElasticsearchTestCase { - private GatewayService createService(ImmutableSettings.Builder settings) { - return new GatewayService(ImmutableSettings.builder() + private GatewayService createService(Settings.Builder settings) { + return new GatewayService(Settings.builder() .put("http.enabled", "false") .put("discovery.type", "local") .put(settings.build()).build(), null, null, new NoopClusterService(), null, null); @@ -44,25 +44,25 @@ public class GatewayServiceTests extends ElasticsearchTestCase { public void testDefaultRecoverAfterTime() throws IOException { // check that the default is not set - GatewayService service = createService(ImmutableSettings.builder()); + GatewayService service = createService(Settings.builder()); assertNull(service.recoverAfterTime()); // ensure default is set when setting expected_nodes - service = createService(ImmutableSettings.builder().put("gateway.expected_nodes", 1)); + service = createService(Settings.builder().put("gateway.expected_nodes", 1)); assertThat(service.recoverAfterTime(), Matchers.equalTo(GatewayService.DEFAULT_RECOVER_AFTER_TIME_IF_EXPECTED_NODES_IS_SET)); // ensure default is set when setting expected_data_nodes - service = createService(ImmutableSettings.builder().put("gateway.expected_data_nodes", 1)); + service = createService(Settings.builder().put("gateway.expected_data_nodes", 1)); assertThat(service.recoverAfterTime(), Matchers.equalTo(GatewayService.DEFAULT_RECOVER_AFTER_TIME_IF_EXPECTED_NODES_IS_SET)); // ensure default is set when setting expected_master_nodes - service = createService(ImmutableSettings.builder().put("gateway.expected_master_nodes", 1)); + service = createService(Settings.builder().put("gateway.expected_master_nodes", 1)); assertThat(service.recoverAfterTime(), Matchers.equalTo(GatewayService.DEFAULT_RECOVER_AFTER_TIME_IF_EXPECTED_NODES_IS_SET)); // ensure settings override default TimeValue timeValue = TimeValue.timeValueHours(3); // ensure default is set when setting expected_nodes - service = createService(ImmutableSettings.builder().put("gateway.expected_nodes", 1).put("gateway.recover_after_time", timeValue.toString())); + service = createService(Settings.builder().put("gateway.expected_nodes", 1).put("gateway.recover_after_time", timeValue.toString())); assertThat(service.recoverAfterTime().millis(), Matchers.equalTo(timeValue.millis())); } } diff --git a/src/test/java/org/elasticsearch/gateway/MetaDataWriteDataNodesTests.java b/src/test/java/org/elasticsearch/gateway/MetaDataWriteDataNodesTests.java index f8ba42d31c5..71143159cc4 100644 --- a/src/test/java/org/elasticsearch/gateway/MetaDataWriteDataNodesTests.java +++ b/src/test/java/org/elasticsearch/gateway/MetaDataWriteDataNodesTests.java @@ -27,7 +27,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.InternalTestCluster; @@ -53,7 +53,7 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { // this test checks that index state is written on data only nodes String masterNodeName = startMasterNode(); String redNode = startDataNode("red"); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.number_of_replicas", 0))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.number_of_replicas", 0))); index("test", "doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); waitForConcreteMappingsOnAll("test", "doc", "text"); ensureGreen("test"); @@ -80,9 +80,9 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { String blueNode = startDataNode("blue"); String redNode = startDataNode("red"); - assertAcked(prepareCreate("blue_index").setSettings(ImmutableSettings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue"))); + assertAcked(prepareCreate("blue_index").setSettings(Settings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue"))); index("blue_index", "doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); - assertAcked(prepareCreate("red_index").setSettings(ImmutableSettings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); + assertAcked(prepareCreate("red_index").setSettings(Settings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); index("red_index", "doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); ensureGreen(); waitForConcreteMappingsOnAll("blue_index", "doc", "text"); @@ -126,9 +126,9 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { // create blue_index on blue_node and same for red client().admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForNodes("3")).get(); - assertAcked(prepareCreate("blue_index").setSettings(ImmutableSettings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue"))); + assertAcked(prepareCreate("blue_index").setSettings(Settings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue"))); index("blue_index", "doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); - assertAcked(prepareCreate("red_index").setSettings(ImmutableSettings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); + assertAcked(prepareCreate("red_index").setSettings(Settings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); index("red_index", "doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); ensureGreen(); @@ -141,8 +141,8 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { // now relocate blue_index to red_node and red_index to blue_node logger.debug("relocating indices..."); - client().admin().indices().prepareUpdateSettings("blue_index").setSettings(ImmutableSettings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red")).get(); - client().admin().indices().prepareUpdateSettings("red_index").setSettings(ImmutableSettings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue")).get(); + client().admin().indices().prepareUpdateSettings("blue_index").setSettings(Settings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red")).get(); + client().admin().indices().prepareUpdateSettings("red_index").setSettings(Settings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue")).get(); client().admin().cluster().prepareHealth().setWaitForRelocatingShards(0).get(); ensureGreen(); assertIndexNotInMetaState(redNode, "red_index"); @@ -180,7 +180,7 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { String blueNode = startDataNode("blue"); // create red_index on red_node and same for red client().admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForNodes("3")).get(); - assertAcked(prepareCreate("red_index").setSettings(ImmutableSettings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); + assertAcked(prepareCreate("red_index").setSettings(Settings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); index("red_index", "doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); ensureGreen(); @@ -243,7 +243,7 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { String redNode = startDataNode("red", redNodeDataPath); // create red_index on red_node and same for red client().admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForNodes("2")).get(); - assertAcked(prepareCreate("red_index").setSettings(ImmutableSettings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); + assertAcked(prepareCreate("red_index").setSettings(Settings.builder().put("index.number_of_replicas", 0).put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red"))); index("red_index", "doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); logger.info("--> wait for green red_index"); @@ -292,7 +292,7 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { } private String startDataNode(String color, String newDataPath) { - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder() + Settings.Builder settingsBuilder = Settings.builder() .put("node.data", true) .put("node.master", false) .put("node.color", color) @@ -301,7 +301,7 @@ public class MetaDataWriteDataNodesTests extends ElasticsearchIntegrationTest { } private String startMasterNode() { - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder() + Settings.Builder settingsBuilder = Settings.builder() .put("node.data", false) .put("node.master", true) .put("path.data", createTempDir().toString()); diff --git a/src/test/java/org/elasticsearch/gateway/MetaStateServiceTests.java b/src/test/java/org/elasticsearch/gateway/MetaStateServiceTests.java index 486e6c267cd..7386d6e50be 100644 --- a/src/test/java/org/elasticsearch/gateway/MetaStateServiceTests.java +++ b/src/test/java/org/elasticsearch/gateway/MetaStateServiceTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.gateway; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.env.NodeEnvironment; @@ -35,7 +34,7 @@ import static org.hamcrest.Matchers.nullValue; */ public class MetaStateServiceTests extends ElasticsearchTestCase { - private static Settings indexSettings = ImmutableSettings.builder() + private static Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) @@ -66,7 +65,7 @@ public class MetaStateServiceTests extends ElasticsearchTestCase { MetaStateService metaStateService = new MetaStateService(randomSettings(), env); MetaData metaData = MetaData.builder() - .persistentSettings(ImmutableSettings.builder().put("test1", "value1").build()) + .persistentSettings(Settings.builder().put("test1", "value1").build()) .build(); metaStateService.writeGlobalState("test_write", metaData); assertThat(metaStateService.loadGlobalState().persistentSettings(), equalTo(metaData.persistentSettings())); @@ -79,7 +78,7 @@ public class MetaStateServiceTests extends ElasticsearchTestCase { MetaStateService metaStateService = new MetaStateService(randomSettings(), env); MetaData metaData = MetaData.builder() - .persistentSettings(ImmutableSettings.builder().put("test1", "value1").build()) + .persistentSettings(Settings.builder().put("test1", "value1").build()) .build(); IndexMetaData index = IndexMetaData.builder("test1").settings(indexSettings).build(); MetaData metaDataWithIndex = MetaData.builder(metaData).put(index, true).build(); @@ -97,7 +96,7 @@ public class MetaStateServiceTests extends ElasticsearchTestCase { IndexMetaData index = IndexMetaData.builder("test1").settings(indexSettings).build(); MetaData metaData = MetaData.builder() - .persistentSettings(ImmutableSettings.builder().put("test1", "value1").build()) + .persistentSettings(Settings.builder().put("test1", "value1").build()) .put(index, true) .build(); @@ -112,7 +111,7 @@ public class MetaStateServiceTests extends ElasticsearchTestCase { } private Settings randomSettings() { - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); if (randomBoolean()) { builder.put(MetaStateService.FORMAT_SETTING, randomFrom(XContentType.values()).shortName()); } diff --git a/src/test/java/org/elasticsearch/gateway/QuorumGatewayTests.java b/src/test/java/org/elasticsearch/gateway/QuorumGatewayTests.java index 60cc5fa7e9d..0f5a5816c7e 100644 --- a/src/test/java/org/elasticsearch/gateway/QuorumGatewayTests.java +++ b/src/test/java/org/elasticsearch/gateway/QuorumGatewayTests.java @@ -20,12 +20,10 @@ package org.elasticsearch.gateway; import com.google.common.base.Predicate; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; @@ -35,7 +33,7 @@ import org.junit.Test; import java.util.concurrent.TimeUnit; import static org.elasticsearch.client.Requests.clusterHealthRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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.ElasticsearchIntegrationTest.*; @@ -81,7 +79,7 @@ public class QuorumGatewayTests extends ElasticsearchIntegrationTest { internalCluster().fullRestart(new RestartCallback() { @Override public Settings onNodeStopped(String nodeName) throws Exception { - return ImmutableSettings.EMPTY; + return Settings.EMPTY; } @Override diff --git a/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesTests.java b/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesTests.java index 6e7e986eb93..35bc9fb3e03 100644 --- a/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesTests.java +++ b/src/test/java/org/elasticsearch/gateway/RecoverAfterNodesTests.java @@ -27,12 +27,11 @@ import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; diff --git a/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityTests.java b/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityTests.java index 9da95ddfd70..7eeff09a944 100644 --- a/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityTests.java +++ b/src/test/java/org/elasticsearch/gateway/RecoveryBackwardsCompatibilityTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentHelper; @@ -47,7 +46,7 @@ public class RecoveryBackwardsCompatibilityTests extends ElasticsearchBackwardsC @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("action.admin.cluster.node.shutdown.delay", "10ms") .put("gateway.recover_after_nodes", 2).build(); @@ -67,7 +66,7 @@ public class RecoveryBackwardsCompatibilityTests extends ElasticsearchBackwardsC @Test @LuceneTestCase.Slow public void testReusePeerRecovery() throws Exception { - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put(indexSettings()) + assertAcked(prepareCreate("test").setSettings(Settings.builder().put(indexSettings()) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE))); logger.info("--> indexing docs"); @@ -81,7 +80,7 @@ public class RecoveryBackwardsCompatibilityTests extends ElasticsearchBackwardsC logger.info("--> bump number of replicas from 0 to 1"); client().admin().indices().prepareFlush().execute().actionGet(); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1").build()).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1").build()).get(); ensureGreen(); assertAllShardsOnNodes("test", backwardsCluster().backwardsNodePattern()); @@ -91,9 +90,9 @@ public class RecoveryBackwardsCompatibilityTests extends ElasticsearchBackwardsC CountResponse countResponse = client().prepareCount().get(); assertHitCount(countResponse, numDocs); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableSettings.settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, "none")).execute().actionGet(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, "none")).execute().actionGet(); backwardsCluster().upgradeAllNodes(); - client().admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableSettings.settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, "all")).execute().actionGet(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.settingsBuilder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, "all")).execute().actionGet(); ensureGreen(); countResponse = client().prepareCount().get(); diff --git a/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java b/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java index 93ead8ac862..75adcc27c1e 100644 --- a/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java +++ b/src/test/java/org/elasticsearch/gateway/RecoveryFromGatewayTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.engine.Engine; @@ -46,7 +45,7 @@ import org.junit.Test; 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.ImmutableSettings.settingsBuilder; +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; @@ -363,7 +362,7 @@ public class RecoveryFromGatewayTests extends ElasticsearchIntegrationTest { // prevent any rebalance actions during the peer recovery // if we run into a relocation the reuse count will be 0 and this fails the test. We are testing here if // we reuse the files on disk after full restarts for replicas. - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(indexSettings()) .put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE))); ensureGreen(); diff --git a/src/test/java/org/elasticsearch/get/GetActionTests.java b/src/test/java/org/elasticsearch/get/GetActionTests.java index 6262fc6956f..d73e91d849f 100644 --- a/src/test/java/org/elasticsearch/get/GetActionTests.java +++ b/src/test/java/org/elasticsearch/get/GetActionTests.java @@ -33,7 +33,7 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.lucene.uid.Versions; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.engine.VersionConflictEngineException; @@ -53,7 +53,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @Test public void simpleGetTests() { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1)) .addAlias(new Alias("alias"))); ensureGreen(); @@ -178,7 +178,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @Test public void simpleMultiGetTests() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); ensureGreen(); MultiGetResponse response = client().prepareMultiGet().add(indexOrAlias(), "type1", "1").get(); @@ -231,7 +231,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @Test public void realtimeGetWithCompressBackcompat() throws Exception { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1).put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id)) + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1).put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id)) .addMapping("type", jsonBuilder().startObject().startObject("type").startObject("_source").field("compress", true).endObject().endObject().endObject())); ensureGreen(); @@ -250,7 +250,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @Test public void getFieldsWithDifferentTypes() throws Exception { - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) + assertAcked(prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1)) .addMapping("type1", jsonBuilder().startObject().startObject("type1").endObject().endObject()) .addMapping("type2", jsonBuilder().startObject().startObject("type2") .startObject("properties") @@ -344,7 +344,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { assertAcked(prepareCreate("test") .addMapping("type1", mapping1) .addMapping("type2", mapping2) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); ensureGreen(); GetResponse response = client().prepareGet("test", "type1", "1").get(); @@ -524,7 +524,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @Test public void testGetWithVersion() { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); ensureGreen(); GetResponse response = client().prepareGet("test", "type1", "1").get(); @@ -624,7 +624,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @Test public void testMultiGetWithVersion() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); ensureGreen(); MultiGetResponse response = client().prepareMultiGet().add(indexOrAlias(), "type1", "1").get(); @@ -737,7 +737,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @Test public void testGetFields_metaData() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); client().prepareIndex("test", "my-type1", "1") .setRouting("1") @@ -775,7 +775,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { .startObject("field2").field("type", "string").endObject() .endObject().endObject() .endObject().endObject().endObject()) - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))); + .setSettings(Settings.settingsBuilder().put("index.refresh_interval", -1))); client().prepareIndex("test", "my-type1", "1") .setSource(jsonBuilder().startObject().startObject("field1").field("field2", "value1").endObject().endObject()) @@ -802,7 +802,7 @@ public class GetActionTests extends ElasticsearchIntegrationTest { @TestLogging("index.shard.service:TRACE,cluster.service:TRACE,action.admin.indices.flush:TRACE") public void testGetFields_complexField() throws Exception { assertAcked(prepareCreate("my-index") - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) + .setSettings(Settings.settingsBuilder().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/src/test/java/org/elasticsearch/http/netty/HttpPublishPortTests.java b/src/test/java/org/elasticsearch/http/netty/HttpPublishPortTests.java index b691bef64ca..d2466ac6499 100644 --- a/src/test/java/org/elasticsearch/http/netty/HttpPublishPortTests.java +++ b/src/test/java/org/elasticsearch/http/netty/HttpPublishPortTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.http.netty; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress; @@ -38,7 +37,7 @@ public class HttpPublishPortTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(Node.HTTP_ENABLED, true) .put("http.publish_port", 9080) diff --git a/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTest.java b/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTest.java index 78d03746b93..53666c0d2cf 100644 --- a/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTest.java +++ b/src/test/java/org/elasticsearch/http/netty/NettyHttpServerPipeliningTest.java @@ -21,9 +21,7 @@ package org.elasticsearch.http.netty; import com.google.common.base.Charsets; import com.google.common.collect.Lists; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.network.NetworkService; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.http.HttpServerTransport; @@ -33,7 +31,6 @@ import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.cache.recycler.MockBigArrays; import org.elasticsearch.test.cache.recycler.MockPageCacheRecycler; -import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.threadpool.ThreadPool; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; @@ -49,15 +46,12 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.http.netty.NettyHttpClient.returnHttpResponseBodies; import static org.elasticsearch.http.netty.NettyHttpServerTransport.HttpChannelPipelineFactory; import static org.hamcrest.Matchers.*; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONNECTION; import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH; -import static org.jboss.netty.handler.codec.http.HttpHeaders.Values.CLOSE; import static org.jboss.netty.handler.codec.http.HttpResponseStatus.OK; -import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_0; import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1; /** @@ -73,9 +67,9 @@ public class NettyHttpServerPipeliningTest extends ElasticsearchTestCase { @Before public void setup() throws Exception { - networkService = new NetworkService(ImmutableSettings.EMPTY); + networkService = new NetworkService(Settings.EMPTY); threadPool = new ThreadPool("test"); - mockPageCacheRecycler = new MockPageCacheRecycler(ImmutableSettings.EMPTY, threadPool); + mockPageCacheRecycler = new MockPageCacheRecycler(Settings.EMPTY, threadPool); bigArrays = new MockBigArrays(mockPageCacheRecycler, new NoneCircuitBreakerService()); } diff --git a/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIntegrationTest.java b/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIntegrationTest.java index c622fe31718..0d8ba526665 100644 --- a/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIntegrationTest.java +++ b/src/test/java/org/elasticsearch/http/netty/NettyPipeliningDisabledIntegrationTest.java @@ -32,7 +32,7 @@ import java.util.Collection; import java.util.List; import java.util.Locale; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.http.netty.NettyHttpClient.returnOpaqueIds; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; diff --git a/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIntegrationTest.java b/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIntegrationTest.java index 213c79083d9..b3f84799366 100644 --- a/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIntegrationTest.java +++ b/src/test/java/org/elasticsearch/http/netty/NettyPipeliningEnabledIntegrationTest.java @@ -31,7 +31,7 @@ import java.util.Collection; import java.util.List; import java.util.Locale; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.http.netty.NettyHttpClient.returnOpaqueIds; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; diff --git a/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java b/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java index e79529527f9..73ea27ae84a 100644 --- a/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java +++ b/src/test/java/org/elasticsearch/index/IndexWithShadowReplicasTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingNodes; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.index.shard.IndexShard; @@ -68,7 +67,7 @@ import static org.hamcrest.Matchers.*; public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { private Settings nodeSettings() { - return ImmutableSettings.builder() + return Settings.builder() .put("node.add_id_to_custom_path", false) .put("node.enable_custom_paths", true) .put("index.store.fs.fs_lock", randomFrom("native", "simple")) @@ -84,7 +83,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { internalCluster().startNodesAsync(3, nodeSettings).get(); final Path dataPath = createTempDir(); - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).build(); assertAcked(prepareCreate("foo").setSettings(idxSettings)); @@ -96,14 +95,14 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { assertNoFailures(client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).execute().actionGet()); assertAcked(client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()))); CreateSnapshotResponse createSnapshotResponse = client().admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("foo").get(); assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0)); assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards())); assertThat(client().admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS)); - Settings shadowSettings = ImmutableSettings.builder() + Settings shadowSettings = Settings.builder() .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) .put(IndexMetaData.SETTING_SHADOW_REPLICAS, true) .put(IndexMetaData.SETTING_SHARED_FILESYSTEM, true) @@ -142,7 +141,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { final String IDX = "test"; final Path dataPath = createTempDir(); - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 2) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -205,7 +204,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); String IDX = "test"; - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -264,7 +263,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); String IDX = "test"; - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -292,7 +291,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { // now prevent primary from being allocated on node 1 move to node_3 String node3 = internalCluster().startNode(nodeSettings); - Settings build = ImmutableSettings.builder().put("index.routing.allocation.exclude._name", node1).build(); + Settings build = Settings.builder().put("index.routing.allocation.exclude._name", node1).build(); client().admin().indices().prepareUpdateSettings(IDX).setSettings(build).execute().actionGet(); ensureGreen(IDX); @@ -325,7 +324,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); final String IDX = "test"; - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -370,7 +369,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { phase1finished.await(); // wait for a certain number of documents to be indexed logger.info("--> excluding {} from allocation", node1); // now prevent primary from being allocated on node 1 move to node_3 - Settings build = ImmutableSettings.builder().put("index.routing.allocation.exclude._name", node1).build(); + Settings build = Settings.builder().put("index.routing.allocation.exclude._name", node1).build(); client().admin().indices().prepareUpdateSettings(IDX).setSettings(build).execute().actionGet(); // wait for more documents to be indexed post-recovery, also waits for // indexing thread to stop @@ -387,7 +386,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { @Test public void testPrimaryRelocationWhereRecoveryFails() throws Exception { - Settings nodeSettings = ImmutableSettings.builder() + Settings nodeSettings = Settings.builder() .put("node.add_id_to_custom_path", false) .put("node.enable_custom_paths", true) .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()) @@ -397,7 +396,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); final String IDX = "test"; - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -464,7 +463,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { phase1finished.await(); // wait for a certain number of documents to be indexed logger.info("--> excluding {} from allocation", node1); // now prevent primary from being allocated on node 1 move to node_3 - Settings build = ImmutableSettings.builder().put("index.routing.allocation.exclude._name", node1).build(); + Settings build = Settings.builder().put("index.routing.allocation.exclude._name", node1).build(); client().admin().indices().prepareUpdateSettings(IDX).setSettings(build).execute().actionGet(); // wait for more documents to be indexed post-recovery, also waits for // indexing thread to stop @@ -491,7 +490,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); String IDX = "test"; - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(1, nodeCount - 1)) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -532,7 +531,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); String IDX = "test"; - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 5) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -586,7 +585,7 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); String IDX = "test"; - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 2) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) @@ -650,8 +649,8 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { @Test public void testIndexOnSharedFSRecoversToAnyNode() throws Exception { Settings nodeSettings = nodeSettings(); - Settings fooSettings = ImmutableSettings.builder().put(nodeSettings).put("node.affinity", "foo").build(); - Settings barSettings = ImmutableSettings.builder().put(nodeSettings).put("node.affinity", "bar").build(); + Settings fooSettings = Settings.builder().put(nodeSettings).put("node.affinity", "foo").build(); + Settings barSettings = Settings.builder().put(nodeSettings).put("node.affinity", "bar").build(); final Future> fooNodes = internalCluster().startNodesAsync(2, fooSettings); final Future> barNodes = internalCluster().startNodesAsync(2, barSettings); @@ -660,14 +659,14 @@ public class IndexWithShadowReplicasTests extends ElasticsearchIntegrationTest { Path dataPath = createTempDir(); String IDX = "test"; - Settings includeFoo = ImmutableSettings.builder() + Settings includeFoo = Settings.builder() .put("index.routing.allocation.include.affinity", "foo") .build(); - Settings includeBar = ImmutableSettings.builder() + Settings includeBar = Settings.builder() .put("index.routing.allocation.include.affinity", "bar") .build(); - Settings idxSettings = ImmutableSettings.builder() + Settings idxSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 5) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexMetaData.SETTING_DATA_PATH, dataPath.toAbsolutePath().toString()) diff --git a/src/test/java/org/elasticsearch/index/TransportIndexFailuresTest.java b/src/test/java/org/elasticsearch/index/TransportIndexFailuresTest.java index e0fcd335b62..e70ddfded40 100644 --- a/src/test/java/org/elasticsearch/index/TransportIndexFailuresTest.java +++ b/src/test/java/org/elasticsearch/index/TransportIndexFailuresTest.java @@ -29,13 +29,11 @@ import org.elasticsearch.cluster.routing.IndexShardRoutingTable; import org.elasticsearch.cluster.routing.MutableShardRouting; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.discovery.zen.fd.FaultDetection; import org.elasticsearch.test.ElasticsearchIntegrationTest; -import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.transport.TransportModule; import org.elasticsearch.transport.TransportService; @@ -52,7 +50,7 @@ import static org.hamcrest.Matchers.equalTo; @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0, transportClientRatio = 0) public class TransportIndexFailuresTest extends ElasticsearchIntegrationTest { - private static final Settings nodeSettings = ImmutableSettings.settingsBuilder() + private static final Settings nodeSettings = Settings.settingsBuilder() .put("discovery.type", "zen") // <-- To override the local setting if set externally .put(FaultDetection.SETTING_PING_TIMEOUT, "1s") // <-- for hitting simulated network failures quickly .put(FaultDetection.SETTING_PING_RETRIES, "1") // <-- for hitting simulated network failures quickly @@ -82,7 +80,7 @@ public class TransportIndexFailuresTest extends ElasticsearchIntegrationTest { ensureGreen(INDEX); // Disable allocation so the replica cannot be reallocated when it fails - Settings s = ImmutableSettings.builder().put("cluster.routing.allocation.enable", "none").build(); + Settings s = Settings.builder().put("cluster.routing.allocation.enable", "none").build(); client().admin().cluster().prepareUpdateSettings().setTransientSettings(s).get(); // Determine which node holds the primary shard diff --git a/src/test/java/org/elasticsearch/index/aliases/IndexAliasesServiceTests.java b/src/test/java/org/elasticsearch/index/aliases/IndexAliasesServiceTests.java index 307179f9f60..3115edeca26 100644 --- a/src/test/java/org/elasticsearch/index/aliases/IndexAliasesServiceTests.java +++ b/src/test/java/org/elasticsearch/index/aliases/IndexAliasesServiceTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.aliases; import org.elasticsearch.common.compress.CompressedString; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -43,7 +42,7 @@ import static org.hamcrest.Matchers.nullValue; public class IndexAliasesServiceTests extends ElasticsearchSingleNodeTest { public IndexAliasesService newIndexAliasesService() { - Settings settings = ImmutableSettings.builder().put("name", "IndexAliasesServiceTests").build(); + Settings settings = Settings.builder().put("name", "IndexAliasesServiceTests").build(); IndexService indexService = createIndex("test", settings); return indexService.aliasesService(); } diff --git a/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java index 70f12cdd401..1e16122af58 100644 --- a/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/ASCIIFoldingTokenFilterFactoryTests.java @@ -27,7 +27,7 @@ import org.junit.Test; import java.io.IOException; import java.io.StringReader; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class ASCIIFoldingTokenFilterFactoryTests extends ElasticsearchTokenStreamTestCase { @Test diff --git a/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java b/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java index ffe1d1b37dc..a1db68ab039 100644 --- a/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/AnalysisModuleTests.java @@ -31,8 +31,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; -import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; @@ -55,7 +53,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Set; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** @@ -127,7 +125,7 @@ public class AnalysisModuleTests extends ElasticsearchTestCase { } private void assertTokenFilter(String name, Class clazz) throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir().toString()).build(); AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settings); @@ -214,7 +212,7 @@ public class AnalysisModuleTests extends ElasticsearchTestCase { @Test public void testWordListPath() throws Exception { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("path.home", createTempDir().toString()) .build(); Environment env = new Environment(settings); diff --git a/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java b/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java index 5a89cf1d6d4..30050ba6c06 100644 --- a/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/AnalysisTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; public class AnalysisTests extends ElasticsearchTestCase { diff --git a/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java b/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java index ea52f71e94a..6f7581768f3 100644 --- a/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java +++ b/src/test/java/org/elasticsearch/index/analysis/AnalysisTestsHelper.java @@ -23,7 +23,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; @@ -39,7 +38,7 @@ import java.nio.file.Path; public class AnalysisTestsHelper { public static AnalysisService createAnalysisServiceFromClassPath(Path baseDir, String resource) { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .loadFromClasspath(resource) .put("path.home", baseDir.toString()) .build(); @@ -51,7 +50,7 @@ public class AnalysisTestsHelper { Settings settings) { Index index = new Index("test"); if (settings.get(IndexMetaData.SETTING_VERSION_CREATED) == null) { - settings = ImmutableSettings.builder().put(settings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + settings = Settings.builder().put(settings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); } Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings), new EnvironmentModule(new Environment(settings)), new IndicesAnalysisModule()).createInjector(); diff --git a/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java b/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java index 7254268eb40..e633895e9e6 100644 --- a/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/AnalyzerBackwardsCompatTests.java @@ -18,7 +18,7 @@ */ package org.elasticsearch.index.analysis; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Ignore; @@ -36,7 +36,7 @@ public class AnalyzerBackwardsCompatTests extends ElasticsearchTokenStreamTestCa final int iters = scaledRandomIntBetween(10, 100); org.elasticsearch.Version version = org.elasticsearch.Version.CURRENT; for (int i = 0; i < iters; i++) { - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop"); + Settings.Builder builder = Settings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop"); if (version.onOrAfter(noStopwordVersion)) { if (random().nextBoolean()) { builder.put(SETTING_VERSION_CREATED, version); diff --git a/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java b/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java index c592579c801..e2ce99d8335 100644 --- a/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java @@ -22,7 +22,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; @@ -35,7 +34,7 @@ import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** */ diff --git a/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java b/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java index 37b3bfc21a7..3f1edbbdd46 100644 --- a/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/CompoundAnalysisTests.java @@ -46,7 +46,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** diff --git a/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java index 298910c9216..cb8a8975e78 100644 --- a/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/HunspellTokenFilterFactoryTests.java @@ -24,7 +24,7 @@ import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; diff --git a/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java index fb708a40c26..a9a07af9d9e 100644 --- a/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/KeepFilterFactoryTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.FailedToResolveConfigException; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; @@ -47,7 +46,7 @@ public class KeepFilterFactoryTests extends ElasticsearchTokenStreamTestCase { @Test public void testLoadOverConfiguredSettings() { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.home", 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") @@ -63,7 +62,7 @@ public class KeepFilterFactoryTests extends ElasticsearchTokenStreamTestCase { @Test public void testKeepWordsPathSettings() { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.home", 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") @@ -76,7 +75,7 @@ public class KeepFilterFactoryTests extends ElasticsearchTokenStreamTestCase { assertThat(e.getCause(), instanceOf(FailedToResolveConfigException.class)); } - settings = ImmutableSettings.settingsBuilder().put(settings) + settings = Settings.settingsBuilder().put(settings) .put("index.analysis.filter.non_broken_keep_filter.keep_words", new String[]{"test"}) .build(); try { diff --git a/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java index c296c875987..966d550a55d 100644 --- a/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/KeepTypesFilterFactoryTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.standard.StandardTokenizer; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Test; @@ -35,7 +34,7 @@ public class KeepTypesFilterFactoryTests extends ElasticsearchTokenStreamTestCas @Test public void testKeepTypes() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.home", createTempDir().toString()) .put("index.analysis.filter.keep_numbers.type", "keep_types") .putArray("index.analysis.filter.keep_numbers.types", new String[] {"", ""}) diff --git a/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java index 0428e66263d..e75120d9eeb 100644 --- a/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/LimitTokenCountFilterFactoryTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Test; @@ -33,7 +32,7 @@ public class LimitTokenCountFilterFactoryTests extends ElasticsearchTokenStreamT @Test public void testDefault() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.analysis.filter.limit_default.type", "limit") .put("path.home", createTempDir().toString()) .build(); @@ -59,7 +58,7 @@ public class LimitTokenCountFilterFactoryTests extends ElasticsearchTokenStreamT @Test public void testSettings() throws IOException { { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .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) @@ -74,7 +73,7 @@ public class LimitTokenCountFilterFactoryTests extends ElasticsearchTokenStreamT assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .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) @@ -90,7 +89,7 @@ public class LimitTokenCountFilterFactoryTests extends ElasticsearchTokenStreamT } { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .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/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java index 7b66c4f41e6..39a2372e3b3 100644 --- a/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/NGramTokenizerFactoryTests.java @@ -26,8 +26,8 @@ import org.apache.lucene.analysis.ngram.*; import org.apache.lucene.analysis.reverse.ReverseStringFilter; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings.Builder; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.index.Index; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Test; diff --git a/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java b/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java index eaab794e500..11a4f8745c7 100644 --- a/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/PatternCaptureTokenFilterTests.java @@ -35,7 +35,7 @@ import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class PatternCaptureTokenFilterTests extends ElasticsearchTokenStreamTestCase { diff --git a/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactoryTests.java index 2f751578ef1..78b1bb9d671 100644 --- a/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerProviderFactoryTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltAnalyzers; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -37,8 +37,8 @@ public class PreBuiltAnalyzerProviderFactoryTests extends ElasticsearchTestCase public void testVersioningInFactoryProvider() throws Exception { PreBuiltAnalyzerProviderFactory factory = new PreBuiltAnalyzerProviderFactory("default", AnalyzerScope.INDEX, PreBuiltAnalyzers.STANDARD.getAnalyzer(Version.CURRENT)); - AnalyzerProvider former090AnalyzerProvider = factory.create("default", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_0).build()); - AnalyzerProvider currentAnalyzerProviderReference = factory.create("default", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + AnalyzerProvider former090AnalyzerProvider = factory.create("default", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_0).build()); + AnalyzerProvider currentAnalyzerProviderReference = factory.create("default", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); // would love to access the version inside of the lucene analyzer, but that is not possible... assertThat(currentAnalyzerProviderReference, is(not(former090AnalyzerProvider))); diff --git a/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java b/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java index 510fe930845..2592c3cba2e 100644 --- a/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/PreBuiltAnalyzerTests.java @@ -23,7 +23,6 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -154,7 +153,7 @@ public class PreBuiltAnalyzerTests extends ElasticsearchSingleNodeTest { String analyzerName = randomPreBuiltAnalyzer.name().toLowerCase(Locale.ROOT); Version randomVersion = randomVersion(random()); - Settings indexSettings = ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, randomVersion).build(); + Settings indexSettings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, randomVersion).build(); NamedAnalyzer namedAnalyzer = new PreBuiltAnalyzerProvider(analyzerName, AnalyzerScope.INDEX, randomPreBuiltAnalyzer.getAnalyzer(randomVersion)).get(); diff --git a/src/test/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactoryTests.java index ede59528de0..5690315f7a7 100644 --- a/src/test/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/PreBuiltCharFilterFactoryFactoryTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltCharFilters; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -37,9 +37,9 @@ public class PreBuiltCharFilterFactoryFactoryTests extends ElasticsearchTestCase public void testThatDifferentVersionsCanBeLoaded() { PreBuiltCharFilterFactoryFactory factory = new PreBuiltCharFilterFactoryFactory(PreBuiltCharFilters.HTML_STRIP.getCharFilterFactory(Version.CURRENT)); - CharFilterFactory former090TokenizerFactory = factory.create("html_strip", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_0).build()); - CharFilterFactory former090TokenizerFactoryCopy = factory.create("html_strip", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_0).build()); - CharFilterFactory currentTokenizerFactory = factory.create("html_strip", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + CharFilterFactory former090TokenizerFactory = factory.create("html_strip", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_0).build()); + CharFilterFactory former090TokenizerFactoryCopy = factory.create("html_strip", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_0).build()); + CharFilterFactory currentTokenizerFactory = factory.create("html_strip", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); assertThat(currentTokenizerFactory, is(former090TokenizerFactory)); assertThat(currentTokenizerFactory, is(former090TokenizerFactoryCopy)); diff --git a/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactoryTests.java index 040a9bebf17..8531dc81c34 100644 --- a/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenFilterFactoryFactoryTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltTokenFilters; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -36,9 +36,9 @@ public class PreBuiltTokenFilterFactoryFactoryTests extends ElasticsearchTestCas public void testThatCachingWorksForCachingStrategyOne() { PreBuiltTokenFilterFactoryFactory factory = new PreBuiltTokenFilterFactoryFactory(PreBuiltTokenFilters.WORD_DELIMITER.getTokenFilterFactory(Version.CURRENT)); - TokenFilterFactory former090TokenizerFactory = factory.create("word_delimiter", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_1).build()); - TokenFilterFactory former090TokenizerFactoryCopy = factory.create("word_delimiter", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_2).build()); - TokenFilterFactory currentTokenizerFactory = factory.create("word_delimiter", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + TokenFilterFactory former090TokenizerFactory = factory.create("word_delimiter", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_1).build()); + TokenFilterFactory former090TokenizerFactoryCopy = factory.create("word_delimiter", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_2).build()); + TokenFilterFactory currentTokenizerFactory = factory.create("word_delimiter", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); assertThat(currentTokenizerFactory, is(former090TokenizerFactory)); assertThat(currentTokenizerFactory, is(former090TokenizerFactoryCopy)); @@ -48,9 +48,9 @@ public class PreBuiltTokenFilterFactoryFactoryTests extends ElasticsearchTestCas public void testThatDifferentVersionsCanBeLoaded() { PreBuiltTokenFilterFactoryFactory factory = new PreBuiltTokenFilterFactoryFactory(PreBuiltTokenFilters.STOP.getTokenFilterFactory(Version.CURRENT)); - TokenFilterFactory former090TokenizerFactory = factory.create("stop", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_1).build()); - TokenFilterFactory former090TokenizerFactoryCopy = factory.create("stop", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_2).build()); - TokenFilterFactory currentTokenizerFactory = factory.create("stop", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + TokenFilterFactory former090TokenizerFactory = factory.create("stop", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_1).build()); + TokenFilterFactory former090TokenizerFactoryCopy = factory.create("stop", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_2).build()); + TokenFilterFactory currentTokenizerFactory = factory.create("stop", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); assertThat(currentTokenizerFactory, is(not(former090TokenizerFactory))); assertThat(former090TokenizerFactory, is(former090TokenizerFactoryCopy)); diff --git a/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactoryTests.java index 37dc8dd6a7a..d60155e0e00 100644 --- a/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/PreBuiltTokenizerFactoryFactoryTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.analysis; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.PreBuiltTokenizers; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -37,9 +37,9 @@ public class PreBuiltTokenizerFactoryFactoryTests extends ElasticsearchTestCase PreBuiltTokenizerFactoryFactory factory = new PreBuiltTokenizerFactoryFactory(PreBuiltTokenizers.STANDARD.getTokenizerFactory(Version.CURRENT)); // different es versions, same lucene version, thus cached - TokenizerFactory former090TokenizerFactory = factory.create("standard", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_1).build()); - TokenizerFactory former090TokenizerFactoryCopy = factory.create("standard", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_2).build()); - TokenizerFactory currentTokenizerFactory = factory.create("standard", ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + TokenizerFactory former090TokenizerFactory = factory.create("standard", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_1).build()); + TokenizerFactory former090TokenizerFactoryCopy = factory.create("standard", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_0_90_2).build()); + TokenizerFactory currentTokenizerFactory = factory.create("standard", Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); assertThat(currentTokenizerFactory, is(not(former090TokenizerFactory))); assertThat(currentTokenizerFactory, is(not(former090TokenizerFactoryCopy))); diff --git a/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java index 727b71f3b2f..6b5fb9fa34f 100644 --- a/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/StemmerTokenFilterFactoryTests.java @@ -24,7 +24,6 @@ import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.apache.lucene.analysis.en.PorterStemFilter; import org.apache.lucene.analysis.snowball.SnowballFilter; import org.elasticsearch.Version; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.elasticsearch.test.VersionUtils; @@ -48,7 +47,7 @@ public class StemmerTokenFilterFactoryTests extends ElasticsearchTokenStreamTest for (int i = 0; i < iters; i++) { Version v = VersionUtils.randomVersion(random()); - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.analysis.filter.my_english.type", "stemmer") .put("index.analysis.filter.my_english.language", "english") .put("index.analysis.analyzer.my_english.tokenizer","whitespace") @@ -82,7 +81,7 @@ public class StemmerTokenFilterFactoryTests extends ElasticsearchTokenStreamTest for (int i = 0; i < iters; i++) { Version v = VersionUtils.randomVersion(random()); - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .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/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java b/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java index 00e59547a69..0b4dc23b792 100644 --- a/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/StopAnalyzerTests.java @@ -35,7 +35,7 @@ import org.elasticsearch.indices.analysis.IndicesAnalysisService; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class StopAnalyzerTests extends ElasticsearchTokenStreamTestCase { diff --git a/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java b/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java index fa1dbf71362..f61a50ea2d0 100644 --- a/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/StopTokenFilterTests.java @@ -27,16 +27,14 @@ import org.apache.lucene.analysis.core.WhitespaceTokenizer; import org.apache.lucene.search.suggest.analyzing.SuggestStopFilter; import org.apache.lucene.util.Version; import org.elasticsearch.common.inject.ProvisionException; -import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.common.settings.ImmutableSettings.Builder; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.test.ElasticsearchTokenStreamTestCase; import org.junit.Test; import java.io.IOException; import java.io.StringReader; -import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; @@ -44,7 +42,7 @@ public class StopTokenFilterTests extends ElasticsearchTokenStreamTestCase { @Test(expected = ProvisionException.class) public void testPositionIncrementSetting() throws IOException { - Builder builder = ImmutableSettings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop") + Builder builder = Settings.settingsBuilder().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"); @@ -57,7 +55,7 @@ public class StopTokenFilterTests extends ElasticsearchTokenStreamTestCase { @Test public void testCorrectPositionIncrementSetting() throws IOException { - Builder builder = ImmutableSettings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop"); + Builder builder = Settings.settingsBuilder().put("index.analysis.filter.my_stop.type", "stop"); int thingToDo = random().nextInt(3); if (thingToDo == 0) { builder.put("index.analysis.filter.my_stop.version", Version.LATEST); @@ -85,7 +83,7 @@ public class StopTokenFilterTests extends ElasticsearchTokenStreamTestCase { @Test public void testDeprecatedPositionIncrementSettingWithVersions() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.analysis.filter.my_stop.type", "stop") .put("index.analysis.filter.my_stop.enable_position_increments", false) .put("index.analysis.filter.my_stop.version", "4.3") @@ -102,7 +100,7 @@ public class StopTokenFilterTests extends ElasticsearchTokenStreamTestCase { @Test public void testThatSuggestStopFilterWorks() throws Exception { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.analysis.filter.my_stop.type", "stop") .put("index.analysis.filter.my_stop.remove_trailing", false) .put("path.home", createTempDir().toString()) diff --git a/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java index 52dc850c12a..cb67e657dd9 100644 --- a/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/WordDelimiterTokenFilterFactoryTests.java @@ -27,7 +27,7 @@ import org.junit.Test; import java.io.IOException; import java.io.StringReader; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; public class WordDelimiterTokenFilterFactoryTests extends ElasticsearchTokenStreamTestCase { diff --git a/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java b/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java index 164892ff48c..d4bf9058bc6 100644 --- a/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java +++ b/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.analysis.commongrams; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.core.WhitespaceTokenizer; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.analysis.AnalysisService; import org.elasticsearch.index.analysis.AnalysisTestsHelper; @@ -39,7 +38,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream @Test public void testDefault() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.analysis.filter.common_grams_default.type", "common_grams") .put("path.home", createTempDir().toString()) .build(); @@ -54,7 +53,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream @Test public void testWithoutCommonWordsMatch() throws IOException { { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_default.type", "common_grams") + Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_default.type", "common_grams") .putArray("index.analysis.filter.common_grams_default.common_words", "chromosome", "protein") .put("path.home", createTempDir().toString()) .build(); @@ -71,7 +70,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream } { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_default.type", "common_grams") + Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_default.type", "common_grams") .put("index.analysis.filter.common_grams_default.query_mode", false) .put("path.home", createTempDir().toString()) .putArray("index.analysis.filter.common_grams_default.common_words", "chromosome", "protein") @@ -91,7 +90,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream @Test public void testSettings() throws IOException { { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_1.type", "common_grams") + Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_1.type", "common_grams") .put("index.analysis.filter.common_grams_1.ignore_case", true) .put("path.home", createTempDir().toString()) .putArray("index.analysis.filter.common_grams_1.common_words", "the", "Or", "Not", "a", "is", "an", "they", "are") @@ -105,7 +104,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_2.type", "common_grams") + Settings settings = Settings.settingsBuilder().put("index.analysis.filter.common_grams_2.type", "common_grams") .put("index.analysis.filter.common_grams_2.ignore_case", false) .put("path.home", createTempDir().toString()) .putArray("index.analysis.filter.common_grams_2.common_words", "the", "Or", "noT", "a", "is", "an", "they", "are") @@ -119,7 +118,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_3.type", "common_grams") + Settings settings = Settings.settingsBuilder().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("path.home", createTempDir().toString()) .build(); @@ -135,7 +134,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream @Test public void testCommonGramsAnalysis() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .loadFromClasspath("org/elasticsearch/index/analysis/commongrams/commongrams.json") .put("path.home", createTempDir().toString()) .build(); @@ -158,7 +157,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream @Test public void testQueryModeSettings() throws IOException { { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_1.type", "common_grams") + Settings settings = Settings.settingsBuilder().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) @@ -173,7 +172,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_2.type", "common_grams") + Settings settings = Settings.settingsBuilder().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) @@ -188,7 +187,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_3.type", "common_grams") + Settings settings = Settings.settingsBuilder().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("path.home", createTempDir().toString()) @@ -202,7 +201,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream assertTokenStreamContents(tokenFilter.create(tokenizer), expected); } { - Settings settings = ImmutableSettings.settingsBuilder().put("index.analysis.filter.common_grams_4.type", "common_grams") + Settings settings = Settings.settingsBuilder().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("path.home", createTempDir().toString()) @@ -219,7 +218,7 @@ public class CommonGramsTokenFilterFactoryTests extends ElasticsearchTokenStream @Test public void testQueryModeCommonGramsAnalysis() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .loadFromClasspath("org/elasticsearch/index/analysis/commongrams/commongrams_query_mode.json") .put("path.home", createTempDir().toString()) .build(); diff --git a/src/test/java/org/elasticsearch/index/analysis/filter1/MyFilterTokenFilterFactory.java b/src/test/java/org/elasticsearch/index/analysis/filter1/MyFilterTokenFilterFactory.java index 01b3f71e08f..47bf1bb8101 100644 --- a/src/test/java/org/elasticsearch/index/analysis/filter1/MyFilterTokenFilterFactory.java +++ b/src/test/java/org/elasticsearch/index/analysis/filter1/MyFilterTokenFilterFactory.java @@ -22,7 +22,6 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.core.StopAnalyzer; import org.apache.lucene.analysis.core.StopFilter; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.analysis.AbstractTokenFilterFactory; @@ -32,7 +31,7 @@ public class MyFilterTokenFilterFactory extends AbstractTokenFilterFactory { @Inject public MyFilterTokenFilterFactory(Index index, @IndexSettings Settings indexSettings, String name) { - super(index, indexSettings, name, ImmutableSettings.Builder.EMPTY_SETTINGS); + super(index, indexSettings, name, Settings.Builder.EMPTY_SETTINGS); } @Override diff --git a/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTest.java b/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTest.java index 6df27d10212..289c1a20b74 100644 --- a/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTest.java +++ b/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTest.java @@ -47,7 +47,7 @@ import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/index/cache/bitset/BitSetFilterCacheTest.java b/src/test/java/org/elasticsearch/index/cache/bitset/BitSetFilterCacheTest.java index a57e81ff7f3..4125c347904 100644 --- a/src/test/java/org/elasticsearch/index/cache/bitset/BitSetFilterCacheTest.java +++ b/src/test/java/org/elasticsearch/index/cache/bitset/BitSetFilterCacheTest.java @@ -36,7 +36,7 @@ import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.join.BitDocIdSetFilter; import org.apache.lucene.store.RAMDirectory; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -71,7 +71,7 @@ public class BitSetFilterCacheTest extends ElasticsearchTestCase { IndexReader reader = DirectoryReader.open(writer, false); IndexSearcher searcher = new IndexSearcher(reader); - BitsetFilterCache cache = new BitsetFilterCache(new Index("test"), ImmutableSettings.EMPTY); + BitsetFilterCache cache = new BitsetFilterCache(new Index("test"), Settings.EMPTY); BitDocIdSetFilter filter = cache.getBitDocIdSetFilter(new QueryWrapperFilter(new TermQuery(new Term("field", "value")))); TopDocs docs = searcher.search(new ConstantScoreQuery(filter), 1); assertThat(docs.totalHits, equalTo(3)); diff --git a/src/test/java/org/elasticsearch/index/codec/CodecTests.java b/src/test/java/org/elasticsearch/index/codec/CodecTests.java index 1014fdfba74..f5fc8c99344 100644 --- a/src/test/java/org/elasticsearch/index/codec/CodecTests.java +++ b/src/test/java/org/elasticsearch/index/codec/CodecTests.java @@ -37,7 +37,6 @@ import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.SegmentReader; import org.apache.lucene.store.Directory; import org.apache.lucene.util.LuceneTestCase.SuppressCodecs; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexService; import org.elasticsearch.test.ElasticsearchSingleNodeTest; @@ -91,7 +90,7 @@ public class CodecTests extends ElasticsearchSingleNodeTest { } private static CodecService createCodecService() { - return createCodecService(ImmutableSettings.Builder.EMPTY_SETTINGS); + return createCodecService(Settings.Builder.EMPTY_SETTINGS); } private static CodecService createCodecService(Settings settings) { diff --git a/src/test/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicyTests.java b/src/test/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicyTests.java index 6db164f63d2..cf21ea84b94 100644 --- a/src/test/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicyTests.java +++ b/src/test/java/org/elasticsearch/index/deletionpolicy/SnapshotDeletionPolicyTests.java @@ -34,7 +34,7 @@ import org.junit.Before; import org.junit.Test; import static org.apache.lucene.index.DirectoryReader.listCommits; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/index/engine/InternalEngineIntegrationTest.java b/src/test/java/org/elasticsearch/index/engine/InternalEngineIntegrationTest.java index b241b3c3ebe..9f46af76260 100644 --- a/src/test/java/org/elasticsearch/index/engine/InternalEngineIntegrationTest.java +++ b/src/test/java/org/elasticsearch/index/engine/InternalEngineIntegrationTest.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.segments.IndexSegments; import org.elasticsearch.action.admin.indices.segments.IndexShardSegments; import org.elasticsearch.action.admin.indices.segments.IndicesSegmentResponse; import org.elasticsearch.action.admin.indices.segments.ShardSegments; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.hamcrest.Matchers; import org.junit.Test; @@ -36,19 +36,19 @@ public class InternalEngineIntegrationTest extends ElasticsearchIntegrationTest @Test public void testSetIndexCompoundOnFlush() { - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_replicas", 0).put("number_of_shards", 1)).get(); + client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("number_of_replicas", 0).put("number_of_shards", 1)).get(); ensureGreen(); client().prepareIndex("test", "foo").setSource("field", "foo").get(); refresh(); assertTotalCompoundSegments(1, 1, "test"); client().admin().indices().prepareUpdateSettings("test") - .setSettings(ImmutableSettings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, false)).get(); + .setSettings(Settings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, false)).get(); client().prepareIndex("test", "foo").setSource("field", "foo").get(); refresh(); assertTotalCompoundSegments(1, 2, "test"); client().admin().indices().prepareUpdateSettings("test") - .setSettings(ImmutableSettings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, true)).get(); + .setSettings(Settings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, true)).get(); client().prepareIndex("test", "foo").setSource("field", "foo").get(); refresh(); assertTotalCompoundSegments(2, 3, "test"); diff --git a/src/test/java/org/elasticsearch/index/engine/InternalEngineMergeTests.java b/src/test/java/org/elasticsearch/index/engine/InternalEngineMergeTests.java index 645b382c7bb..b7325c350d7 100644 --- a/src/test/java/org/elasticsearch/index/engine/InternalEngineMergeTests.java +++ b/src/test/java/org/elasticsearch/index/engine/InternalEngineMergeTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.merge.policy.LogDocMergePolicyProvider; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.hamcrest.Matchers; @@ -34,7 +34,6 @@ import org.junit.Test; import java.io.IOException; import java.util.concurrent.ExecutionException; -import static org.apache.lucene.util.LuceneTestCase.Slow; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; @@ -51,7 +50,7 @@ public class InternalEngineMergeTests extends ElasticsearchIntegrationTest { public void testMergesHappening() throws InterruptedException, IOException, ExecutionException { final int numOfShards = randomIntBetween(1,5); // some settings to keep num segments low - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numOfShards) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put(LogDocMergePolicyProvider.MIN_MERGE_DOCS_KEY, 10) diff --git a/src/test/java/org/elasticsearch/index/engine/InternalEngineSettingsTest.java b/src/test/java/org/elasticsearch/index/engine/InternalEngineSettingsTest.java index 1dd88a83a1e..e01f8dd0fc8 100644 --- a/src/test/java/org/elasticsearch/index/engine/InternalEngineSettingsTest.java +++ b/src/test/java/org/elasticsearch/index/engine/InternalEngineSettingsTest.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.engine; import org.apache.lucene.index.LiveIndexWriterConfig; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexService; import org.elasticsearch.test.ElasticsearchSingleNodeTest; @@ -34,9 +33,9 @@ public class InternalEngineSettingsTest extends ElasticsearchSingleNodeTest { // INDEX_COMPOUND_ON_FLUSH InternalEngine engine = ((InternalEngine)engine(service)); assertThat(engine.getCurrentIndexWriterConfig().getUseCompoundFile(), is(true)); - client().admin().indices().prepareUpdateSettings("foo").setSettings(ImmutableSettings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, false).build()).get(); + client().admin().indices().prepareUpdateSettings("foo").setSettings(Settings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, false).build()).get(); assertThat(engine.getCurrentIndexWriterConfig().getUseCompoundFile(), is(false)); - client().admin().indices().prepareUpdateSettings("foo").setSettings(ImmutableSettings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, true).build()).get(); + client().admin().indices().prepareUpdateSettings("foo").setSettings(Settings.builder().put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, true).build()).get(); assertThat(engine.getCurrentIndexWriterConfig().getUseCompoundFile(), is(true)); @@ -54,7 +53,7 @@ public class InternalEngineSettingsTest extends ElasticsearchSingleNodeTest { long versionMapSizeInMB = randomIntBetween(10, 20); String versionMapString = versionMapAsPercent ? versionMapPercent + "%" : versionMapSizeInMB + "mb"; - Settings build = ImmutableSettings.builder() + Settings build = Settings.builder() .put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, compoundOnFlush) .put(EngineConfig.INDEX_GC_DELETES_SETTING, gcDeletes) .put(EngineConfig.INDEX_VERSION_MAP_SIZE, versionMapString) @@ -78,7 +77,7 @@ public class InternalEngineSettingsTest extends ElasticsearchSingleNodeTest { } } - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put(EngineConfig.INDEX_GC_DELETES_SETTING, 1000) .build(); client().admin().indices().prepareUpdateSettings("foo").setSettings(settings).get(); @@ -86,7 +85,7 @@ public class InternalEngineSettingsTest extends ElasticsearchSingleNodeTest { assertTrue(engine.config().isEnableGcDeletes()); - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(EngineConfig.INDEX_GC_DELETES_SETTING, "0ms") .build(); @@ -94,14 +93,14 @@ public class InternalEngineSettingsTest extends ElasticsearchSingleNodeTest { assertEquals(engine.getGcDeletesInMillis(), 0); assertTrue(engine.config().isEnableGcDeletes()); - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(EngineConfig.INDEX_GC_DELETES_SETTING, 1000) .build(); client().admin().indices().prepareUpdateSettings("foo").setSettings(settings).get(); assertEquals(engine.getGcDeletesInMillis(), 1000); assertTrue(engine.config().isEnableGcDeletes()); - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(EngineConfig.INDEX_VERSION_MAP_SIZE, "sdfasfd") .build(); try { @@ -111,7 +110,7 @@ public class InternalEngineSettingsTest extends ElasticsearchSingleNodeTest { // good } - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(EngineConfig.INDEX_VERSION_MAP_SIZE, "-12%") .build(); try { @@ -121,7 +120,7 @@ public class InternalEngineSettingsTest extends ElasticsearchSingleNodeTest { // good } - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(EngineConfig.INDEX_VERSION_MAP_SIZE, "130%") .build(); try { diff --git a/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index 96988646016..2d15f481b96 100644 --- a/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -47,7 +47,6 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.uid.Versions; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.index.Index; @@ -96,7 +95,7 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.elasticsearch.index.engine.Engine.Operation.Origin.PRIMARY; import static org.elasticsearch.index.engine.Engine.Operation.Origin.REPLICA; import static org.hamcrest.Matchers.*; @@ -134,7 +133,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { } else { codecName = "default"; } - defaultSettings = ImmutableSettings.builder() + defaultSettings = Settings.builder() .put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, randomBoolean()) .put(EngineConfig.INDEX_GC_DELETES_SETTING, "1h") // make sure this doesn't kick in on us .put(EngineConfig.INDEX_CODEC_SETTING, codecName) @@ -244,7 +243,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { } protected InternalEngine createEngine(Store store, Path translogPath) { - IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), ImmutableSettings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); return createEngine(indexSettingsService, store, translogPath, createMergeScheduler(indexSettingsService)); } @@ -422,7 +421,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { @Test public void testSegmentsWithMergeFlag() throws Exception { ConcurrentMergeSchedulerProvider mergeSchedulerProvider = new ConcurrentMergeSchedulerProvider(shardId, EMPTY_SETTINGS, threadPool, new IndexSettingsService(shardId.index(), EMPTY_SETTINGS)); - IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), ImmutableSettings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); try (Store store = createStore(); Engine engine = createEngine(indexSettingsService, store, createTempDir(), mergeSchedulerProvider)) { @@ -1351,7 +1350,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { @Slow @Test public void testEnableGcDeletes() throws Exception { - IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), ImmutableSettings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); try (Store store = createStore(); Engine engine = new InternalEngine(config(indexSettingsService, store, createTempDir(), createMergeScheduler(indexSettingsService)), false)) { engine.config().setEnableGcDeletes(false); @@ -1571,7 +1570,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { @Test public void testDeletesAloneCanTriggerRefresh() throws Exception { // Tiny indexing buffer: - Settings indexSettings = ImmutableSettings.builder().put(defaultSettings) + Settings indexSettings = Settings.builder().put(defaultSettings) .put(EngineConfig.INDEX_BUFFER_SIZE_SETTING, "1kb").build(); IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), indexSettings); try (Store store = createStore(); @@ -1624,7 +1623,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { // expected } // now it should be OK. - IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), ImmutableSettings.builder().put(defaultSettings) + IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings) .put(EngineConfig.INDEX_FORCE_NEW_TRANSLOG, true).build()); engine = createEngine(indexSettingsService, store, primaryTranslogDir, createMergeScheduler(indexSettingsService)); } @@ -1716,7 +1715,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { } private Mapping dynamicUpdate() { - BuilderContext context = new BuilderContext(ImmutableSettings.EMPTY, new ContentPath()); + BuilderContext context = new BuilderContext(Settings.EMPTY, new ContentPath()); final RootObjectMapper root = MapperBuilders.rootObject("some_type").build(context); return new Mapping(Version.CURRENT, root, new RootMapper[0], new Mapping.SourceTransform[0], ImmutableMap.of()); } @@ -1822,7 +1821,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { public TranslogHandler(String indexName) { super(null, new MapperAnalyzer(null), null, null, null); - Settings settings = ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); RootObjectMapper.Builder rootBuilder = new RootObjectMapper.Builder("test"); Index index = new Index(indexName); AnalysisService analysisService = new AnalysisService(index, settings); @@ -1869,7 +1868,7 @@ public class InternalEngineTests extends ElasticsearchTestCase { Translog.TranslogGeneration generation = engine.getTranslog().getGeneration(); engine.close(); - Translog translog = new Translog(new TranslogConfig(shardId, createTempDir(), ImmutableSettings.EMPTY, Translog.Durabilty.REQUEST, BigArrays.NON_RECYCLING_INSTANCE, threadPool)); + Translog translog = new Translog(new TranslogConfig(shardId, createTempDir(), Settings.EMPTY, Translog.Durabilty.REQUEST, BigArrays.NON_RECYCLING_INSTANCE, threadPool)); translog.add(new Translog.Create("test", "SomeBogusId", "{}".getBytes(Charset.forName("UTF-8")))); assertEquals(generation.translogFileGeneration, translog.currentFileGeneration()); translog.close(); diff --git a/src/test/java/org/elasticsearch/index/engine/ShadowEngineTests.java b/src/test/java/org/elasticsearch/index/engine/ShadowEngineTests.java index 19c60bfaf38..29783391a18 100644 --- a/src/test/java/org/elasticsearch/index/engine/ShadowEngineTests.java +++ b/src/test/java/org/elasticsearch/index/engine/ShadowEngineTests.java @@ -38,7 +38,6 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.index.Index; @@ -79,7 +78,7 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.hamcrest.Matchers.*; /** @@ -117,7 +116,7 @@ public class ShadowEngineTests extends ElasticsearchTestCase { } else { codecName = "default"; } - defaultSettings = ImmutableSettings.builder() + defaultSettings = Settings.builder() .put(EngineConfig.INDEX_COMPOUND_ON_FLUSH, randomBoolean()) .put(EngineConfig.INDEX_GC_DELETES_SETTING, "1h") // make sure this doesn't kick in on us .put(EngineConfig.INDEX_CODEC_SETTING, codecName) @@ -212,12 +211,12 @@ public class ShadowEngineTests extends ElasticsearchTestCase { } protected ShadowEngine createShadowEngine(Store store) { - IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), ImmutableSettings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); return createShadowEngine(indexSettingsService, store, createMergeScheduler(indexSettingsService)); } protected InternalEngine createInternalEngine(Store store, Path translogPath) { - IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), ImmutableSettings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); + IndexSettingsService indexSettingsService = new IndexSettingsService(shardId.index(), Settings.builder().put(defaultSettings).put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build()); return createInternalEngine(indexSettingsService, store, translogPath, createMergeScheduler(indexSettingsService)); } diff --git a/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTests.java index 60a59eaa28d..9f9e58853b7 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTests.java @@ -19,13 +19,13 @@ package org.elasticsearch.index.fielddata; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.cache.bitset.BitsetFilterCache; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.index.*; import org.apache.lucene.search.Filter; import org.apache.lucene.store.RAMDirectory; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.mapper.ContentPath; import org.elasticsearch.index.mapper.FieldMapper; @@ -95,7 +95,7 @@ public abstract class AbstractFieldDataTests extends ElasticsearchSingleNodeTest @Before public void setup() throws Exception { - Settings settings = ImmutableSettings.builder().put("index.fielddata.cache", "none").build(); + Settings settings = Settings.builder().put("index.fielddata.cache", "none").build(); indexService = createIndex("test", settings); mapperService = indexService.mapperService(); indicesFieldDataCache = indexService.injector().getInstance(IndicesFieldDataCache.class); diff --git a/src/test/java/org/elasticsearch/index/fielddata/AbstractNumericFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/AbstractNumericFieldDataTests.java index 371a303621f..271a0424d90 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/AbstractNumericFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/AbstractNumericFieldDataTests.java @@ -25,7 +25,7 @@ import org.apache.lucene.document.StringField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.SortedNumericDocValues; import org.apache.lucene.search.*; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.MultiValueMode; import org.junit.Test; @@ -40,8 +40,8 @@ public abstract class AbstractNumericFieldDataTests extends AbstractFieldDataImp @Override protected abstract FieldDataType getFieldDataType(); - protected ImmutableSettings.Builder getFieldDataSettings() { - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + protected Settings.Builder getFieldDataSettings() { + Settings.Builder builder = Settings.builder(); IndexFieldData.CommonSettings.MemoryStorageFormat[] formats = IndexFieldData.CommonSettings.MemoryStorageFormat.values(); int i = randomInt(formats.length); if (i < formats.length) { diff --git a/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java index 71d802abbb1..e9e5839bc0e 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/AbstractStringFieldDataTests.java @@ -49,7 +49,7 @@ import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.UnicodeUtil; import org.elasticsearch.common.lucene.search.Queries; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource; import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested; import org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource; @@ -474,7 +474,7 @@ public abstract class AbstractStringFieldDataTests extends AbstractFieldDataImpl public void testGlobalOrdinals() throws Exception { fillExtendedMvSet(); refreshReader(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("global_values", "fixed")); + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("global_values", "fixed")); IndexOrdinalsFieldData ifd = getForField(fieldDataType, "value", hasDocValues()); IndexOrdinalsFieldData globalOrdinals = ifd.loadGlobal(topLevelReader); assertThat(topLevelReader.leaves().size(), equalTo(3)); @@ -601,7 +601,7 @@ public abstract class AbstractStringFieldDataTests extends AbstractFieldDataImpl public void testGlobalOrdinalsGetRemovedOnceIndexReaderCloses() throws Exception { fillExtendedMvSet(); refreshReader(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("global_values", "fixed").put("cache", "node")); + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("global_values", "fixed").put("cache", "node")); IndexOrdinalsFieldData ifd = getForField(fieldDataType, "value", hasDocValues()); IndexOrdinalsFieldData globalOrdinals = ifd.loadGlobal(topLevelReader); assertThat(ifd.loadGlobal(topLevelReader), sameInstance(globalOrdinals)); diff --git a/src/test/java/org/elasticsearch/index/fielddata/BinaryDVFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/BinaryDVFieldDataTests.java index c1f2dfdeff0..dc683381d8f 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/BinaryDVFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/BinaryDVFieldDataTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.index.fielddata; import com.carrotsearch.hppc.ObjectArrayList; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -115,6 +115,6 @@ public class BinaryDVFieldDataTests extends AbstractFieldDataTests { @Override protected FieldDataType getFieldDataType() { - return new FieldDataType("binary", ImmutableSettings.builder().put("format", "doc_values")); + return new FieldDataType("binary", Settings.builder().put("format", "doc_values")); } } diff --git a/src/test/java/org/elasticsearch/index/fielddata/DisabledFieldDataFormatTests.java b/src/test/java/org/elasticsearch/index/fielddata/DisabledFieldDataFormatTests.java index e9dfbd6f45c..9124f6c4508 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/DisabledFieldDataFormatTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/DisabledFieldDataFormatTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.fielddata; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; @@ -34,7 +34,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFa public class DisabledFieldDataFormatTests extends ElasticsearchSingleNodeTest { public void test() throws Exception { - createIndex("test", ImmutableSettings.EMPTY, "type", "s", "type=string"); + createIndex("test", Settings.EMPTY, "type", "s", "type=string"); logger.info("indexing data start"); for (int i = 0; i < 10; ++i) { client().prepareIndex("test", "type", Integer.toString(i)).setSource("s", "value" + i).execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java index ac331641965..1b3168af985 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/DuelFieldDataTests.java @@ -31,7 +31,7 @@ import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.English; import org.elasticsearch.common.geo.GeoDistance; import org.elasticsearch.common.geo.GeoPoint; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.DistanceUnit; import org.elasticsearch.common.unit.DistanceUnit.Distance; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -87,21 +87,21 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { } LeafReaderContext context = refreshReader(); Map typeMap = new HashMap<>(); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "fst")), Type.Bytes); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "paged_bytes")), Type.Bytes); - typeMap.put(new FieldDataType("byte", ImmutableSettings.builder().put("format", "array")), Type.Integer); - typeMap.put(new FieldDataType("short", ImmutableSettings.builder().put("format", "array")), Type.Integer); - typeMap.put(new FieldDataType("int", ImmutableSettings.builder().put("format", "array")), Type.Integer); - typeMap.put(new FieldDataType("long", ImmutableSettings.builder().put("format", "array")), Type.Long); - typeMap.put(new FieldDataType("double", ImmutableSettings.builder().put("format", "array")), Type.Double); - typeMap.put(new FieldDataType("float", ImmutableSettings.builder().put("format", "array")), Type.Float); - typeMap.put(new FieldDataType("byte", ImmutableSettings.builder().put("format", "doc_values")), Type.Integer); - typeMap.put(new FieldDataType("short", ImmutableSettings.builder().put("format", "doc_values")), Type.Integer); - typeMap.put(new FieldDataType("int", ImmutableSettings.builder().put("format", "doc_values")), Type.Integer); - typeMap.put(new FieldDataType("long", ImmutableSettings.builder().put("format", "doc_values")), Type.Long); - typeMap.put(new FieldDataType("double", ImmutableSettings.builder().put("format", "doc_values")), Type.Double); - typeMap.put(new FieldDataType("float", ImmutableSettings.builder().put("format", "doc_values")), Type.Float); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "doc_values")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "fst")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "paged_bytes")), Type.Bytes); + typeMap.put(new FieldDataType("byte", Settings.builder().put("format", "array")), Type.Integer); + typeMap.put(new FieldDataType("short", Settings.builder().put("format", "array")), Type.Integer); + typeMap.put(new FieldDataType("int", Settings.builder().put("format", "array")), Type.Integer); + typeMap.put(new FieldDataType("long", Settings.builder().put("format", "array")), Type.Long); + typeMap.put(new FieldDataType("double", Settings.builder().put("format", "array")), Type.Double); + typeMap.put(new FieldDataType("float", Settings.builder().put("format", "array")), Type.Float); + typeMap.put(new FieldDataType("byte", Settings.builder().put("format", "doc_values")), Type.Integer); + typeMap.put(new FieldDataType("short", Settings.builder().put("format", "doc_values")), Type.Integer); + typeMap.put(new FieldDataType("int", Settings.builder().put("format", "doc_values")), Type.Integer); + typeMap.put(new FieldDataType("long", Settings.builder().put("format", "doc_values")), Type.Long); + typeMap.put(new FieldDataType("double", Settings.builder().put("format", "doc_values")), Type.Double); + typeMap.put(new FieldDataType("float", Settings.builder().put("format", "doc_values")), Type.Float); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "doc_values")), Type.Bytes); ArrayList> list = new ArrayList<>(typeMap.entrySet()); Preprocessor pre = new ToDoublePreprocessor(); while (!list.isEmpty()) { @@ -179,14 +179,14 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { } LeafReaderContext context = refreshReader(); Map typeMap = new HashMap<>(); - typeMap.put(new FieldDataType("byte", ImmutableSettings.builder().put("format", "array")), Type.Integer); - typeMap.put(new FieldDataType("short", ImmutableSettings.builder().put("format", "array")), Type.Integer); - typeMap.put(new FieldDataType("int", ImmutableSettings.builder().put("format", "array")), Type.Integer); - typeMap.put(new FieldDataType("long", ImmutableSettings.builder().put("format", "array")), Type.Long); - typeMap.put(new FieldDataType("byte", ImmutableSettings.builder().put("format", "doc_values")), Type.Integer); - typeMap.put(new FieldDataType("short", ImmutableSettings.builder().put("format", "doc_values")), Type.Integer); - typeMap.put(new FieldDataType("int", ImmutableSettings.builder().put("format", "doc_values")), Type.Integer); - typeMap.put(new FieldDataType("long", ImmutableSettings.builder().put("format", "doc_values")), Type.Long); + typeMap.put(new FieldDataType("byte", Settings.builder().put("format", "array")), Type.Integer); + typeMap.put(new FieldDataType("short", Settings.builder().put("format", "array")), Type.Integer); + typeMap.put(new FieldDataType("int", Settings.builder().put("format", "array")), Type.Integer); + typeMap.put(new FieldDataType("long", Settings.builder().put("format", "array")), Type.Long); + typeMap.put(new FieldDataType("byte", Settings.builder().put("format", "doc_values")), Type.Integer); + typeMap.put(new FieldDataType("short", Settings.builder().put("format", "doc_values")), Type.Integer); + typeMap.put(new FieldDataType("int", Settings.builder().put("format", "doc_values")), Type.Integer); + typeMap.put(new FieldDataType("long", Settings.builder().put("format", "doc_values")), Type.Long); ArrayList> list = new ArrayList<>(typeMap.entrySet()); while (!list.isEmpty()) { Entry left; @@ -265,10 +265,10 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { } LeafReaderContext context = refreshReader(); Map typeMap = new HashMap<>(); - typeMap.put(new FieldDataType("double", ImmutableSettings.builder().put("format", "array")), Type.Double); - typeMap.put(new FieldDataType("float", ImmutableSettings.builder().put("format", "array")), Type.Float); - typeMap.put(new FieldDataType("double", ImmutableSettings.builder().put("format", "doc_values")), Type.Double); - typeMap.put(new FieldDataType("float", ImmutableSettings.builder().put("format", "doc_values")), Type.Float); + typeMap.put(new FieldDataType("double", Settings.builder().put("format", "array")), Type.Double); + typeMap.put(new FieldDataType("float", Settings.builder().put("format", "array")), Type.Float); + typeMap.put(new FieldDataType("double", Settings.builder().put("format", "doc_values")), Type.Double); + typeMap.put(new FieldDataType("float", Settings.builder().put("format", "doc_values")), Type.Float); ArrayList> list = new ArrayList<>(typeMap.entrySet()); while (!list.isEmpty()) { Entry left; @@ -325,9 +325,9 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { } LeafReaderContext context = refreshReader(); Map typeMap = new HashMap<>(); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "fst")), Type.Bytes); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "paged_bytes")), Type.Bytes); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "doc_values")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "fst")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "paged_bytes")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "doc_values")), Type.Bytes); // TODO add filters ArrayList> list = new ArrayList<>(typeMap.entrySet()); Preprocessor pre = new Preprocessor(); @@ -384,9 +384,9 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { refreshReader(); Map typeMap = new HashMap(); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "fst")), Type.Bytes); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "paged_bytes")), Type.Bytes); - typeMap.put(new FieldDataType("string", ImmutableSettings.builder().put("format", "doc_values")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "fst")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "paged_bytes")), Type.Bytes); + typeMap.put(new FieldDataType("string", Settings.builder().put("format", "doc_values")), Type.Bytes); for (Map.Entry entry : typeMap.entrySet()) { ifdService.clear(); @@ -436,9 +436,9 @@ public class DuelFieldDataTests extends AbstractFieldDataTests { LeafReaderContext context = refreshReader(); Map typeMap = new HashMap<>(); final Distance precision = new Distance(1, randomFrom(DistanceUnit.values())); - typeMap.put(new FieldDataType("geo_point", ImmutableSettings.builder().put("format", "array")), Type.GeoPoint); - typeMap.put(new FieldDataType("geo_point", ImmutableSettings.builder().put("format", "compressed").put("precision", precision)), Type.GeoPoint); - typeMap.put(new FieldDataType("geo_point", ImmutableSettings.builder().put("format", "doc_values")), Type.GeoPoint); + typeMap.put(new FieldDataType("geo_point", Settings.builder().put("format", "array")), Type.GeoPoint); + typeMap.put(new FieldDataType("geo_point", Settings.builder().put("format", "compressed").put("precision", precision)), Type.GeoPoint); + typeMap.put(new FieldDataType("geo_point", Settings.builder().put("format", "doc_values")), Type.GeoPoint); ArrayList> list = new ArrayList<>(typeMap.entrySet()); while (!list.isEmpty()) { diff --git a/src/test/java/org/elasticsearch/index/fielddata/FSTPackedBytesStringFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/FSTPackedBytesStringFieldDataTests.java index c881a5e4aa9..a64ab8d98bd 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/FSTPackedBytesStringFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/FSTPackedBytesStringFieldDataTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.index.fielddata; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.ordinals.OrdinalsBuilder; /** @@ -28,6 +28,6 @@ public class FSTPackedBytesStringFieldDataTests extends AbstractStringFieldDataT @Override protected FieldDataType getFieldDataType() { - return new FieldDataType("string", ImmutableSettings.builder().put("format", "fst").put(OrdinalsBuilder.FORCE_MULTI_ORDINALS, randomBoolean())); + return new FieldDataType("string", Settings.builder().put("format", "fst").put(OrdinalsBuilder.FORCE_MULTI_ORDINALS, randomBoolean())); } } diff --git a/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTest.java b/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTest.java index 21f18a43fa0..3c13999eb37 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTest.java +++ b/src/test/java/org/elasticsearch/index/fielddata/FilterFieldDataTest.java @@ -23,7 +23,7 @@ import org.apache.lucene.document.Field; import org.apache.lucene.document.StringField; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.RandomAccessOrds; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.junit.Test; import java.util.Random; @@ -65,7 +65,7 @@ public class FilterFieldDataTest extends AbstractFieldDataTests { for (String format : formats) { { ifdService.clear(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("format", format) + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("format", format) .put("filter.frequency.min_segment_size", 100).put("filter.frequency.min", 0.0d).put("filter.frequency.max", random.nextBoolean() ? 100 : 0.5d)); IndexOrdinalsFieldData fieldData = getForField(fieldDataType, "high_freq"); AtomicOrdinalsFieldData loadDirect = fieldData.loadDirect(context); @@ -76,7 +76,7 @@ public class FilterFieldDataTest extends AbstractFieldDataTests { } { ifdService.clear(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("format", format) + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("format", format) .put("filter.frequency.min_segment_size", 100).put("filter.frequency.min", random.nextBoolean() ? 101 : 101d/200.0d).put("filter.frequency.max", 201)); IndexOrdinalsFieldData fieldData = getForField(fieldDataType, "high_freq"); AtomicOrdinalsFieldData loadDirect = fieldData.loadDirect(context); @@ -87,7 +87,7 @@ public class FilterFieldDataTest extends AbstractFieldDataTests { { ifdService.clear(); // test # docs with value - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("format", format) + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("format", format) .put("filter.frequency.min_segment_size", 101).put("filter.frequency.min", random.nextBoolean() ? 101 : 101d/200.0d)); IndexOrdinalsFieldData fieldData = getForField(fieldDataType, "med_freq"); AtomicOrdinalsFieldData loadDirect = fieldData.loadDirect(context); @@ -99,7 +99,7 @@ public class FilterFieldDataTest extends AbstractFieldDataTests { { ifdService.clear(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("format", format) + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("format", format) .put("filter.frequency.min_segment_size", 101).put("filter.frequency.min", random.nextBoolean() ? 101 : 101d/200.0d)); IndexOrdinalsFieldData fieldData = getForField(fieldDataType, "med_freq"); AtomicOrdinalsFieldData loadDirect = fieldData.loadDirect(context); @@ -111,7 +111,7 @@ public class FilterFieldDataTest extends AbstractFieldDataTests { { ifdService.clear(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("format", format) + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("format", format) .put("filter.regex.pattern", "\\d{2,3}") // allows 10 & 100 .put("filter.frequency.min_segment_size", 0) .put("filter.frequency.min", random.nextBoolean() ? 2 : 1d/200.0d) // 100, 10, 5 @@ -157,7 +157,7 @@ public class FilterFieldDataTest extends AbstractFieldDataTests { for (String format : formats) { { ifdService.clear(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("format", format) + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("format", format) .put("filter.regex.pattern", "\\d")); IndexOrdinalsFieldData fieldData = getForField(fieldDataType, "high_freq"); AtomicOrdinalsFieldData loadDirect = fieldData.loadDirect(context); @@ -167,7 +167,7 @@ public class FilterFieldDataTest extends AbstractFieldDataTests { } { ifdService.clear(); - FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("format", format) + FieldDataType fieldDataType = new FieldDataType("string", Settings.builder().put("format", format) .put("filter.regex.pattern", "\\d{1,2}")); IndexOrdinalsFieldData fieldData = getForField(fieldDataType, "high_freq"); AtomicOrdinalsFieldData loadDirect = fieldData.loadDirect(context); diff --git a/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java b/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java index 69d6b9cae27..38a557c4cef 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java @@ -25,7 +25,6 @@ import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.StringField; import org.apache.lucene.index.*; import org.apache.lucene.store.RAMDirectory; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.plain.*; import org.elasticsearch.index.mapper.ContentPath; @@ -45,7 +44,7 @@ import static org.hamcrest.Matchers.instanceOf; public class IndexFieldDataServiceTests extends ElasticsearchSingleNodeTest { - private static Settings DOC_VALUES_SETTINGS = ImmutableSettings.builder().put(FieldDataType.FORMAT_KEY, FieldDataType.DOC_VALUES_FORMAT_VALUE).build(); + private static Settings DOC_VALUES_SETTINGS = Settings.builder().put(FieldDataType.FORMAT_KEY, FieldDataType.DOC_VALUES_FORMAT_VALUE).build(); public void testGetForFieldDefaults() { final IndexService indexService = createIndex("test"); @@ -101,12 +100,12 @@ public class IndexFieldDataServiceTests extends ElasticsearchSingleNodeTest { final IndexService indexService = createIndex("test"); final IndexFieldDataService ifdService = indexService.fieldData(); final BuilderContext ctx = new BuilderContext(indexService.settingsService().getSettings(), new ContentPath(1)); - final StringFieldMapper stringMapper = MapperBuilders.stringField("string").tokenized(false).fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(ImmutableSettings.builder().put("format", "fst").build()).build(ctx); + final StringFieldMapper stringMapper = MapperBuilders.stringField("string").tokenized(false).fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(Settings.builder().put("format", "fst").build()).build(ctx); ifdService.clear(); IndexFieldData fd = ifdService.getForField(stringMapper); assertTrue(fd instanceof FSTBytesIndexFieldData); - final Settings fdSettings = ImmutableSettings.builder().put("format", "array").build(); + final Settings fdSettings = Settings.builder().put("format", "array").build(); for (FieldMapper mapper : Arrays.asList( new ByteFieldMapper.Builder("int").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx), new ShortFieldMapper.Builder("int").fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(fdSettings).build(ctx), @@ -133,7 +132,7 @@ public class IndexFieldDataServiceTests extends ElasticsearchSingleNodeTest { final IndexService indexService = createIndex("test"); final IndexFieldDataService ifdService = indexService.fieldData(); final BuilderContext ctx = new BuilderContext(indexService.settingsService().getSettings(), new ContentPath(1)); - final StringFieldMapper mapper1 = MapperBuilders.stringField("s").tokenized(false).fieldDataSettings(ImmutableSettings.builder().put(FieldDataType.FORMAT_KEY, "paged_bytes").build()).build(ctx); + final StringFieldMapper mapper1 = MapperBuilders.stringField("s").tokenized(false).fieldDataSettings(Settings.builder().put(FieldDataType.FORMAT_KEY, "paged_bytes").build()).build(ctx); final IndexWriter writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(new KeywordAnalyzer())); Document doc = new Document(); doc.add(new StringField("s", "thisisastring", Store.NO)); @@ -150,7 +149,7 @@ public class IndexFieldDataServiceTests extends ElasticsearchSingleNodeTest { // write new segment writer.addDocument(doc); final IndexReader reader2 = DirectoryReader.open(writer, true); - final StringFieldMapper mapper2 = MapperBuilders.stringField("s").tokenized(false).fieldDataSettings(ImmutableSettings.builder().put(FieldDataType.FORMAT_KEY, "fst").build()).build(ctx); + final StringFieldMapper mapper2 = MapperBuilders.stringField("s").tokenized(false).fieldDataSettings(Settings.builder().put(FieldDataType.FORMAT_KEY, "fst").build()).build(ctx); ifdService.onMappingUpdate(); ifd = ifdService.getForField(mapper2); assertThat(ifd, instanceOf(FSTBytesIndexFieldData.class)); diff --git a/src/test/java/org/elasticsearch/index/fielddata/PagedBytesStringFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/PagedBytesStringFieldDataTests.java index 56f0b5d4d84..1b8909ea63e 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/PagedBytesStringFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/PagedBytesStringFieldDataTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.index.fielddata; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.ordinals.OrdinalsBuilder; /** @@ -28,6 +28,6 @@ public class PagedBytesStringFieldDataTests extends AbstractStringFieldDataTests @Override protected FieldDataType getFieldDataType() { - return new FieldDataType("string", ImmutableSettings.builder().put("format", "paged_bytes").put(OrdinalsBuilder.FORCE_MULTI_ORDINALS, randomBoolean())); + return new FieldDataType("string", Settings.builder().put("format", "paged_bytes").put(OrdinalsBuilder.FORCE_MULTI_ORDINALS, randomBoolean())); } } diff --git a/src/test/java/org/elasticsearch/index/fielddata/SortedSetDVStringFieldDataTests.java b/src/test/java/org/elasticsearch/index/fielddata/SortedSetDVStringFieldDataTests.java index e8519101452..013a7ec9897 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/SortedSetDVStringFieldDataTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/SortedSetDVStringFieldDataTests.java @@ -19,14 +19,14 @@ package org.elasticsearch.index.fielddata; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.ordinals.OrdinalsBuilder; public class SortedSetDVStringFieldDataTests extends AbstractStringFieldDataTests { @Override protected FieldDataType getFieldDataType() { - return new FieldDataType("string", ImmutableSettings.builder().put("format", "doc_values").put(OrdinalsBuilder.FORCE_MULTI_ORDINALS, randomBoolean())); + return new FieldDataType("string", Settings.builder().put("format", "doc_values").put(OrdinalsBuilder.FORCE_MULTI_ORDINALS, randomBoolean())); } @Override diff --git a/src/test/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinalsTests.java b/src/test/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinalsTests.java index a14edde51ad..dd84f1515fa 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinalsTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/ordinals/MultiOrdinalsTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.fielddata.ordinals; import org.apache.lucene.index.RandomAccessOrds; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.util.packed.PackedInts; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.FieldData; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.test.ElasticsearchTestCase; @@ -37,11 +37,11 @@ import static org.hamcrest.Matchers.equalTo; public class MultiOrdinalsTests extends ElasticsearchTestCase { protected final Ordinals creationMultiOrdinals(OrdinalsBuilder builder) { - return this.creationMultiOrdinals(builder, ImmutableSettings.builder()); + return this.creationMultiOrdinals(builder, Settings.builder()); } - protected Ordinals creationMultiOrdinals(OrdinalsBuilder builder, ImmutableSettings.Builder settings) { + protected Ordinals creationMultiOrdinals(OrdinalsBuilder builder, Settings.Builder settings) { return builder.build(settings.build()); } diff --git a/src/test/java/org/elasticsearch/index/fielddata/ordinals/SingleOrdinalsTests.java b/src/test/java/org/elasticsearch/index/fielddata/ordinals/SingleOrdinalsTests.java index 63450a4c8b8..ebb8eb361fe 100644 --- a/src/test/java/org/elasticsearch/index/fielddata/ordinals/SingleOrdinalsTests.java +++ b/src/test/java/org/elasticsearch/index/fielddata/ordinals/SingleOrdinalsTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.fielddata.ordinals; import org.apache.lucene.index.DocValues; import org.apache.lucene.index.RandomAccessOrds; import org.apache.lucene.index.SortedDocValues; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -50,7 +50,7 @@ public class SingleOrdinalsTests extends ElasticsearchTestCase { builder.addDoc(doc); } - Ordinals ords = builder.build(ImmutableSettings.EMPTY); + Ordinals ords = builder.build(Settings.EMPTY); assertThat(ords, instanceOf(SinglePackedOrdinals.class)); RandomAccessOrds docs = ords.ordinals(); final SortedDocValues singleOrds = DocValues.unwrapSingleton(docs); @@ -70,12 +70,12 @@ public class SingleOrdinalsTests extends ElasticsearchTestCase { builder.addDoc(doc); } - Ordinals ords = builder.build(ImmutableSettings.EMPTY); + Ordinals ords = builder.build(Settings.EMPTY); assertThat(ords, instanceOf(SinglePackedOrdinals.class)); builder.nextOrdinal(); builder.addDoc(0); - ords = builder.build(ImmutableSettings.EMPTY); + ords = builder.build(Settings.EMPTY); assertThat(ords, not(instanceOf(SinglePackedOrdinals.class))); } diff --git a/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java index 4b040c47ae2..81bce4489b0 100644 --- a/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableMap; import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -175,7 +174,7 @@ public class DynamicMappingTests extends ElasticsearchSingleNodeTest { .field("dynamic", "strict") .endObject().endObject(); - IndexService indexService = createIndex("test", ImmutableSettings.EMPTY, "_default_", mapping); + IndexService indexService = createIndex("test", Settings.EMPTY, "_default_", mapping); try { client().prepareIndex().setIndex("test").setType("type").setSource(jsonBuilder().startObject().field("test", "test").endObject()).get(); @@ -195,7 +194,7 @@ public class DynamicMappingTests extends ElasticsearchSingleNodeTest { } private Mapper parse(DocumentMapper mapper, DocumentMapperParser parser, XContentBuilder builder) throws Exception { - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build(); ParseContext.InternalParseContext ctx = new ParseContext.InternalParseContext("test", settings, parser, mapper, new ContentPath(0)); SourceToParse source = SourceToParse.source(builder.bytes()); ctx.reset(XContentHelper.createParser(source.source()), new ParseContext.Document(), source); diff --git a/src/test/java/org/elasticsearch/index/mapper/FieldMappersLookupTests.java b/src/test/java/org/elasticsearch/index/mapper/FieldMappersLookupTests.java index e28cc7db9b4..1ec854c4c65 100644 --- a/src/test/java/org/elasticsearch/index/mapper/FieldMappersLookupTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/FieldMappersLookupTests.java @@ -24,7 +24,6 @@ import com.google.common.collect.Lists; import org.apache.lucene.document.FieldType; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.core.AbstractFieldMapper; @@ -174,7 +173,7 @@ public class FieldMappersLookupTests extends ElasticsearchTestCase { // this sucks how much must be overriden just do get a dummy field mapper... static class FakeFieldMapper extends AbstractFieldMapper { - static Settings dummySettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT.id).build(); + static Settings dummySettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT.id).build(); public FakeFieldMapper(String fullName, String indexName) { super(new Names(fullName, indexName, indexName, fullName), 1.0f, AbstractFieldMapper.Defaults.FIELD_TYPE, null, null, null, null, null, null, dummySettings, null, null); } diff --git a/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java b/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java index 89f57c67034..36c218f3d7c 100644 --- a/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/all/SimpleAllMapperTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.common.lucene.all.AllEntries; import org.elasticsearch.common.lucene.all.AllField; import org.elasticsearch.common.lucene.all.AllTermQuery; import org.elasticsearch.common.lucene.all.AllTokenStream; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -429,7 +428,7 @@ public class SimpleAllMapperTests extends ElasticsearchSingleNodeTest { .startObject("fielddata") .field("format", "doc_values") .endObject().endObject().endObject().endObject().string(); - Settings legacySettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings legacySettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); try { createIndex("test_old", legacySettings).mapperService().documentMapperParser().parse(mapping); fail(); @@ -455,7 +454,7 @@ public class SimpleAllMapperTests extends ElasticsearchSingleNodeTest { public void testIncludeInObjectBackcompat() throws Exception { String mapping = jsonBuilder().startObject().startObject("type").endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); ParsedDocument doc = docMapper.parse("type", "1", XContentFactory.jsonBuilder() .startObject().field("_all", "foo").endObject().bytes()); diff --git a/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java index ceab9056caa..a7f8017efa7 100644 --- a/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.compress.CompressorFactory; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -105,7 +104,7 @@ public class BinaryMappingTests extends ElasticsearchSingleNodeTest { .endObject() .endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_5_0).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_5_0).build(); DocumentMapper mapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); final byte[] original = new byte[100]; diff --git a/src/test/java/org/elasticsearch/index/mapper/core/Murmur3FieldMapperTests.java b/src/test/java/org/elasticsearch/index/mapper/core/Murmur3FieldMapperTests.java index fd502a04ed9..c09741ba17e 100644 --- a/src/test/java/org/elasticsearch/index/mapper/core/Murmur3FieldMapperTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/core/Murmur3FieldMapperTests.java @@ -22,13 +22,11 @@ package org.elasticsearch.index.mapper.core; import org.apache.lucene.index.IndexOptions; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.DocumentMapperParser; -import org.elasticsearch.index.mapper.Mapper; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.test.ElasticsearchSingleNodeTest; import org.junit.Before; @@ -99,7 +97,7 @@ public class Murmur3FieldMapperTests extends ElasticsearchSingleNodeTest { } public void testDocValuesSettingBackcompat() throws Exception { - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); indexService = createIndex("test_bwc", settings); parser = indexService.mapperService().documentMapperParser(); String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") @@ -114,7 +112,7 @@ public class Murmur3FieldMapperTests extends ElasticsearchSingleNodeTest { } public void testIndexSettingBackcompat() throws Exception { - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); indexService = createIndex("test_bwc", settings); parser = indexService.mapperService().documentMapperParser(); String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") diff --git a/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java index 29977447681..859bc4ebf0b 100644 --- a/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/date/SimpleDateMappingTests.java @@ -58,7 +58,7 @@ import java.util.Locale; import java.util.Map; import static com.carrotsearch.randomizedtesting.RandomizedTest.systemPropertyAsBoolean; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; diff --git a/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationTests.java b/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationTests.java index 368059456f1..7ee7a099cfc 100644 --- a/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.mapper.externalvalues; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.geo.ShapeRelation; import org.elasticsearch.common.geo.builders.ShapeBuilder; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; @@ -38,7 +37,7 @@ public class ExternalValuesMapperIntegrationTests extends ElasticsearchIntegrati @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put("plugin.types", ExternalMapperPlugin.class.getName()) .build(); diff --git a/src/test/java/org/elasticsearch/index/mapper/id/IdMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/id/IdMappingTests.java index 6c46ba2bacb..8d74dec8691 100644 --- a/src/test/java/org/elasticsearch/index/mapper/id/IdMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/id/IdMappingTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.mapper.id; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -69,7 +68,7 @@ public class IdMappingTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_id").field("index", "not_analyzed").endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); ParsedDocument doc = docMapper.parse("type", "1", XContentFactory.jsonBuilder() @@ -85,7 +84,7 @@ public class IdMappingTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_id").field("path", "my_path").endObject() .endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2_ID).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2_ID).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); // serialize the id mapping @@ -103,7 +102,7 @@ public class IdMappingTests extends ElasticsearchSingleNodeTest { public void testIncludeInObjectBackcompat() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); ParsedDocument doc = docMapper.parse(SourceToParse.source(XContentFactory.jsonBuilder() diff --git a/src/test/java/org/elasticsearch/index/mapper/index/IndexTypeMapperTests.java b/src/test/java/org/elasticsearch/index/mapper/index/IndexTypeMapperTests.java index 2b2d3c264f9..612a9868789 100644 --- a/src/test/java/org/elasticsearch/index/mapper/index/IndexTypeMapperTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/index/IndexTypeMapperTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.mapper.index; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -29,7 +28,6 @@ import org.elasticsearch.index.mapper.DocumentMapperParser; import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.mapper.internal.IndexFieldMapper; import org.elasticsearch.test.ElasticsearchSingleNodeTest; -import org.junit.Test; import static org.hamcrest.Matchers.*; @@ -127,7 +125,7 @@ public class IndexTypeMapperTests extends ElasticsearchSingleNodeTest { .field("enabled", true) .field("store", "yes").endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); IndexFieldMapper indexMapper = docMapper.rootMapper(IndexFieldMapper.class); assertThat(indexMapper.enabled(), equalTo(true)); diff --git a/src/test/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapperTests.java b/src/test/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapperTests.java index de606371e1e..8da6e71c135 100644 --- a/src/test/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapperTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapperTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.mapper.internal; import org.apache.lucene.index.IndexOptions; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -129,7 +128,7 @@ public class FieldNamesFieldMapperTests extends ElasticsearchSingleNodeTest { public void testPre13Disabled() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_2_4.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_2_4.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); FieldNamesFieldMapper fieldNamesMapper = docMapper.rootMapper(FieldNamesFieldMapper.class); assertFalse(fieldNamesMapper.enabled()); @@ -141,7 +140,7 @@ public class FieldNamesFieldMapperTests extends ElasticsearchSingleNodeTest { .startObject("_field_names").field("index", "no").endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); FieldNamesFieldMapper fieldNamesMapper = docMapper.rootMapper(FieldNamesFieldMapper.class); assertFalse(fieldNamesMapper.enabled()); @@ -160,7 +159,7 @@ public class FieldNamesFieldMapperTests extends ElasticsearchSingleNodeTest { .startObject("_field_names").field("store", "yes").endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); FieldNamesFieldMapper fieldNamesMapper = docMapper.rootMapper(FieldNamesFieldMapper.class); assertTrue(fieldNamesMapper.fieldType().stored()); diff --git a/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java index 8923d95f405..510c002cafc 100644 --- a/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/ip/SimpleIpMappingTests.java @@ -27,7 +27,7 @@ import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.test.ElasticsearchSingleNodeTest; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; diff --git a/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java b/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java index 34cdc5f601d..ec8b3b077d5 100644 --- a/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/null_value/NullValueTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.index.mapper.null_value; */ -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.IndexService; @@ -35,7 +35,7 @@ public class NullValueTests extends ElasticsearchSingleNodeTest { @Test public void testNullNull_Value() throws Exception { - IndexService indexService = createIndex("test", ImmutableSettings.settingsBuilder().build()); + IndexService indexService = createIndex("test", Settings.settingsBuilder().build()); String[] typesToTest = {"integer", "long", "double", "float", "short", "date", "ip", "string", "boolean", "byte"}; for (String type : typesToTest) { diff --git a/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java b/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java index d7a20dbb226..28be8bd2c9d 100644 --- a/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/numeric/SimpleNumericTests.java @@ -43,7 +43,7 @@ import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.notNullValue; diff --git a/src/test/java/org/elasticsearch/index/mapper/parent/ParentMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/parent/ParentMappingTests.java index 099a12c579e..e748510ee36 100644 --- a/src/test/java/org/elasticsearch/index/mapper/parent/ParentMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/parent/ParentMappingTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.mapper.parent; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -28,9 +27,7 @@ import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.mapper.SourceToParse; import org.elasticsearch.index.mapper.Uid; import org.elasticsearch.test.ElasticsearchSingleNodeTest; -import org.junit.Test; -import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; public class ParentMappingTests extends ElasticsearchSingleNodeTest { @@ -56,7 +53,7 @@ public class ParentMappingTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_parent").field("type", "p_type").endObject() .endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); ParsedDocument doc = docMapper.parse(SourceToParse.source(XContentFactory.jsonBuilder() diff --git a/src/test/java/org/elasticsearch/index/mapper/routing/RoutingTypeMapperTests.java b/src/test/java/org/elasticsearch/index/mapper/routing/RoutingTypeMapperTests.java index 8fd9a8ed3bd..d4acc74dbb6 100644 --- a/src/test/java/org/elasticsearch/index/mapper/routing/RoutingTypeMapperTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/routing/RoutingTypeMapperTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -35,7 +34,6 @@ import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.mapper.SourceToParse; import org.elasticsearch.test.ElasticsearchSingleNodeTest; -import org.junit.Test; import java.util.Map; @@ -65,7 +63,7 @@ public class RoutingTypeMapperTests extends ElasticsearchSingleNodeTest { .field("index", "no") .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); assertThat(docMapper.routingFieldMapper().fieldType().stored(), equalTo(false)); assertEquals(IndexOptions.NONE, docMapper.routingFieldMapper().fieldType().indexOptions()); @@ -75,7 +73,7 @@ public class RoutingTypeMapperTests extends ElasticsearchSingleNodeTest { String enabledMapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_routing").field("store", "no").field("index", "no").endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper enabledMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(enabledMapping); XContentBuilder builder = JsonXContent.contentBuilder().startObject(); @@ -95,7 +93,7 @@ public class RoutingTypeMapperTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_routing").field("path", "custom_routing").endObject() .endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); XContentBuilder doc = XContentFactory.jsonBuilder().startObject().field("custom_routing", "routing_value").endObject(); @@ -108,7 +106,7 @@ public class RoutingTypeMapperTests extends ElasticsearchSingleNodeTest { public void testIncludeInObjectBackcompat() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); XContentBuilder doc = XContentFactory.jsonBuilder().startObject().field("_timestamp", 2000000).endObject(); diff --git a/src/test/java/org/elasticsearch/index/mapper/simple/SimpleMapperTests.java b/src/test/java/org/elasticsearch/index/mapper/simple/SimpleMapperTests.java index b94d189d39a..5ab240857b3 100644 --- a/src/test/java/org/elasticsearch/index/mapper/simple/SimpleMapperTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/simple/SimpleMapperTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.mapper.simple; import com.google.common.base.Charsets; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.ParseContext.Document; diff --git a/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingTests.java index 4b560ae011b..80ce787e55b 100644 --- a/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.index.mapper.size; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -30,7 +29,6 @@ import org.elasticsearch.index.mapper.DocumentMapperParser; import org.elasticsearch.index.mapper.ParsedDocument; import org.elasticsearch.index.mapper.SourceToParse; import org.elasticsearch.test.ElasticsearchSingleNodeTest; -import org.junit.Test; import static org.hamcrest.Matchers.*; @@ -57,7 +55,7 @@ public class SizeMappingTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_size").field("enabled", true).field("store", "yes").endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); BytesReference source = XContentFactory.jsonBuilder() diff --git a/src/test/java/org/elasticsearch/index/mapper/source/CompressSourceMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/source/CompressSourceMappingTests.java index bef5fa044bc..90da64b3fbd 100644 --- a/src/test/java/org/elasticsearch/index/mapper/source/CompressSourceMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/source/CompressSourceMappingTests.java @@ -23,7 +23,6 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.compress.CompressorFactory; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -37,7 +36,7 @@ import static org.hamcrest.Matchers.equalTo; * */ public class CompressSourceMappingTests extends ElasticsearchSingleNodeTest { - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); @Test public void testCompressDisabled() throws Exception { diff --git a/src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java index f41a94ab132..0760255c2a8 100644 --- a/src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/source/DefaultSourceMappingTests.java @@ -25,15 +25,11 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.compress.CompressedString; import org.elasticsearch.common.compress.CompressorFactory; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.mapper.*; -import org.elasticsearch.index.IndexService; import org.elasticsearch.test.ElasticsearchSingleNodeTest; -import org.junit.Test; import java.io.IOException; import java.util.ArrayList; @@ -92,7 +88,7 @@ public class DefaultSourceMappingTests extends ElasticsearchSingleNodeTest { .startObject("_source").field("format", "json").field("compress", true).endObject() .endObject().endObject().string(); - Settings backcompatSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings backcompatSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapperParser parser = createIndex("test", backcompatSettings).mapperService().documentMapperParser(); DocumentMapper documentMapper = parser.parse(mapping); ParsedDocument doc = documentMapper.parse("type", "1", XContentFactory.jsonBuilder().startObject() diff --git a/src/test/java/org/elasticsearch/index/mapper/string/SimpleStringMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/string/SimpleStringMappingTests.java index 9baa2ca6afc..e57d191032c 100644 --- a/src/test/java/org/elasticsearch/index/mapper/string/SimpleStringMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/string/SimpleStringMappingTests.java @@ -30,7 +30,6 @@ import org.apache.lucene.index.Term; import org.apache.lucene.queries.TermsQuery; import org.apache.lucene.search.TermQuery; import org.elasticsearch.common.lucene.search.Queries; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -63,7 +62,7 @@ import static org.hamcrest.Matchers.nullValue; */ public class SimpleStringMappingTests extends ElasticsearchSingleNodeTest { - private static Settings DOC_VALUES_SETTINGS = ImmutableSettings.builder().put(FieldDataType.FORMAT_KEY, FieldDataType.DOC_VALUES_FORMAT_VALUE).build(); + private static Settings DOC_VALUES_SETTINGS = Settings.builder().put(FieldDataType.FORMAT_KEY, FieldDataType.DOC_VALUES_FORMAT_VALUE).build(); IndexService indexService; DocumentMapperParser parser; diff --git a/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java index 471563af05d..e415ea76c07 100644 --- a/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/timestamp/TimestampMappingTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.common.compress.CompressedString; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.joda.Joda; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -109,7 +108,7 @@ public class TimestampMappingTests extends ElasticsearchSingleNodeTest { for (String mapping : Arrays.asList( XContentFactory.jsonBuilder().startObject().startObject("type").endObject().string(), XContentFactory.jsonBuilder().startObject().startObject("type").startObject("_timestamp").endObject().endObject().string())) { - DocumentMapper docMapper = createIndex("test", ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build()).mapperService().documentMapperParser().parse(mapping); + DocumentMapper docMapper = createIndex("test", Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build()).mapperService().documentMapperParser().parse(mapping); assertThat(docMapper.timestampFieldMapper().enabled(), equalTo(TimestampFieldMapper.Defaults.ENABLED.enabled)); assertThat(docMapper.timestampFieldMapper().fieldType().stored(), equalTo(version.onOrAfter(Version.V_2_0_0) ? true : false)); assertThat(docMapper.timestampFieldMapper().fieldType().indexOptions(), equalTo(TimestampFieldMapper.Defaults.FIELD_TYPE.indexOptions())); @@ -504,7 +503,7 @@ public class TimestampMappingTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_timestamp").field("enabled", randomBoolean()).startObject("fielddata").field("loading", "lazy").field("format", "doc_values").endObject().field("store", "yes").endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapperParser parser = createIndex("test", indexSettings).mapperService().documentMapperParser(); DocumentMapper docMapper = parser.parse(mapping); @@ -571,7 +570,7 @@ public class TimestampMappingTests extends ElasticsearchSingleNodeTest { .field("default", "1970-01-01") .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapperParser parser = createIndex("test", indexSettings).mapperService().documentMapperParser(); DocumentMapper docMapper = parser.parse(mapping); @@ -764,7 +763,7 @@ public class TimestampMappingTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_timestamp").field("enabled", true).field("default", "1970").field("format", "YYYY").endObject() .endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); XContentBuilder doc = XContentFactory.jsonBuilder().startObject().field("_timestamp", 2000000).endObject(); diff --git a/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java index c858e9437eb..dca10c636fe 100644 --- a/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/ttl/TTLMappingTests.java @@ -28,7 +28,6 @@ import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.compress.CompressedString; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -95,7 +94,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { .field("enabled", "yes").field("store", "no") .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", indexSettings).mapperService().documentMapperParser().parse(mapping); assertThat(docMapper.TTLFieldMapper().enabled(), equalTo(true)); assertThat(docMapper.TTLFieldMapper().fieldType().stored(), equalTo(true)); // store was never serialized, so it was always lost @@ -195,7 +194,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { @Test public void testNoConflictIfNothingSetAndDisabledLater() throws Exception { - IndexService indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type"); + IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type"); XContentBuilder mappingWithTtlDisabled = getMappingWithTtlDisabled("7d"); MergeResult mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithTtlDisabled.string()), true).mapping(), randomBoolean()); assertFalse(mergeResult.hasConflicts()); @@ -203,7 +202,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { @Test public void testNoConflictIfNothingSetAndEnabledLater() throws Exception { - IndexService indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type"); + IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type"); XContentBuilder mappingWithTtlEnabled = getMappingWithTtlEnabled("7d"); MergeResult mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithTtlEnabled.string()), true).mapping(), randomBoolean()); assertFalse(mergeResult.hasConflicts()); @@ -212,7 +211,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { @Test public void testMergeWithOnlyDefaultSet() throws Exception { XContentBuilder mappingWithTtlEnabled = getMappingWithTtlEnabled("7d"); - IndexService indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type", mappingWithTtlEnabled); + IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithTtlEnabled); XContentBuilder mappingWithOnlyDefaultSet = getMappingWithOnlyTtlDefaultSet("6m"); MergeResult mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithOnlyDefaultSet.string()), true).mapping(), false); assertFalse(mergeResult.hasConflicts()); @@ -223,7 +222,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { @Test public void testMergeWithOnlyDefaultSetTtlDisabled() throws Exception { XContentBuilder mappingWithTtlEnabled = getMappingWithTtlDisabled("7d"); - IndexService indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type", mappingWithTtlEnabled); + IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithTtlEnabled); CompressedString mappingAfterCreation = indexService.mapperService().documentMapper("type").mappingSource(); assertThat(mappingAfterCreation, equalTo(new CompressedString("{\"type\":{\"_ttl\":{\"enabled\":false},\"properties\":{\"field\":{\"type\":\"string\"}}}}"))); XContentBuilder mappingWithOnlyDefaultSet = getMappingWithOnlyTtlDefaultSet("6m"); @@ -238,7 +237,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { //check if default ttl changed when simulate set to true XContentBuilder mappingWithTtl = getMappingWithTtlEnabled("6d"); - IndexService indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type", mappingWithTtl); + IndexService indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithTtl); CompressedString mappingBeforeMerge = indexService.mapperService().documentMapper("type").mappingSource(); XContentBuilder mappingWithTtlDifferentDefault = getMappingWithTtlEnabled("7d"); MergeResult mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithTtlDifferentDefault.string()), true).mapping(), true); @@ -250,7 +249,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { client().admin().indices().prepareDelete("testindex").get(); // check if enabled changed when simulate set to true XContentBuilder mappingWithoutTtl = getMappingWithTtlDisabled(); - indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type", mappingWithoutTtl); + indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithoutTtl); mappingBeforeMerge = indexService.mapperService().documentMapper("type").mappingSource(); XContentBuilder mappingWithTtlEnabled = getMappingWithTtlEnabled(); mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithTtlEnabled.string()), true).mapping(), true); @@ -262,7 +261,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { client().admin().indices().prepareDelete("testindex").get(); // check if enabled changed when simulate set to true mappingWithoutTtl = getMappingWithTtlDisabled("6d"); - indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type", mappingWithoutTtl); + indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithoutTtl); mappingBeforeMerge = indexService.mapperService().documentMapper("type").mappingSource(); mappingWithTtlEnabled = getMappingWithTtlEnabled("7d"); mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithTtlEnabled.string()), true).mapping(), true); @@ -274,7 +273,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { client().admin().indices().prepareDelete("testindex").get(); // check if switching simulate flag off works mappingWithoutTtl = getMappingWithTtlDisabled("6d"); - indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type", mappingWithoutTtl); + indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type", mappingWithoutTtl); mappingWithTtlEnabled = getMappingWithTtlEnabled("7d"); mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithTtlEnabled.string()), true).mapping(), false); assertFalse(mergeResult.hasConflicts()); @@ -284,7 +283,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { client().admin().indices().prepareDelete("testindex").get(); // check if switching simulate flag off works if nothing was applied in the beginning - indexService = createIndex("testindex", ImmutableSettings.settingsBuilder().build(), "type"); + indexService = createIndex("testindex", Settings.settingsBuilder().build(), "type"); mappingWithTtlEnabled = getMappingWithTtlEnabled("7d"); mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingWithTtlEnabled.string()), true).mapping(), false); assertFalse(mergeResult.hasConflicts()); @@ -298,7 +297,7 @@ public class TTLMappingTests extends ElasticsearchSingleNodeTest { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_ttl").field("enabled", true).endObject() .endObject().endObject().string(); - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); DocumentMapper docMapper = createIndex("test", settings).mapperService().documentMapperParser().parse(mapping); XContentBuilder doc = XContentFactory.jsonBuilder().startObject().field("_ttl", "2d").endObject(); diff --git a/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java b/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java index 9dc5900187c..1090f6df85a 100644 --- a/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/update/UpdateMappingTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.index.mapper.update; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.common.compress.CompressedString; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -78,7 +78,7 @@ public class UpdateMappingTests extends ElasticsearchSingleNodeTest { } private void testNoConflictWhileMergingAndMappingChanged(XContentBuilder mapping, XContentBuilder mappingUpdate, XContentBuilder expectedMapping) throws IOException { - IndexService indexService = createIndex("test", ImmutableSettings.settingsBuilder().build(), "type", mapping); + IndexService indexService = createIndex("test", Settings.settingsBuilder().build(), "type", mapping); // simulate like in MetaDataMappingService#putMapping MergeResult mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingUpdate.bytes()), true).mapping(), false); // assure we have no conflicts @@ -101,7 +101,7 @@ public class UpdateMappingTests extends ElasticsearchSingleNodeTest { } protected void testConflictWhileMergingAndMappingUnchanged(XContentBuilder mapping, XContentBuilder mappingUpdate) throws IOException { - IndexService indexService = createIndex("test", ImmutableSettings.settingsBuilder().build(), "type", mapping); + IndexService indexService = createIndex("test", Settings.settingsBuilder().build(), "type", mapping); CompressedString mappingBeforeUpdate = indexService.mapperService().documentMapper("type").mappingSource(); // simulate like in MetaDataMappingService#putMapping MergeResult mergeResult = indexService.mapperService().documentMapper("type").merge(indexService.mapperService().parse("type", new CompressedString(mappingUpdate.bytes()), true).mapping(), true); @@ -114,7 +114,7 @@ public class UpdateMappingTests extends ElasticsearchSingleNodeTest { @Test public void testIndexFieldParsing() throws IOException { - IndexService indexService = createIndex("test", ImmutableSettings.settingsBuilder().build()); + IndexService indexService = createIndex("test", Settings.settingsBuilder().build()); XContentBuilder indexMapping = XContentFactory.jsonBuilder(); boolean enabled = randomBoolean(); indexMapping.startObject() @@ -132,7 +132,7 @@ public class UpdateMappingTests extends ElasticsearchSingleNodeTest { @Test public void testTimestampParsing() throws IOException { - IndexService indexService = createIndex("test", ImmutableSettings.settingsBuilder().build()); + IndexService indexService = createIndex("test", Settings.settingsBuilder().build()); XContentBuilder indexMapping = XContentFactory.jsonBuilder(); boolean enabled = randomBoolean(); indexMapping.startObject() @@ -158,7 +158,7 @@ public class UpdateMappingTests extends ElasticsearchSingleNodeTest { @Test public void testSizeParsing() throws IOException { - IndexService indexService = createIndex("test", ImmutableSettings.settingsBuilder().build()); + IndexService indexService = createIndex("test", Settings.settingsBuilder().build()); XContentBuilder indexMapping = XContentFactory.jsonBuilder(); boolean enabled = randomBoolean(); indexMapping.startObject() @@ -177,7 +177,7 @@ public class UpdateMappingTests extends ElasticsearchSingleNodeTest { @Test public void testSizeTimestampIndexParsing() throws IOException { - IndexService indexService = createIndex("test", ImmutableSettings.settingsBuilder().build()); + IndexService indexService = createIndex("test", Settings.settingsBuilder().build()); String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/update/default_mapping_with_disabled_root_types.json"); DocumentMapper documentMapper = indexService.mapperService().parse("type", new CompressedString(mapping), true); assertThat(documentMapper.mappingSource().string(), equalTo(mapping)); @@ -187,8 +187,8 @@ public class UpdateMappingTests extends ElasticsearchSingleNodeTest { @Test public void testDefaultApplied() throws IOException { - createIndex("test1", ImmutableSettings.settingsBuilder().build()); - createIndex("test2", ImmutableSettings.settingsBuilder().build()); + createIndex("test1", Settings.settingsBuilder().build()); + createIndex("test2", Settings.settingsBuilder().build()); XContentBuilder defaultMapping = XContentFactory.jsonBuilder().startObject() .startObject(MapperService.DEFAULT_MAPPING).startObject("_size").field("enabled", true).endObject().endObject() .endObject(); diff --git a/src/test/java/org/elasticsearch/index/merge/policy/MergePolicySettingsTest.java b/src/test/java/org/elasticsearch/index/merge/policy/MergePolicySettingsTest.java index 00cca381db2..584a07df2ec 100644 --- a/src/test/java/org/elasticsearch/index/merge/policy/MergePolicySettingsTest.java +++ b/src/test/java/org/elasticsearch/index/merge/policy/MergePolicySettingsTest.java @@ -22,7 +22,6 @@ import org.apache.lucene.index.LogByteSizeMergePolicy; import org.apache.lucene.index.LogDocMergePolicy; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -37,7 +36,7 @@ import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.hamcrest.Matchers.equalTo; public class MergePolicySettingsTest extends ElasticsearchTestCase { @@ -163,19 +162,19 @@ public class MergePolicySettingsTest extends ElasticsearchTestCase { LogDocMergePolicyProvider mp = new LogDocMergePolicyProvider(createStore(EMPTY_SETTINGS), service); assertEquals(mp.getMergePolicy().getMaxMergeDocs(), LogDocMergePolicy.DEFAULT_MAX_MERGE_DOCS); - service.refreshSettings(ImmutableSettings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, LogDocMergePolicy.DEFAULT_MAX_MERGE_DOCS / 2).build()); + service.refreshSettings(Settings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, LogDocMergePolicy.DEFAULT_MAX_MERGE_DOCS / 2).build()); assertEquals(mp.getMergePolicy().getMaxMergeDocs(), LogDocMergePolicy.DEFAULT_MAX_MERGE_DOCS / 2); assertEquals(mp.getMergePolicy().getMinMergeDocs(), LogDocMergePolicy.DEFAULT_MIN_MERGE_DOCS); - service.refreshSettings(ImmutableSettings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MIN_MERGE_DOCS, LogDocMergePolicy.DEFAULT_MIN_MERGE_DOCS / 2).build()); + service.refreshSettings(Settings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MIN_MERGE_DOCS, LogDocMergePolicy.DEFAULT_MIN_MERGE_DOCS / 2).build()); assertEquals(mp.getMergePolicy().getMinMergeDocs(), LogDocMergePolicy.DEFAULT_MIN_MERGE_DOCS / 2); assertTrue(mp.getMergePolicy().getCalibrateSizeByDeletes()); - service.refreshSettings(ImmutableSettings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_CALIBRATE_SIZE_BY_DELETES, false).build()); + service.refreshSettings(Settings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_CALIBRATE_SIZE_BY_DELETES, false).build()); assertFalse(mp.getMergePolicy().getCalibrateSizeByDeletes()); assertEquals(mp.getMergePolicy().getMergeFactor(), LogDocMergePolicy.DEFAULT_MERGE_FACTOR); - service.refreshSettings(ImmutableSettings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, LogDocMergePolicy.DEFAULT_MERGE_FACTOR * 2).build()); + service.refreshSettings(Settings.builder().put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, LogDocMergePolicy.DEFAULT_MERGE_FACTOR * 2).build()); assertEquals(mp.getMergePolicy().getMergeFactor(), LogDocMergePolicy.DEFAULT_MERGE_FACTOR * 2); service.refreshSettings(EMPTY_SETTINGS); // update without the settings and see if we stick to the values @@ -186,7 +185,7 @@ public class MergePolicySettingsTest extends ElasticsearchTestCase { service = new IndexSettingsService(new Index("test"), EMPTY_SETTINGS); - mp = new LogDocMergePolicyProvider(createStore(ImmutableSettings.builder() + mp = new LogDocMergePolicyProvider(createStore(Settings.builder() .put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS / 2) .put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR / 2) .put(LogDocMergePolicyProvider.INDEX_MERGE_POLICY_CALIBRATE_SIZE_BY_DELETES, false) @@ -205,23 +204,23 @@ public class MergePolicySettingsTest extends ElasticsearchTestCase { LogByteSizeMergePolicyProvider mp = new LogByteSizeMergePolicyProvider(createStore(EMPTY_SETTINGS), service); assertEquals(mp.getMergePolicy().getMaxMergeMB(), LogByteSizeMergePolicyProvider.DEFAULT_MAX_MERGE_SIZE.mbFrac(), 0.0d); - service.refreshSettings(ImmutableSettings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_SIZE, new ByteSizeValue(LogByteSizeMergePolicyProvider.DEFAULT_MAX_MERGE_SIZE.mb() / 2, ByteSizeUnit.MB)).build()); + service.refreshSettings(Settings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_SIZE, new ByteSizeValue(LogByteSizeMergePolicyProvider.DEFAULT_MAX_MERGE_SIZE.mb() / 2, ByteSizeUnit.MB)).build()); assertEquals(mp.getMergePolicy().getMaxMergeMB(), new ByteSizeValue(LogByteSizeMergePolicyProvider.DEFAULT_MAX_MERGE_SIZE.mb() / 2, ByteSizeUnit.MB).mbFrac(), 0.0d); assertEquals(mp.getMergePolicy().getMinMergeMB(), LogByteSizeMergePolicyProvider.DEFAULT_MIN_MERGE_SIZE.mbFrac(), 0.0d); - service.refreshSettings(ImmutableSettings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MIN_MERGE_SIZE, new ByteSizeValue(LogByteSizeMergePolicyProvider.DEFAULT_MIN_MERGE_SIZE.mb() + 1, ByteSizeUnit.MB)).build()); + service.refreshSettings(Settings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MIN_MERGE_SIZE, new ByteSizeValue(LogByteSizeMergePolicyProvider.DEFAULT_MIN_MERGE_SIZE.mb() + 1, ByteSizeUnit.MB)).build()); assertEquals(mp.getMergePolicy().getMinMergeMB(), new ByteSizeValue(LogByteSizeMergePolicyProvider.DEFAULT_MIN_MERGE_SIZE.mb() + 1, ByteSizeUnit.MB).mbFrac(), 0.0d); assertTrue(mp.getMergePolicy().getCalibrateSizeByDeletes()); - service.refreshSettings(ImmutableSettings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_CALIBRATE_SIZE_BY_DELETES, false).build()); + service.refreshSettings(Settings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_CALIBRATE_SIZE_BY_DELETES, false).build()); assertFalse(mp.getMergePolicy().getCalibrateSizeByDeletes()); assertEquals(mp.getMergePolicy().getMergeFactor(), LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR); - service.refreshSettings(ImmutableSettings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR / 2).build()); + service.refreshSettings(Settings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR / 2).build()); assertEquals(mp.getMergePolicy().getMergeFactor(), LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR / 2); assertEquals(mp.getMergePolicy().getMaxMergeDocs(), LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS); - service.refreshSettings(ImmutableSettings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS / 2).build()); + service.refreshSettings(Settings.builder().put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS / 2).build()); assertEquals(mp.getMergePolicy().getMaxMergeDocs(), LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS / 2); service.refreshSettings(EMPTY_SETTINGS); // update without the settings and see if we stick to the values @@ -233,7 +232,7 @@ public class MergePolicySettingsTest extends ElasticsearchTestCase { service = new IndexSettingsService(new Index("test"), EMPTY_SETTINGS); - mp = new LogByteSizeMergePolicyProvider(createStore(ImmutableSettings.builder() + mp = new LogByteSizeMergePolicyProvider(createStore(Settings.builder() .put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_DOCS, LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS * 2) .put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MERGE_FACTOR, LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR * 2) .put(LogByteSizeMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_SIZE, new ByteSizeValue(LogByteSizeMergePolicyProvider.DEFAULT_MAX_MERGE_SIZE.mb() / 2, ByteSizeUnit.MB)) @@ -255,31 +254,31 @@ public class MergePolicySettingsTest extends ElasticsearchTestCase { assertThat(mp.getMergePolicy().getNoCFSRatio(), equalTo(0.1)); assertEquals(mp.getMergePolicy().getForceMergeDeletesPctAllowed(), TieredMergePolicyProvider.DEFAULT_EXPUNGE_DELETES_ALLOWED, 0.0d); - service.refreshSettings(ImmutableSettings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_EXPUNGE_DELETES_ALLOWED, TieredMergePolicyProvider.DEFAULT_EXPUNGE_DELETES_ALLOWED + 1.0d).build()); + service.refreshSettings(Settings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_EXPUNGE_DELETES_ALLOWED, TieredMergePolicyProvider.DEFAULT_EXPUNGE_DELETES_ALLOWED + 1.0d).build()); assertEquals(mp.getMergePolicy().getForceMergeDeletesPctAllowed(), TieredMergePolicyProvider.DEFAULT_EXPUNGE_DELETES_ALLOWED + 1.0d, 0.0d); assertEquals(mp.getMergePolicy().getFloorSegmentMB(), TieredMergePolicyProvider.DEFAULT_FLOOR_SEGMENT.mbFrac(), 0); - service.refreshSettings(ImmutableSettings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_FLOOR_SEGMENT, new ByteSizeValue(TieredMergePolicyProvider.DEFAULT_FLOOR_SEGMENT.mb() + 1, ByteSizeUnit.MB)).build()); + service.refreshSettings(Settings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_FLOOR_SEGMENT, new ByteSizeValue(TieredMergePolicyProvider.DEFAULT_FLOOR_SEGMENT.mb() + 1, ByteSizeUnit.MB)).build()); assertEquals(mp.getMergePolicy().getFloorSegmentMB(), new ByteSizeValue(TieredMergePolicyProvider.DEFAULT_FLOOR_SEGMENT.mb() + 1, ByteSizeUnit.MB).mbFrac(), 0.001); assertEquals(mp.getMergePolicy().getMaxMergeAtOnce(), TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE); - service.refreshSettings(ImmutableSettings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE, TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE -1 ).build()); + service.refreshSettings(Settings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE, TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE -1 ).build()); assertEquals(mp.getMergePolicy().getMaxMergeAtOnce(), TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE-1); assertEquals(mp.getMergePolicy().getMaxMergeAtOnceExplicit(), TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT); - service.refreshSettings(ImmutableSettings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT, TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT -1 ).build()); + service.refreshSettings(Settings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT, TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT -1 ).build()); assertEquals(mp.getMergePolicy().getMaxMergeAtOnceExplicit(), TieredMergePolicyProvider.DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT-1); assertEquals(mp.getMergePolicy().getMaxMergedSegmentMB(), TieredMergePolicyProvider.DEFAULT_MAX_MERGED_SEGMENT.mbFrac(), 0.0001); - service.refreshSettings(ImmutableSettings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGED_SEGMENT, new ByteSizeValue(TieredMergePolicyProvider.DEFAULT_MAX_MERGED_SEGMENT.bytes() + 1)).build()); + service.refreshSettings(Settings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGED_SEGMENT, new ByteSizeValue(TieredMergePolicyProvider.DEFAULT_MAX_MERGED_SEGMENT.bytes() + 1)).build()); assertEquals(mp.getMergePolicy().getMaxMergedSegmentMB(), new ByteSizeValue(TieredMergePolicyProvider.DEFAULT_MAX_MERGED_SEGMENT.bytes() + 1).mbFrac(), 0.0001); assertEquals(mp.getMergePolicy().getReclaimDeletesWeight(), TieredMergePolicyProvider.DEFAULT_RECLAIM_DELETES_WEIGHT, 0); - service.refreshSettings(ImmutableSettings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_RECLAIM_DELETES_WEIGHT, TieredMergePolicyProvider.DEFAULT_RECLAIM_DELETES_WEIGHT + 1 ).build()); + service.refreshSettings(Settings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_RECLAIM_DELETES_WEIGHT, TieredMergePolicyProvider.DEFAULT_RECLAIM_DELETES_WEIGHT + 1 ).build()); assertEquals(mp.getMergePolicy().getReclaimDeletesWeight(), TieredMergePolicyProvider.DEFAULT_RECLAIM_DELETES_WEIGHT + 1, 0); assertEquals(mp.getMergePolicy().getSegmentsPerTier(), TieredMergePolicyProvider.DEFAULT_SEGMENTS_PER_TIER, 0); - service.refreshSettings(ImmutableSettings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_SEGMENTS_PER_TIER, TieredMergePolicyProvider.DEFAULT_SEGMENTS_PER_TIER + 1 ).build()); + service.refreshSettings(Settings.builder().put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_SEGMENTS_PER_TIER, TieredMergePolicyProvider.DEFAULT_SEGMENTS_PER_TIER + 1 ).build()); assertEquals(mp.getMergePolicy().getSegmentsPerTier(), TieredMergePolicyProvider.DEFAULT_SEGMENTS_PER_TIER + 1, 0); service.refreshSettings(EMPTY_SETTINGS); // update without the settings and see if we stick to the values @@ -294,19 +293,19 @@ public class MergePolicySettingsTest extends ElasticsearchTestCase { } public Settings build(String value) { - return ImmutableSettings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); + return Settings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); } public Settings build(double value) { - return ImmutableSettings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); + return Settings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); } public Settings build(int value) { - return ImmutableSettings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); + return Settings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); } public Settings build(boolean value) { - return ImmutableSettings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); + return Settings.builder().put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, value).build(); } protected Store createStore(Settings settings) throws IOException { diff --git a/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java b/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java index 16e3462a7c2..992f1777a2c 100644 --- a/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java +++ b/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java @@ -77,7 +77,6 @@ import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.common.lucene.search.function.BoostScoreFunction; import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery; import org.elasticsearch.common.lucene.search.function.WeightFactorFunction; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.DistanceUnit; import org.elasticsearch.common.unit.Fuzziness; @@ -201,7 +200,7 @@ public class SimpleIndexQueryParserTests extends ElasticsearchSingleNodeTest { @Before public void setup() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.queryparser.query.dummy.type", DummyQueryParser.class) .put("index.cache.filter.type", "none") .put("name", "SimpleIndexQueryParserTests") @@ -1770,7 +1769,7 @@ public class SimpleIndexQueryParserTests extends ElasticsearchSingleNodeTest { private static class MockMoreLikeThisFetchService extends MoreLikeThisFetchService { public MockMoreLikeThisFetchService() { - super(null, ImmutableSettings.Builder.EMPTY_SETTINGS); + super(null, Settings.Builder.EMPTY_SETTINGS); } @Override diff --git a/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTest.java b/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTest.java index f174434c0ce..ec9be8b591f 100644 --- a/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTest.java +++ b/src/test/java/org/elasticsearch/index/query/TemplateQueryParserTest.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.index.query; -import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.Query; import org.elasticsearch.Version; @@ -28,7 +27,6 @@ import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.inject.util.Providers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.common.xcontent.XContentFactory; @@ -66,7 +64,7 @@ public class TemplateQueryParserTest extends ElasticsearchTestCase { @Before public void setup() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.home", createTempDir().toString()) .put("path.conf", this.getDataPath("config")) .put("name", getClass().getName()) diff --git a/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java b/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java index 99af5670960..dd1c61b64c1 100644 --- a/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java +++ b/src/test/java/org/elasticsearch/index/query/TemplateQueryTest.java @@ -44,7 +44,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/index/query/guice/IndexQueryParserModuleTests.java b/src/test/java/org/elasticsearch/index/query/guice/IndexQueryParserModuleTests.java index 4f218ed29bc..a26e233caf7 100644 --- a/src/test/java/org/elasticsearch/index/query/guice/IndexQueryParserModuleTests.java +++ b/src/test/java/org/elasticsearch/index/query/guice/IndexQueryParserModuleTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.index.query.IndexQueryParserService; import org.elasticsearch.test.ElasticsearchSingleNodeTest; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; /** diff --git a/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPlugin2Tests.java b/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPlugin2Tests.java index 745f79144c9..4e4420ca4af 100644 --- a/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPlugin2Tests.java +++ b/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPlugin2Tests.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.inject.util.Providers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; @@ -58,7 +57,7 @@ public class IndexQueryParserPlugin2Tests extends ElasticsearchTestCase { @Test public void testCustomInjection() throws InterruptedException { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("name", "testCustomInjection") .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir()).build(); diff --git a/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPluginTests.java b/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPluginTests.java index dfb29a3f60d..57a0d99741e 100644 --- a/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPluginTests.java +++ b/src/test/java/org/elasticsearch/index/query/plugin/IndexQueryParserPluginTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; import org.elasticsearch.common.inject.util.Providers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; @@ -58,7 +57,7 @@ public class IndexQueryParserPluginTests extends ElasticsearchTestCase { @Test public void testCustomInjection() throws InterruptedException { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("name", "testCustomInjection") .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir()).build(); diff --git a/src/test/java/org/elasticsearch/index/search/nested/NestedSortingTests.java b/src/test/java/org/elasticsearch/index/search/nested/NestedSortingTests.java index e4885727434..287170dad39 100644 --- a/src/test/java/org/elasticsearch/index/search/nested/NestedSortingTests.java +++ b/src/test/java/org/elasticsearch/index/search/nested/NestedSortingTests.java @@ -45,7 +45,7 @@ import org.apache.lucene.search.join.ToParentBlockJoinQuery; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.TestUtil; import org.elasticsearch.common.lucene.search.Queries; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.AbstractFieldDataTests; import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.fielddata.IndexFieldData; @@ -69,7 +69,7 @@ public class NestedSortingTests extends AbstractFieldDataTests { @Override protected FieldDataType getFieldDataType() { - return new FieldDataType("string", ImmutableSettings.builder().put("format", "paged_bytes")); + return new FieldDataType("string", Settings.builder().put("format", "paged_bytes")); } @Test diff --git a/src/test/java/org/elasticsearch/index/shard/IndexShardModuleTests.java b/src/test/java/org/elasticsearch/index/shard/IndexShardModuleTests.java index dff682569a6..b5ac0cce405 100644 --- a/src/test/java/org/elasticsearch/index/shard/IndexShardModuleTests.java +++ b/src/test/java/org/elasticsearch/index/shard/IndexShardModuleTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.shard; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -31,12 +30,12 @@ public class IndexShardModuleTests extends ElasticsearchTestCase { @Test public void testDetermineShadowEngineShouldBeUsed() { ShardId shardId = new ShardId("myindex", 0); - Settings regularSettings = ImmutableSettings.builder() + Settings regularSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .build(); - Settings shadowSettings = ImmutableSettings.builder() + Settings shadowSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 2) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put(IndexMetaData.SETTING_SHADOW_REPLICAS, true) diff --git a/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java index 0ecc99d923b..a9762e28e42 100644 --- a/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java +++ b/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.cluster.routing.MutableShardRouting; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.ShardLock; import org.elasticsearch.index.IndexService; @@ -45,7 +45,7 @@ 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; import static org.hamcrest.Matchers.equalTo; @@ -110,7 +110,7 @@ public class IndexShardTests extends ElasticsearchSingleNodeTest { logger.info("--> paths: [{}]", shardPaths); // Should not be able to acquire the lock because it's already open try { - NodeEnvironment.acquireFSLockForPaths(ImmutableSettings.EMPTY, shardPaths); + NodeEnvironment.acquireFSLockForPaths(Settings.EMPTY, shardPaths); fail("should not have been able to acquire the lock"); } catch (ElasticsearchException e) { assertTrue("msg: " + e.getMessage(), e.getMessage().contains("unable to acquire write.lock")); @@ -120,7 +120,7 @@ public class IndexShardTests extends ElasticsearchSingleNodeTest { // we're green to delete the shard's directory) ShardLock sLock = new DummyShardLock(new ShardId("test", 0)); try { - env.deleteShardDirectoryUnderLock(sLock, ImmutableSettings.builder().build()); + env.deleteShardDirectoryUnderLock(sLock, Settings.builder().build()); fail("should not have been able to delete the directory"); } catch (ElasticsearchException e) { assertTrue("msg: " + e.getMessage(), e.getMessage().contains("unable to acquire write.lock")); @@ -232,7 +232,7 @@ public class IndexShardTests extends ElasticsearchSingleNodeTest { @Test public void testDeleteIndexDecreasesCounter() throws InterruptedException, ExecutionException, IOException { - assertAcked(client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)).get()); + assertAcked(client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)).get()); ensureGreen("test"); IndicesService indicesService = getInstanceFromNode(IndicesService.class); IndexService indexService = indicesService.indexServiceSafe("test"); @@ -249,7 +249,7 @@ public class IndexShardTests extends ElasticsearchSingleNodeTest { @Test public void testIndexShardCounter() throws InterruptedException, ExecutionException, IOException { - assertAcked(client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)).get()); + assertAcked(client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0)).get()); ensureGreen("test"); IndicesService indicesService = getInstanceFromNode(IndicesService.class); IndexService indexService = indicesService.indexServiceSafe("test"); diff --git a/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java b/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java index ccf87f2efef..6186d8930bd 100644 --- a/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java +++ b/src/test/java/org/elasticsearch/index/shard/ShardPathTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.shard; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.test.ElasticsearchTestCase; @@ -28,7 +27,7 @@ import org.junit.Test; import java.io.IOException; import java.nio.file.Path; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** */ @@ -36,7 +35,7 @@ public class ShardPathTests extends ElasticsearchTestCase { public void testLoadShardPath() throws IOException { try (final NodeEnvironment env = newNodeEnvironment(settingsBuilder().build())) { - ImmutableSettings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_UUID, "0xDEADBEEF"); + Settings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_UUID, "0xDEADBEEF"); Settings settings = builder.build(); ShardId shardId = new ShardId("foo", 0); Path[] paths = env.availableShardPaths(shardId); @@ -54,7 +53,7 @@ public class ShardPathTests extends ElasticsearchTestCase { @Test(expected = IllegalStateException.class) public void testFailLoadShardPathOnMultiState() throws IOException { try (final NodeEnvironment env = newNodeEnvironment(settingsBuilder().build())) { - ImmutableSettings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_UUID, "0xDEADBEEF"); + Settings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_UUID, "0xDEADBEEF"); Settings settings = builder.build(); ShardId shardId = new ShardId("foo", 0); Path[] paths = env.availableShardPaths(shardId); @@ -68,7 +67,7 @@ public class ShardPathTests extends ElasticsearchTestCase { @Test(expected = IllegalStateException.class) public void testFailLoadShardPathIndexUUIDMissmatch() throws IOException { try (final NodeEnvironment env = newNodeEnvironment(settingsBuilder().build())) { - ImmutableSettings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_UUID, "foobar"); + Settings.Builder builder = settingsBuilder().put(IndexMetaData.SETTING_UUID, "foobar"); Settings settings = builder.build(); ShardId shardId = new ShardId("foo", 0); Path[] paths = env.availableShardPaths(shardId); diff --git a/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java b/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java index 56c6aa6891a..c2c98553bbf 100644 --- a/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java +++ b/src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.similarity; import org.apache.lucene.search.similarities.*; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.DocumentMapper; @@ -51,7 +50,7 @@ public class SimilarityTests extends ElasticsearchSingleNodeTest { .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.settingsBuilder() + Settings indexSettings = Settings.settingsBuilder() .put("index.similarity.my_similarity.type", "default") .put("index.similarity.my_similarity.discount_overlaps", false) .build(); @@ -71,7 +70,7 @@ public class SimilarityTests extends ElasticsearchSingleNodeTest { .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.settingsBuilder() + Settings indexSettings = Settings.settingsBuilder() .put("index.similarity.my_similarity.type", "BM25") .put("index.similarity.my_similarity.k1", 2.0f) .put("index.similarity.my_similarity.b", 1.5f) @@ -95,7 +94,7 @@ public class SimilarityTests extends ElasticsearchSingleNodeTest { .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.settingsBuilder() + Settings indexSettings = Settings.settingsBuilder() .put("index.similarity.my_similarity.type", "DFR") .put("index.similarity.my_similarity.basic_model", "g") .put("index.similarity.my_similarity.after_effect", "l") @@ -121,7 +120,7 @@ public class SimilarityTests extends ElasticsearchSingleNodeTest { .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.settingsBuilder() + Settings indexSettings = Settings.settingsBuilder() .put("index.similarity.my_similarity.type", "IB") .put("index.similarity.my_similarity.distribution", "spl") .put("index.similarity.my_similarity.lambda", "ttf") @@ -147,7 +146,7 @@ public class SimilarityTests extends ElasticsearchSingleNodeTest { .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.settingsBuilder() + Settings indexSettings = Settings.settingsBuilder() .put("index.similarity.my_similarity.type", "LMDirichlet") .put("index.similarity.my_similarity.mu", 3000f) .build(); @@ -167,7 +166,7 @@ public class SimilarityTests extends ElasticsearchSingleNodeTest { .endObject() .endObject().endObject().string(); - Settings indexSettings = ImmutableSettings.settingsBuilder() + Settings indexSettings = Settings.settingsBuilder() .put("index.similarity.my_similarity.type", "LMJelinekMercer") .put("index.similarity.my_similarity.lambda", 0.7f) .build(); diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java index 73e234296c6..fd37a30d0cb 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedFileTest.java @@ -47,7 +47,6 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.gateway.GatewayAllocator; @@ -68,7 +67,6 @@ import org.elasticsearch.snapshots.SnapshotState; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.index.merge.NoMergePolicyProvider; -import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.test.store.MockFSDirectoryService; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.transport.*; @@ -90,7 +88,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; @@ -99,7 +97,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() // we really need local GW here since this also checks for corruption etc. // and we need to make sure primaries are not just trashed if we don't have replicas .put(super.nodeSettings(nodeOrdinal)) @@ -125,7 +123,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { assertThat(cluster().numDataNodes(), greaterThanOrEqualTo(3)); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "1") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1") .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) @@ -153,7 +151,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { /* * we corrupted the primary shard - now lets make sure we never recover from it successfully */ - Settings build = ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "2").build(); + Settings build = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "2").build(); client().admin().indices().prepareUpdateSettings("test").setSettings(build).get(); ClusterHealthResponse health = client().admin().cluster() .health(Requests.clusterHealthRequest("test").waitForGreenStatus() @@ -232,7 +230,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { int numDocs = scaledRandomIntBetween(100, 1000); internalCluster().ensureAtLeastNumDataNodes(2); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false) // no checkindex - we corrupt shards on purpose @@ -255,7 +253,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { /* * we corrupted the primary shard - now lets make sure we never recover from it successfully */ - Settings build = ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1").build(); + Settings build = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1").build(); client().admin().indices().prepareUpdateSettings("test").setSettings(build).get(); client().admin().cluster().prepareReroute().get(); @@ -317,7 +315,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { Collections.shuffle(dataNodeStats, getRandom()); NodeStats primariesNode = dataNodeStats.get(0); NodeStats unluckyNode = dataNodeStats.get(1); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put("index.routing.allocation.include._name", primariesNode.getNode().name()) @@ -345,7 +343,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { }); } - Settings build = ImmutableSettings.builder() + Settings build = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1") .put("index.routing.allocation.include._name", primariesNode.getNode().name() + "," + unluckyNode.getNode().name()).build(); client().admin().indices().prepareUpdateSettings("test").setSettings(build).get(); @@ -364,7 +362,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { int numDocs = scaledRandomIntBetween(100, 1000); internalCluster().ensureAtLeastNumDataNodes(2); if (cluster().numDataNodes() < 3) { - internalCluster().startNode(ImmutableSettings.builder().put("node.data", true).put("node.client", false).put("node.master", false)); + internalCluster().startNode(Settings.builder().put("node.data", true).put("node.client", false).put("node.master", false)); } NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats().get(); List dataNodeStats = new ArrayList<>(); @@ -380,7 +378,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { NodeStats unluckyNode = dataNodeStats.get(1); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, between(1, 4)) // don't go crazy here it must recovery fast // This does corrupt files on the replica, so we can't check: @@ -422,7 +420,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { }); } - Settings build = ImmutableSettings.builder() + Settings build = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1") .put("index.routing.allocation.include._name", "*").build(); client().admin().indices().prepareUpdateSettings("test").setSettings(build).get(); @@ -463,7 +461,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { int numDocs = scaledRandomIntBetween(100, 1000); internalCluster().ensureAtLeastNumDataNodes(2); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") // no replicas for this test .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false) // no checkindex - we corrupt shards on purpose @@ -518,7 +516,7 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { int numDocs = scaledRandomIntBetween(100, 1000); internalCluster().ensureAtLeastNumDataNodes(2); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(GatewayAllocator.INDEX_RECOVERY_INITIAL_SHARDS, "one") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, cluster().numDataNodes() - 1) .put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class) @@ -736,13 +734,13 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest { } private void disableAllocation(String index) { - client().admin().indices().prepareUpdateSettings(index).setSettings(ImmutableSettings.builder().put( + client().admin().indices().prepareUpdateSettings(index).setSettings(Settings.builder().put( "index.routing.allocation.enable", "none" )).get(); } private void enableAllocation(String index) { - client().admin().indices().prepareUpdateSettings(index).setSettings(ImmutableSettings.builder().put( + client().admin().indices().prepareUpdateSettings(index).setSettings(Settings.builder().put( "index.routing.allocation.enable", "all" )).get(); } diff --git a/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java b/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java index 738f4c106b1..b03c7d90327 100644 --- a/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java +++ b/src/test/java/org/elasticsearch/index/store/CorruptedTranslogTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.index.store; import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.collect.Lists; -import com.carrotsearch.randomizedtesting.annotations.Repeat; import com.carrotsearch.randomizedtesting.generators.RandomPicks; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; @@ -31,16 +30,13 @@ import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardIterator; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.shard.IndexShard; -import org.elasticsearch.index.translog.Translog; import org.elasticsearch.index.translog.TranslogConfig; import org.elasticsearch.monitor.fs.FsStats; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.engine.MockEngineSupport; import org.elasticsearch.test.junit.annotations.TestLogging; -import org.elasticsearch.test.store.MockFSIndexStoreModule; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.transport.TransportModule; import org.junit.Test; @@ -66,7 +62,7 @@ public class CorruptedTranslogTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() // we really need local GW here since this also checks for corruption etc. // and we need to make sure primaries are not just trashed if we don't have replicas .put(super.nodeSettings(nodeOrdinal)) @@ -76,9 +72,9 @@ public class CorruptedTranslogTests extends ElasticsearchIntegrationTest { @Test @TestLogging("index.translog:TRACE,index.gateway:TRACE") public void testCorruptTranslogFiles() throws Exception { - internalCluster().startNodesAsync(1, ImmutableSettings.EMPTY).get(); + internalCluster().startNodesAsync(1, Settings.EMPTY).get(); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("index.refresh_interval", "-1") diff --git a/src/test/java/org/elasticsearch/index/store/ExceptionRetryTests.java b/src/test/java/org/elasticsearch/index/store/ExceptionRetryTests.java index f415b23b7c8..9ae093cfe47 100644 --- a/src/test/java/org/elasticsearch/index/store/ExceptionRetryTests.java +++ b/src/test/java/org/elasticsearch/index/store/ExceptionRetryTests.java @@ -18,9 +18,6 @@ */ package org.elasticsearch.index.store; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.action.bulk.BulkItemResponse; @@ -29,7 +26,6 @@ import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.bulk.TransportShardBulkAction; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.discovery.Discovery; @@ -55,7 +51,7 @@ public class ExceptionRetryTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()) .build(); diff --git a/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java b/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java index a063edf7a8f..1286a7322f1 100644 --- a/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java +++ b/src/test/java/org/elasticsearch/index/store/IndexStoreTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.index.store; import com.carrotsearch.randomizedtesting.generators.RandomPicks; import org.apache.lucene.store.*; import org.apache.lucene.util.Constants; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardPath; @@ -38,7 +37,7 @@ public class IndexStoreTests extends ElasticsearchTestCase { final Path tempDir = createTempDir(); final IndexStoreModule.Type[] values = IndexStoreModule.Type.values(); final IndexStoreModule.Type type = RandomPicks.randomFrom(random(), values); - Settings settings = ImmutableSettings.settingsBuilder().put(IndexStoreModule.STORE_TYPE, type.name()).build(); + Settings settings = Settings.settingsBuilder().put(IndexStoreModule.STORE_TYPE, type.name()).build(); FsDirectoryService service = new FsDirectoryService(settings, null, new ShardPath(tempDir, tempDir, "foo", new ShardId("foo", 0))); try (final Directory directory = service.newFSDirectory(tempDir, NoLockFactory.INSTANCE)) { switch (type) { @@ -71,7 +70,7 @@ public class IndexStoreTests extends ElasticsearchTestCase { public void testStoreDirectoryDefault() throws IOException { final Path tempDir = createTempDir(); - Settings settings = ImmutableSettings.EMPTY; + Settings settings = Settings.EMPTY; FsDirectoryService service = new FsDirectoryService(settings, null, new ShardPath(tempDir, tempDir, "foo", new ShardId("foo", 0))); try (final Directory directory = service.newFSDirectory(tempDir, NoLockFactory.INSTANCE)) { if (Constants.WINDOWS) { diff --git a/src/test/java/org/elasticsearch/index/store/StoreTest.java b/src/test/java/org/elasticsearch/index/store/StoreTest.java index 2726bf8a251..95c043ae70d 100644 --- a/src/test/java/org/elasticsearch/index/store/StoreTest.java +++ b/src/test/java/org/elasticsearch/index/store/StoreTest.java @@ -35,7 +35,6 @@ import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.common.io.stream.InputStreamStreamInput; import org.elasticsearch.common.io.stream.OutputStreamStreamOutput; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.env.ShardLock; @@ -45,7 +44,6 @@ import org.elasticsearch.index.deletionpolicy.SnapshotDeletionPolicy; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.translog.Translog; -import org.elasticsearch.index.translog.TranslogConfig; import org.elasticsearch.indices.store.TransportNodesListShardStoreMetaData; import org.elasticsearch.test.DummyShardLock; import org.elasticsearch.test.ElasticsearchTestCase; @@ -63,7 +61,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.Adler32; -import static org.elasticsearch.common.settings.ImmutableSettings.Builder.EMPTY_SETTINGS; +import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS; import static org.elasticsearch.test.VersionUtils.randomVersion; import static org.hamcrest.Matchers.*; @@ -73,7 +71,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testRefCount() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); int incs = randomIntBetween(1, 100); for (int i = 0; i < incs; i++) { if (randomBoolean()) { @@ -245,7 +243,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testWriteLegacyChecksums() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); // set default codec - all segments need checksums final boolean usesOldCodec = randomBoolean(); IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(usesOldCodec ? new OldSIMockingCodec() : TestUtil.getDefaultCodec())); @@ -330,7 +328,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testNewChecksums() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); // set default codec - all segments need checksums IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(TestUtil.getDefaultCodec())); int docs = 1 + random().nextInt(100); @@ -390,7 +388,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testMixedChecksums() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); // this time random codec.... IndexWriter writer = new IndexWriter(store.directory(), newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(TestUtil.getDefaultCodec())); int docs = 1 + random().nextInt(100); @@ -482,7 +480,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testRenameFile() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random(), false); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); { IndexOutput output = store.directory().createOutput("foo.bar", IOContext.DEFAULT); int iters = scaledRandomIntBetween(10, 100); @@ -690,7 +688,7 @@ public class StoreTest extends ElasticsearchTestCase { } public LuceneManagedDirectoryService(Random random, boolean preventDoubleWrite) { - super(new ShardId("fake", 1), ImmutableSettings.EMPTY); + super(new ShardId("fake", 1), Settings.EMPTY); dir = StoreTest.newDirectory(random); if (dir instanceof MockDirectoryWrapper) { ((MockDirectoryWrapper) dir).setPreventDoubleWrite(preventDoubleWrite); @@ -759,7 +757,7 @@ public class StoreTest extends ElasticsearchTestCase { iwc.setMaxThreadStates(1); final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); IndexWriter writer = new IndexWriter(store.directory(), iwc); final boolean lotsOfSegments = rarely(random); for (Document d : docs) { @@ -790,7 +788,7 @@ public class StoreTest extends ElasticsearchTestCase { iwc.setMaxThreadStates(1); final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random); - store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); IndexWriter writer = new IndexWriter(store.directory(), iwc); final boolean lotsOfSegments = rarely(random); for (Document d : docs) { @@ -891,7 +889,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testCleanupFromSnapshot() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); // this time random codec.... IndexWriterConfig indexWriterConfig = newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(TestUtil.getDefaultCodec()); // we keep all commits and that allows us clean based on multiple snapshots @@ -1006,7 +1004,7 @@ public class StoreTest extends ElasticsearchTestCase { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); for (String file : metaDataMap.keySet()) { try (IndexOutput output = store.directory().createOutput(file, IOContext.DEFAULT)) { BytesRef bytesRef = new BytesRef(TestUtil.randomRealisticUnicodeString(random(), 10, 1024)); @@ -1026,7 +1024,7 @@ public class StoreTest extends ElasticsearchTestCase { final AtomicInteger count = new AtomicInteger(0); final ShardLock lock = new DummyShardLock(shardId); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, lock, new Store.OnClose() { + Store store = new Store(shardId, Settings.EMPTY, directoryService, lock, new Store.OnClose() { @Override public void handle(ShardLock theLock) { assertEquals(shardId, theLock.getShardId()); @@ -1048,7 +1046,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testStoreStats() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Settings settings = ImmutableSettings.builder().put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL, TimeValue.timeValueMinutes(0)).build(); + Settings settings = Settings.builder().put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL, TimeValue.timeValueMinutes(0)).build(); Store store = new Store(shardId, settings, directoryService, new DummyShardLock(shardId)); long initialStoreSize = 0; for (String extraFiles : store.directory().listAll()) { @@ -1143,7 +1141,7 @@ public class StoreTest extends ElasticsearchTestCase { public void testUserDataRead() throws IOException { final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); IndexWriterConfig config = newIndexWriterConfig(random(), new MockAnalyzer(random())).setCodec(TestUtil.getDefaultCodec()); SnapshotDeletionPolicy deletionPolicy = new SnapshotDeletionPolicy(new KeepOnlyLastDeletionPolicy(shardId, EMPTY_SETTINGS)); config.setIndexDeletionPolicy(deletionPolicy); @@ -1198,7 +1196,7 @@ public class StoreTest extends ElasticsearchTestCase { IndexWriterConfig iwc = newIndexWriterConfig(); final ShardId shardId = new ShardId(new Index("index"), 1); DirectoryService directoryService = new LuceneManagedDirectoryService(random()); - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); IndexWriter writer = new IndexWriter(store.directory(), iwc); int numDocs = 1 + random().nextInt(10); @@ -1253,7 +1251,7 @@ public class StoreTest extends ElasticsearchTestCase { assertTrue(Store.canOpenIndex(logger, tempDir)); final ShardId shardId = new ShardId(new Index("index"), 1); - DirectoryService directoryService = new DirectoryService(shardId, ImmutableSettings.EMPTY) { + DirectoryService directoryService = new DirectoryService(shardId, Settings.EMPTY) { @Override public long throttleTimeInNanos() { return 0; @@ -1264,7 +1262,7 @@ public class StoreTest extends ElasticsearchTestCase { return dir; } }; - Store store = new Store(shardId, ImmutableSettings.EMPTY, directoryService, new DummyShardLock(shardId)); + Store store = new Store(shardId, Settings.EMPTY, directoryService, new DummyShardLock(shardId)); store.markStoreCorrupted(new CorruptIndexException("foo", "bar")); assertFalse(Store.canOpenIndex(logger, tempDir)); store.close(); diff --git a/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsTests.java b/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsTests.java index 18a9e382d9f..7609de746fa 100644 --- a/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsTests.java +++ b/src/test/java/org/elasticsearch/index/suggest/stats/SuggestStatsTests.java @@ -28,7 +28,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardIterator; import org.elasticsearch.cluster.routing.ShardRouting; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.suggest.phrase.PhraseSuggestionBuilder; import org.elasticsearch.search.suggest.term.TermSuggestionBuilder; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -39,7 +39,6 @@ import java.util.Set; 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.test.ElasticsearchIntegrationTest.Scope.SUITE; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful; import static org.hamcrest.Matchers.*; @@ -64,11 +63,11 @@ public class SuggestStatsTests extends ElasticsearchIntegrationTest { final int shardsIdx2 = Math.max(numNodes - shardsIdx1, randomIntBetween(1, 10)); final int totalShards = shardsIdx1 + shardsIdx2; assertThat(numNodes, lessThanOrEqualTo(totalShards)); - assertAcked(prepareCreate("test1").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test1").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, shardsIdx1) .put(SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("type", "f", "type=string")); - assertAcked(prepareCreate("test2").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test2").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, shardsIdx2) .put(SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("type", "f", "type=string")); diff --git a/src/test/java/org/elasticsearch/index/translog/BufferedTranslogTests.java b/src/test/java/org/elasticsearch/index/translog/BufferedTranslogTests.java index 857f0b7728d..8c4b8382bd6 100644 --- a/src/test/java/org/elasticsearch/index/translog/BufferedTranslogTests.java +++ b/src/test/java/org/elasticsearch/index/translog/BufferedTranslogTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.translog; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; @@ -33,7 +32,7 @@ public class BufferedTranslogTests extends TranslogTests { @Override protected Translog create(Path path) throws IOException { - Settings build = ImmutableSettings.settingsBuilder() + Settings build = Settings.settingsBuilder() .put("index.translog.fs.type", TranslogWriter.Type.BUFFERED.name()) .put("index.translog.fs.buffer_size", 10 + randomInt(128 * 1024)) .build(); diff --git a/src/test/java/org/elasticsearch/index/translog/TranslogTests.java b/src/test/java/org/elasticsearch/index/translog/TranslogTests.java index 340b0210ecc..6083734475d 100644 --- a/src/test/java/org/elasticsearch/index/translog/TranslogTests.java +++ b/src/test/java/org/elasticsearch/index/translog/TranslogTests.java @@ -34,7 +34,6 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.concurrent.AbstractRunnable; @@ -116,7 +115,7 @@ public class TranslogTests extends ElasticsearchTestCase { } protected Translog create(Path path) throws IOException { - Settings build = ImmutableSettings.settingsBuilder() + Settings build = Settings.settingsBuilder() .put(TranslogConfig.INDEX_TRANSLOG_FS_TYPE, TranslogWriter.Type.SIMPLE.name()) .build(); TranslogConfig translogConfig = new TranslogConfig(shardId, path, build, Translog.Durabilty.REQUEST, BigArrays.NON_RECYCLING_INSTANCE, null); diff --git a/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionTests.java b/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionTests.java index d0affb82629..7cc8142e5b0 100644 --- a/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionTests.java +++ b/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.indexlifecycle; import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; @@ -45,7 +44,7 @@ import static org.elasticsearch.client.Requests.createIndexRequest; 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.routing.ShardRoutingState.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/indices/FlushTest.java b/src/test/java/org/elasticsearch/indices/FlushTest.java index 65fb2f6816b..1fdb42f051b 100644 --- a/src/test/java/org/elasticsearch/indices/FlushTest.java +++ b/src/test/java/org/elasticsearch/indices/FlushTest.java @@ -27,7 +27,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -125,13 +125,13 @@ public class FlushTest extends ElasticsearchIntegrationTest { assertNotNull(shardStats.getCommitStats().getUserData().get(Engine.SYNC_COMMIT_ID)); } - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).build()).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).build()).get(); ensureGreen("test"); indexStats = client().admin().indices().prepareStats("test").get().getIndex("test"); for (ShardStats shardStats : indexStats.getShards()) { assertNotNull(shardStats.getCommitStats().getUserData().get(Engine.SYNC_COMMIT_ID)); } - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, internalCluster().numDataNodes() - 1).build()).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, internalCluster().numDataNodes() - 1).build()).get(); ensureGreen("test"); indexStats = client().admin().indices().prepareStats("test").get().getIndex("test"); for (ShardStats shardStats : indexStats.getShards()) { @@ -165,7 +165,7 @@ public class FlushTest extends ElasticsearchIntegrationTest { createIndex("test"); client().admin().indices().prepareUpdateSettings("test").setSettings( - ImmutableSettings.builder().put("index.translog.disable_flush", true).put("index.refresh_interval", -1).put("index.number_of_replicas", internalCluster().numDataNodes() - 1)) + Settings.builder().put("index.translog.disable_flush", true).put("index.refresh_interval", -1).put("index.number_of_replicas", internalCluster().numDataNodes() - 1)) .get(); ensureGreen(); final AtomicBoolean stop = new AtomicBoolean(false); diff --git a/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java b/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java index 628913dcefa..a6513b69689 100644 --- a/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java +++ b/src/test/java/org/elasticsearch/indices/IndicesCustomDataPathTests.java @@ -20,12 +20,11 @@ package org.elasticsearch.indices; import org.apache.lucene.util.IOUtils; -import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.junit.annotations.TestLogging; import org.junit.After; @@ -34,7 +33,6 @@ import org.junit.Test; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -73,9 +71,9 @@ public class IndicesCustomDataPathTests extends ElasticsearchIntegrationTest { // already existing IOUtils.rm(endDir); - ImmutableSettings.Builder sb = ImmutableSettings.builder().put(IndexMetaData.SETTING_DATA_PATH, + Settings.Builder sb = Settings.builder().put(IndexMetaData.SETTING_DATA_PATH, startDir.toAbsolutePath().toString()); - ImmutableSettings.Builder sb2 = ImmutableSettings.builder().put(IndexMetaData.SETTING_DATA_PATH, + Settings.Builder sb2 = Settings.builder().put(IndexMetaData.SETTING_DATA_PATH, endDir.toAbsolutePath().toString()); logger.info("--> creating an index with data_path [{}]", startDir.toAbsolutePath().toString()); @@ -132,7 +130,7 @@ public class IndicesCustomDataPathTests extends ElasticsearchIntegrationTest { final String INDEX = "myindex2"; logger.info("--> creating an index with data_path [{}]", path); - ImmutableSettings.Builder sb = ImmutableSettings.builder().put(IndexMetaData.SETTING_DATA_PATH, path); + Settings.Builder sb = Settings.builder().put(IndexMetaData.SETTING_DATA_PATH, path); client().admin().indices().prepareCreate(INDEX).setSettings(sb).get(); ensureGreen(INDEX); diff --git a/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java b/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java index dec2a0950f9..5cccd4436bb 100644 --- a/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java +++ b/src/test/java/org/elasticsearch/indices/IndicesLifecycleListenerTests.java @@ -29,7 +29,6 @@ import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.settings.IndexSettings; @@ -50,7 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger; 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.routing.allocation.decider.DisableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_DISABLE_ALLOCATION; -import static org.elasticsearch.common.settings.ImmutableSettings.builder; +import static org.elasticsearch.common.settings.Settings.builder; import static org.elasticsearch.index.shard.IndexShardState.*; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; @@ -235,8 +234,8 @@ public class IndicesLifecycleListenerTests extends ElasticsearchIntegrationTest private static class IndexShardStateChangeListener extends IndicesLifecycle.Listener { //we keep track of all the states (ordered) a shard goes through final ConcurrentMap> shardStates = Maps.newConcurrentMap(); - Settings creationSettings = ImmutableSettings.EMPTY; - Settings afterCloseSettings = ImmutableSettings.EMPTY; + Settings creationSettings = Settings.EMPTY; + Settings afterCloseSettings = Settings.EMPTY; @Override public void indexShardStateChanged(IndexShard indexShard, @Nullable IndexShardState previousState, IndexShardState newState, @Nullable String reason) { diff --git a/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationTests.java b/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationTests.java index 53c04aec0f7..253aad86a4a 100644 --- a/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationTests.java +++ b/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationTests.java @@ -49,7 +49,7 @@ import org.elasticsearch.action.suggest.SuggestRequestBuilder; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.suggest.SuggestBuilders; import org.elasticsearch.search.warmer.IndexWarmersMetaData; @@ -57,7 +57,6 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder; -import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; @@ -317,7 +316,7 @@ public class IndicesOptionsIntegrationTests extends ElasticsearchIntegrationTest waitForRelocation(); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())).get(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); client().admin().cluster().prepareCreateSnapshot("dummy-repo", "snap1").setWaitForCompletion(true).get(); @@ -469,7 +468,7 @@ public class IndicesOptionsIntegrationTests extends ElasticsearchIntegrationTest waitForRelocation(); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())).get(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); client().admin().cluster().prepareCreateSnapshot("dummy-repo", "snap1").setWaitForCompletion(true).get(); @@ -748,16 +747,16 @@ public class IndicesOptionsIntegrationTests extends ElasticsearchIntegrationTest @Test public void testUpdateSettings() throws Exception { - verify(client().admin().indices().prepareUpdateSettings("foo").setSettings(ImmutableSettings.builder().put("a", "b")), true); - verify(client().admin().indices().prepareUpdateSettings("_all").setSettings(ImmutableSettings.builder().put("a", "b")), true); + verify(client().admin().indices().prepareUpdateSettings("foo").setSettings(Settings.builder().put("a", "b")), true); + verify(client().admin().indices().prepareUpdateSettings("_all").setSettings(Settings.builder().put("a", "b")), true); createIndex("foo", "foobar", "bar", "barbaz"); ensureGreen(); assertAcked(client().admin().indices().prepareClose("_all").get()); - verify(client().admin().indices().prepareUpdateSettings("foo").setSettings(ImmutableSettings.builder().put("a", "b")), false); - verify(client().admin().indices().prepareUpdateSettings("bar*").setSettings(ImmutableSettings.builder().put("a", "b")), false); - verify(client().admin().indices().prepareUpdateSettings("_all").setSettings(ImmutableSettings.builder().put("c", "d")), false); + verify(client().admin().indices().prepareUpdateSettings("foo").setSettings(Settings.builder().put("a", "b")), false); + verify(client().admin().indices().prepareUpdateSettings("bar*").setSettings(Settings.builder().put("a", "b")), false); + verify(client().admin().indices().prepareUpdateSettings("_all").setSettings(Settings.builder().put("c", "d")), false); GetSettingsResponse settingsResponse = client().admin().indices().prepareGetSettings("foo").get(); assertThat(settingsResponse.getSetting("foo", "index.a"), equalTo("b")); @@ -772,11 +771,11 @@ public class IndicesOptionsIntegrationTests extends ElasticsearchIntegrationTest assertAcked(client().admin().indices().prepareOpen("_all").get()); try { - verify(client().admin().indices().prepareUpdateSettings("barbaz").setSettings(ImmutableSettings.builder().put("e", "f")), false); + verify(client().admin().indices().prepareUpdateSettings("barbaz").setSettings(Settings.builder().put("e", "f")), false); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), equalTo("Can't update non dynamic settings[[index.e]] for open indices[[barbaz]]")); } - verify(client().admin().indices().prepareUpdateSettings("baz*").setSettings(ImmutableSettings.builder().put("a", "b")), true); + verify(client().admin().indices().prepareUpdateSettings("baz*").setSettings(Settings.builder().put("a", "b")), true); } private static SearchRequestBuilder search(String... indices) { diff --git a/src/test/java/org/elasticsearch/indices/SealTests.java b/src/test/java/org/elasticsearch/indices/SealTests.java index 723f699d8cd..281de05c387 100644 --- a/src/test/java/org/elasticsearch/indices/SealTests.java +++ b/src/test/java/org/elasticsearch/indices/SealTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.indices; import org.elasticsearch.action.admin.indices.seal.SealIndicesResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -32,7 +32,7 @@ public class SealTests extends ElasticsearchIntegrationTest { @Test public void testUnallocatedShardsDoesNotHang() throws InterruptedException { - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder() + Settings.Builder settingsBuilder = Settings.builder() .put("node.data", false) .put("node.master", true) .put("path.data", createTempDir().toString()); diff --git a/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java b/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java index 72e91a75556..1bffc1ed4ab 100644 --- a/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java +++ b/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java @@ -23,7 +23,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.lucene.analysis.Analyzer; import org.elasticsearch.Version; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest; @@ -46,7 +45,7 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put("plugin.types", DummyAnalysisPlugin.class.getName()) .build(); diff --git a/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java b/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java index 436483b6869..2537b53b0f3 100644 --- a/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java +++ b/src/test/java/org/elasticsearch/indices/analyze/AnalyzeActionTests.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.indices.analyze; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequestBuilder; @@ -31,7 +30,7 @@ import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java b/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java index 742f5d1615e..46a6505a511 100644 --- a/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java +++ b/src/test/java/org/elasticsearch/indices/analyze/HunspellServiceTests.java @@ -19,10 +19,8 @@ package org.elasticsearch.indices.analyze; import org.apache.lucene.analysis.hunspell.Dictionary; -import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.analysis.HunspellService; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -44,7 +42,7 @@ public class HunspellServiceTests extends ElasticsearchIntegrationTest { @Test public void testLocaleDirectoryWithNodeLevelConfig() throws Exception { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.conf", getDataPath("/indices/analyze/conf_dir")) .put(HUNSPELL_LAZY_LOAD, randomBoolean()) .put(HUNSPELL_IGNORE_CASE, true) @@ -58,7 +56,7 @@ public class HunspellServiceTests extends ElasticsearchIntegrationTest { @Test public void testLocaleDirectoryWithLocaleSpecificConfig() throws Exception { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.conf", getDataPath("/indices/analyze/conf_dir")) .put(HUNSPELL_LAZY_LOAD, randomBoolean()) .put(HUNSPELL_IGNORE_CASE, true) @@ -81,7 +79,7 @@ public class HunspellServiceTests extends ElasticsearchIntegrationTest { @Test public void testDicWithNoAff() throws Exception { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.conf", getDataPath("/indices/analyze/no_aff_conf_dir")) .put(HUNSPELL_LAZY_LOAD, randomBoolean()) .build(); @@ -100,7 +98,7 @@ public class HunspellServiceTests extends ElasticsearchIntegrationTest { @Test public void testDicWithTwoAffs() throws Exception { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("path.conf", getDataPath("/indices/analyze/two_aff_conf_dir")) .put(HUNSPELL_LAZY_LOAD, randomBoolean()) .build(); diff --git a/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java b/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java index ca0b1a52029..3e73a52fb41 100644 --- a/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java +++ b/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.indices.leaks; import org.elasticsearch.common.inject.Injector; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.IndexService; @@ -48,7 +48,7 @@ public class IndicesLeaksTests extends ElasticsearchIntegrationTest { public void testIndexShardLifecycleLeak() throws Exception { client().admin().indices().prepareCreate("test") - .setSettings(ImmutableSettings.builder().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(); client().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingTests.java b/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingTests.java index 372075277ce..2b7e7a0e77c 100644 --- a/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingTests.java +++ b/src/test/java/org/elasticsearch/indices/mapping/DedicatedMasterGetFieldMappingTests.java @@ -19,12 +19,11 @@ package org.elasticsearch.indices.mapping; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.junit.Before; import static org.apache.lucene.util.LuceneTestCase.Slow; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; @@ -39,7 +38,7 @@ public class DedicatedMasterGetFieldMappingTests extends SimpleGetFieldMappingsT Settings settings = settingsBuilder() .put("node.data", false) .build(); - internalCluster().startNodesAsync(settings, ImmutableSettings.EMPTY).get(); + internalCluster().startNodesAsync(settings, Settings.EMPTY).get(); } } diff --git a/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java b/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java index b6cae9322c6..36026e95b52 100644 --- a/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java +++ b/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationTests.java @@ -21,15 +21,12 @@ package org.elasticsearch.indices.mapping; import com.google.common.collect.Lists; -import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; import org.elasticsearch.action.count.CountResponse; -import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.Priority; import org.elasticsearch.common.collect.ImmutableOpenMap; @@ -50,7 +47,7 @@ import java.util.concurrent.CyclicBarrier; import java.util.concurrent.atomic.AtomicBoolean; import static org.elasticsearch.cluster.metadata.IndexMetaData.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/indices/memory/IndexingMemoryControllerTests.java b/src/test/java/org/elasticsearch/indices/memory/IndexingMemoryControllerTests.java index a3e47bb5c18..a7e09a3af88 100644 --- a/src/test/java/org/elasticsearch/indices/memory/IndexingMemoryControllerTests.java +++ b/src/test/java/org/elasticsearch/indices/memory/IndexingMemoryControllerTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.indices.memory; import com.google.common.base.Predicate; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.index.engine.EngineConfig; @@ -38,7 +37,7 @@ public class IndexingMemoryControllerTests extends ElasticsearchIntegrationTest @Test public void testIndexBufferSizeUpdateAfterCreationRemoval() throws InterruptedException { - createNode(ImmutableSettings.EMPTY); + createNode(Settings.EMPTY); prepareCreate("test1").setSettings(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1, IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).get(); @@ -88,7 +87,7 @@ public class IndexingMemoryControllerTests extends ElasticsearchIntegrationTest @Test public void testIndexBufferSizeUpdateInactiveShard() throws InterruptedException { - createNode(ImmutableSettings.builder().put("indices.memory.shard_inactive_time", "100ms").build()); + createNode(Settings.builder().put("indices.memory.shard_inactive_time", "100ms").build()); prepareCreate("test1").setSettings(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1, IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).get(); @@ -137,7 +136,7 @@ public class IndexingMemoryControllerTests extends ElasticsearchIntegrationTest } private void createNode(Settings settings) { - internalCluster().startNode(ImmutableSettings.builder() + internalCluster().startNode(Settings.builder() .put(ClusterName.SETTING, "IndexingMemoryControllerTests") .put("node.name", "IndexingMemoryControllerTests") .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) diff --git a/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopTests.java b/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopTests.java index 313a8eec70f..23ff0709c61 100644 --- a/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopTests.java +++ b/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerNoopTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.indices.memory.breaker; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; import org.elasticsearch.search.sort.SortOrder; @@ -32,7 +31,7 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -43,7 +42,7 @@ public class CircuitBreakerNoopTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_TYPE_SETTING, "noop") // This is set low, because if the "noop" is not a noop, it will break .put(HierarchyCircuitBreakerService.FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, "10b") diff --git a/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceTests.java b/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceTests.java index ab6061856b2..901f9d74bbb 100644 --- a/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceTests.java +++ b/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerServiceTests.java @@ -47,7 +47,7 @@ import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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.ElasticsearchIntegrationTest.Scope.TEST; diff --git a/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerUnitTests.java b/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerUnitTests.java index d1c702b808b..c2296c363fd 100644 --- a/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerUnitTests.java +++ b/src/test/java/org/elasticsearch/indices/memory/breaker/CircuitBreakerUnitTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.indices.memory.breaker; import org.elasticsearch.common.breaker.CircuitBreaker; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.breaker.BreakerSettings; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; @@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.*; public class CircuitBreakerUnitTests extends ElasticsearchTestCase { public static long pctBytes(String percentString) { - return ImmutableSettings.EMPTY.getAsMemory("", percentString).bytes(); + return Settings.EMPTY.getAsMemory("", percentString).bytes(); } @Test @@ -68,7 +68,7 @@ public class CircuitBreakerUnitTests extends ElasticsearchTestCase { @Test public void testRegisterCustomBreaker() throws Exception { - CircuitBreakerService service = new HierarchyCircuitBreakerService(ImmutableSettings.EMPTY, new NodeSettingsService(ImmutableSettings.EMPTY)); + CircuitBreakerService service = new HierarchyCircuitBreakerService(Settings.EMPTY, new NodeSettingsService(Settings.EMPTY)); String customName = "custom"; BreakerSettings settings = new BreakerSettings(customName, 20, 1.0); service.registerBreaker(settings); diff --git a/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerTests.java b/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerTests.java index 438462b5f32..c2da93b9ab3 100644 --- a/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerTests.java +++ b/src/test/java/org/elasticsearch/indices/memory/breaker/RandomExceptionCircuitBreakerTests.java @@ -30,7 +30,6 @@ import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.client.Requests; import org.elasticsearch.common.breaker.CircuitBreaker; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; @@ -47,7 +46,7 @@ import java.util.Arrays; import java.util.Random; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful; import static org.hamcrest.Matchers.equalTo; @@ -107,7 +106,7 @@ public class RandomExceptionCircuitBreakerTests extends ElasticsearchIntegration lowLevelRate = 0d; } - ImmutableSettings.Builder settings = settingsBuilder() + Settings.Builder settings = settingsBuilder() .put(indexSettings()) .put(MockEngineSupport.READER_WRAPPER_TYPE, RandomExceptionDirectoryReaderWrapper.class.getName()) .put(EXCEPTION_TOP_LEVEL_RATIO_KEY, topLevelRate) diff --git a/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryTests.java b/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryTests.java index a477d453d36..bde913558c9 100644 --- a/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryTests.java +++ b/src/test/java/org/elasticsearch/indices/recovery/IndexRecoveryTests.java @@ -37,7 +37,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.discovery.DiscoveryService; @@ -63,7 +62,7 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; @@ -125,7 +124,7 @@ public class IndexRecoveryTests extends ElasticsearchIntegrationTest { private void slowDownRecovery(ByteSizeValue shardSize) { long chunkSize = shardSize.bytes() / 10; assertTrue(client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder() + .setTransientSettings(Settings.builder() // one chunk per sec.. .put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC, chunkSize) .put(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, chunkSize) @@ -135,7 +134,7 @@ public class IndexRecoveryTests extends ElasticsearchIntegrationTest { private void restoreRecoverySpeed() { assertTrue(client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder() + .setTransientSettings(Settings.builder() .put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC, "20mb") .put(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, "512kb") ) @@ -425,7 +424,7 @@ public class IndexRecoveryTests extends ElasticsearchIntegrationTest { logger.info("--> create repository"); assertAcked(client().admin().cluster().preparePutRepository(REPO_NAME) - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", false) ).get()); @@ -516,7 +515,7 @@ public class IndexRecoveryTests extends ElasticsearchIntegrationTest { @Test public void disconnectsWhileRecoveringTest() throws Exception { final String indexName = "test"; - final Settings nodeSettings = ImmutableSettings.builder() + final Settings nodeSettings = Settings.builder() .put(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK, "100ms") .put(RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT, "1s") .put("cluster.routing.schedule", "100ms") // aggressive reroute post shard failures @@ -526,8 +525,8 @@ public class IndexRecoveryTests extends ElasticsearchIntegrationTest { // start a master node internalCluster().startNode(nodeSettings); - ListenableFuture blueFuture = internalCluster().startNodeAsync(ImmutableSettings.builder().put("node.color", "blue").put(nodeSettings).build()); - ListenableFuture redFuture = internalCluster().startNodeAsync(ImmutableSettings.builder().put("node.color", "red").put(nodeSettings).build()); + ListenableFuture blueFuture = internalCluster().startNodeAsync(Settings.builder().put("node.color", "blue").put(nodeSettings).build()); + ListenableFuture redFuture = internalCluster().startNodeAsync(Settings.builder().put("node.color", "red").put(nodeSettings).build()); final String blueNodeName = blueFuture.get(); final String redNodeName = redFuture.get(); @@ -537,7 +536,7 @@ public class IndexRecoveryTests extends ElasticsearchIntegrationTest { client().admin().indices().prepareCreate(indexName) .setSettings( - ImmutableSettings.builder() + Settings.builder() .put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue") .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) @@ -583,7 +582,7 @@ public class IndexRecoveryTests extends ElasticsearchIntegrationTest { logger.info("--> starting recovery from blue to red"); client().admin().indices().prepareUpdateSettings(indexName).setSettings( - ImmutableSettings.builder() + Settings.builder() .put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red,blue") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) ).get(); diff --git a/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksTests.java b/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksTests.java index 7ecf5eb465d..70783a8efb1 100644 --- a/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksTests.java +++ b/src/test/java/org/elasticsearch/indices/settings/GetSettingsBlocksTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.indices.settings; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -37,7 +37,7 @@ public class GetSettingsBlocksTests extends ElasticsearchIntegrationTest { @Test public void testGetSettingsWithBlocks() throws Exception { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.refresh_interval", -1) .put("index.merge.policy.expunge_deletes_allowed", "30") .put("index.mapper.dynamic", false))); diff --git a/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasTests.java b/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasTests.java index a12e35a92ee..3eb35db9ccc 100644 --- a/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasTests.java +++ b/src/test/java/org/elasticsearch/indices/settings/UpdateNumberOfReplicasTests.java @@ -24,13 +24,13 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Priority; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -272,7 +272,7 @@ public class UpdateNumberOfReplicasTests extends ElasticsearchIntegrationTest { createIndex("test"); try { client().admin().indices().prepareUpdateSettings("test") - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, randomIntBetween(-10, -1)) ) .execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsTests.java b/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsTests.java index fad19ed7b28..a1b2fde2955 100644 --- a/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsTests.java +++ b/src/test/java/org/elasticsearch/indices/settings/UpdateSettingsTests.java @@ -29,7 +29,6 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Priority; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.engine.VersionConflictEngineException; import org.elasticsearch.index.merge.policy.TieredMergePolicyProvider; @@ -54,7 +53,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { createIndex("test"); try { client().admin().indices().prepareUpdateSettings("test") - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.refresh_interval", -1) // this one can change .put("index.cache.filter.type", "none") // this one can't ) @@ -74,7 +73,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { assertThat(getSettingsResponse.getSetting("test", "index.cache.filter.type"), nullValue()); client().admin().indices().prepareUpdateSettings("test") - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.refresh_interval", -1) // this one can change ) .execute().actionGet(); @@ -94,7 +93,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { client().admin().indices().prepareClose("test").execute().actionGet(); client().admin().indices().prepareUpdateSettings("test") - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.refresh_interval", "1s") // this one can change .put("index.cache.filter.type", "none") // this one can't ) @@ -117,7 +116,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { 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(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.gc_deletes", 0) ).get(); @@ -134,7 +133,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { // No throttling at first, only 1 non-replicated shard, force lots of merging: assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "none") .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "1") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") @@ -172,7 +171,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { .admin() .indices() .prepareUpdateSettings("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "merge") .put(IndexStore.INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC, "1mb")) .get(); @@ -212,7 +211,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { .admin() .indices() .prepareUpdateSettings("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "none")) .get(); @@ -307,7 +306,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { try { // No throttling at first, only 1 non-replicated shard, force lots of merging: assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "1") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") .put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE, "2") @@ -322,7 +321,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { .admin() .indices() .prepareUpdateSettings("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(ConcurrentMergeSchedulerProvider.AUTO_THROTTLE, "no")) .get(); @@ -351,7 +350,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { try { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "1") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") .put(TieredMergePolicyProvider.INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE, "2") @@ -368,7 +367,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { .admin() .indices() .prepareUpdateSettings("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(ConcurrentMergeSchedulerProvider.MAX_THREAD_COUNT, "1") ) .get(); @@ -391,7 +390,7 @@ public class UpdateSettingsTests extends ElasticsearchIntegrationTest { createIndex("test"); ensureGreen("test"); - Settings.Builder builder = ImmutableSettings.builder().put("index.refresh_interval", -1); + Settings.Builder builder = Settings.builder().put("index.refresh_interval", -1); for (String blockSetting : Arrays.asList(SETTING_BLOCKS_READ, SETTING_BLOCKS_WRITE)) { try { diff --git a/src/test/java/org/elasticsearch/indices/state/CloseIndexDisableCloseAllTests.java b/src/test/java/org/elasticsearch/indices/state/CloseIndexDisableCloseAllTests.java index b2308b15a8c..ec060575785 100644 --- a/src/test/java/org/elasticsearch/indices/state/CloseIndexDisableCloseAllTests.java +++ b/src/test/java/org/elasticsearch/indices/state/CloseIndexDisableCloseAllTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; @@ -41,7 +40,7 @@ public class CloseIndexDisableCloseAllTests extends ElasticsearchIntegrationTest // Combined multiple tests into one, because cluster scope is test. // The cluster scope is test b/c we can't clear cluster settings. public void testCloseAllRequiresName() { - Settings clusterSettings = ImmutableSettings.builder() + Settings clusterSettings = Settings.builder() .put(DestructiveOperations.REQUIRES_NAME, true) .build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(clusterSettings)); diff --git a/src/test/java/org/elasticsearch/indices/state/RareClusterStateTests.java b/src/test/java/org/elasticsearch/indices/state/RareClusterStateTests.java index 81ef1030f76..956c9d6561a 100644 --- a/src/test/java/org/elasticsearch/indices/state/RareClusterStateTests.java +++ b/src/test/java/org/elasticsearch/indices/state/RareClusterStateTests.java @@ -37,7 +37,6 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.discovery.DiscoveryModule; @@ -58,7 +57,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -91,7 +89,7 @@ public class RareClusterStateTests extends ElasticsearchIntegrationTest { ClusterState current = clusterService().state(); GatewayAllocator allocator = internalCluster().getInstance(GatewayAllocator.class); - AllocationDeciders allocationDeciders = new AllocationDeciders(ImmutableSettings.EMPTY, new AllocationDecider[0]); + AllocationDeciders allocationDeciders = new AllocationDeciders(Settings.EMPTY, new AllocationDecider[0]); RoutingNodes routingNodes = new RoutingNodes( ClusterState.builder(current) .routingTable(RoutingTable.builder(current.routingTable()).remove("a").addAsRecovery(current.metaData().index("a"))) @@ -107,7 +105,7 @@ public class RareClusterStateTests extends ElasticsearchIntegrationTest { @Test @TestLogging(value = "cluster.service:TRACE") public void testDeleteCreateInOneBulk() throws Exception { - internalCluster().startNodesAsync(2, ImmutableSettings.builder() + internalCluster().startNodesAsync(2, Settings.builder() .put(DiscoveryModule.DISCOVERY_TYPE_KEY, "zen") .build()).get(); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); @@ -115,7 +113,7 @@ public class RareClusterStateTests extends ElasticsearchIntegrationTest { ensureGreen("test"); // now that the cluster is stable, remove publishing timeout - assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "0"))); + assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "0"))); Set nodes = new HashSet<>(Arrays.asList(internalCluster().getNodeNames())); nodes.remove(internalCluster().getMasterName()); @@ -144,7 +142,7 @@ public class RareClusterStateTests extends ElasticsearchIntegrationTest { // but the change might not be on the node that performed the indexing // operation yet - Settings settings = ImmutableSettings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "0ms").build(); + Settings settings = Settings.builder().put(DiscoverySettings.PUBLISH_TIMEOUT, "0ms").build(); final List nodeNames = internalCluster().startNodesAsync(2, settings).get(); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); @@ -160,7 +158,7 @@ public class RareClusterStateTests extends ElasticsearchIntegrationTest { assertNotNull(otherNode); // Don't allocate the shard on the master node - assertAcked(prepareCreate("index").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("index").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put("index.routing.allocation.exclude._name", master)).get()); @@ -274,11 +272,11 @@ public class RareClusterStateTests extends ElasticsearchIntegrationTest { // Force allocation of the primary on the master node by first only allocating on the master // and then allowing all nodes so that the replica gets allocated on the other node - assertAcked(prepareCreate("index").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("index").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1) .put("index.routing.allocation.include._name", master)).get()); - assertAcked(client().admin().indices().prepareUpdateSettings("index").setSettings(ImmutableSettings.builder() + assertAcked(client().admin().indices().prepareUpdateSettings("index").setSettings(Settings.builder() .put("index.routing.allocation.include._name", "")).get()); ensureGreen(); diff --git a/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateTests.java b/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateTests.java index bb88f994bae..9c1a78f2f09 100644 --- a/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateTests.java +++ b/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateTests.java @@ -29,7 +29,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.indices.IndexClosedException; import org.elasticsearch.indices.IndexMissingException; @@ -37,7 +37,7 @@ import org.elasticsearch.indices.IndexPrimaryShardNotAllocatedException; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; @@ -103,7 +103,7 @@ public class SimpleIndexStateTests extends ElasticsearchIntegrationTest { @Test public void testFastCloseAfterCreateDoesNotClose() { logger.info("--> creating test index that cannot be allocated"); - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder() + client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder() .put("index.routing.allocation.include.tag", "no_such_node").build()).get(); ClusterHealthResponse health = client().admin().cluster().prepareHealth("test").setWaitForNodes(">=2").get(); @@ -118,7 +118,7 @@ public class SimpleIndexStateTests extends ElasticsearchIntegrationTest { } logger.info("--> updating test index settings to allow allocation"); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.settingsBuilder() + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.settingsBuilder() .put("index.routing.allocation.include.tag", "").build()).get(); logger.info("--> waiting for green status"); diff --git a/src/test/java/org/elasticsearch/indices/stats/IndexStatsTests.java b/src/test/java/org/elasticsearch/indices/stats/IndexStatsTests.java index 021cae33be0..0ef2bf02fd5 100644 --- a/src/test/java/org/elasticsearch/indices/stats/IndexStatsTests.java +++ b/src/test/java/org/elasticsearch/indices/stats/IndexStatsTests.java @@ -37,7 +37,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.cache.filter.FilterCacheModule; import org.elasticsearch.index.cache.filter.FilterCacheModule.FilterCacheSettings; @@ -59,7 +58,7 @@ import java.util.EnumSet; import java.util.Random; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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.assertAllSuccessful; @@ -78,7 +77,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest { @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 ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)) .put(IndicesQueryCache.INDICES_CACHE_QUERY_CLEAN_INTERVAL, "1ms") .put(FilterCacheSettings.FILTER_CACHE_EVERYTHING, true) .put(FilterCacheModule.FilterCacheSettings.FILTER_CACHE_TYPE, IndexFilterCache.class) @@ -87,7 +86,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest { @Test public void testFieldDataStats() { - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 2)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().put("index.number_of_shards", 2)).execute().actionGet(); ensureGreen(); client().prepareIndex("test", "type", "1").setSource("field", "value1", "field2", "value1").execute().actionGet(); client().prepareIndex("test", "type", "2").setSource("field", "value2", "field2", "value2").execute().actionGet(); @@ -133,7 +132,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest { @Test public void testClearAllCaches() throws Exception { client().admin().indices().prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_replicas", 0).put("index.number_of_shards", 2)) + .setSettings(Settings.settingsBuilder().put("index.number_of_replicas", 0).put("index.number_of_shards", 2)) .execute().actionGet(); ensureGreen(); client().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); @@ -269,7 +268,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest { // set the index level setting to false, and see that the reverse works client().admin().indices().prepareClearCache().setQueryCache(true).get(); // clean the cache - assertAcked(client().admin().indices().prepareUpdateSettings("idx").setSettings(ImmutableSettings.builder().put(IndicesQueryCache.INDEX_CACHE_QUERY_ENABLED, false))); + assertAcked(client().admin().indices().prepareUpdateSettings("idx").setSettings(Settings.builder().put(IndicesQueryCache.INDEX_CACHE_QUERY_ENABLED, false))); assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).get().getHits().getTotalHits(), equalTo((long) numDocs)); assertThat(client().admin().indices().prepareStats("idx").setQueryCache(true).get().getTotal().getQueryCache().getMemorySizeInBytes(), equalTo(0l)); @@ -282,7 +281,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest { @Test public void nonThrottleStats() throws Exception { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "merge") .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "1") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") @@ -315,7 +314,7 @@ public class IndexStatsTests extends ElasticsearchIntegrationTest { @Test public void throttleStats() throws Exception { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "merge") .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "1") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") diff --git a/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationTests.java b/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationTests.java index 82b90b5ed1a..12bad2364a8 100644 --- a/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationTests.java +++ b/src/test/java/org/elasticsearch/indices/store/IndicesStoreIntegrationTests.java @@ -30,7 +30,6 @@ import org.elasticsearch.cluster.routing.*; import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.common.Priority; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.discovery.DiscoveryService; @@ -50,7 +49,7 @@ import java.util.Arrays; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -63,7 +62,7 @@ public class IndicesStoreIntegrationTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { // simplify this and only use a single data path - return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("path.data", "") + return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("path.data", "") // 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 @@ -79,12 +78,12 @@ public class IndicesStoreIntegrationTests extends ElasticsearchIntegrationTest { @Test public void indexCleanup() throws Exception { - final String masterNode = internalCluster().startNode(ImmutableSettings.builder().put("node.data", false)); - final String node_1 = internalCluster().startNode(ImmutableSettings.builder().put("node.master", false)); - final String node_2 = internalCluster().startNode(ImmutableSettings.builder().put("node.master", false)); + final String masterNode = internalCluster().startNode(Settings.builder().put("node.data", false)); + final String node_1 = internalCluster().startNode(Settings.builder().put("node.master", false)); + final String node_2 = internalCluster().startNode(Settings.builder().put("node.master", false)); logger.info("--> creating index [test] with one shard and on replica"); assertAcked(prepareCreate("test").setSettings( - ImmutableSettings.builder().put(indexSettings()) + Settings.builder().put(indexSettings()) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)) ); @@ -97,7 +96,7 @@ public class IndicesStoreIntegrationTests extends ElasticsearchIntegrationTest { assertThat(Files.exists(indexDirectory(node_2, "test")), equalTo(true)); logger.info("--> starting node server3"); - final String node_3 = internalCluster().startNode(ImmutableSettings.builder().put("node.master", false)); + final String node_3 = internalCluster().startNode(Settings.builder().put("node.master", false)); logger.info("--> running cluster_health"); ClusterHealthResponse clusterHealth = client().admin().cluster().prepareHealth() .setWaitForNodes("4") @@ -140,7 +139,7 @@ public class IndicesStoreIntegrationTests extends ElasticsearchIntegrationTest { final String node_2 = internalCluster().startNode(); logger.info("--> creating index [test] with one shard and on replica"); assertAcked(prepareCreate("test").setSettings( - ImmutableSettings.builder().put(indexSettings()) + Settings.builder().put(indexSettings()) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)) ); @@ -198,8 +197,8 @@ public class IndicesStoreIntegrationTests extends ElasticsearchIntegrationTest { public void testShardActiveElseWhere() throws Exception { boolean node1IsMasterEligible = randomBoolean(); boolean node2IsMasterEligible = !node1IsMasterEligible || randomBoolean(); - Future node_1_future = internalCluster().startNodeAsync(ImmutableSettings.builder().put("node.master", node1IsMasterEligible).build()); - Future node_2_future = internalCluster().startNodeAsync(ImmutableSettings.builder().put("node.master", node2IsMasterEligible).build()); + Future node_1_future = internalCluster().startNodeAsync(Settings.builder().put("node.master", node1IsMasterEligible).build()); + Future node_2_future = internalCluster().startNodeAsync(Settings.builder().put("node.master", node2IsMasterEligible).build()); final String node_1 = node_1_future.get(); final String node_2 = node_2_future.get(); final String node_1_id = internalCluster().getInstance(DiscoveryService.class, node_1).localNode().getId(); @@ -210,7 +209,7 @@ public class IndicesStoreIntegrationTests extends ElasticsearchIntegrationTest { logger.debug("node {} became master", internalCluster().getMasterName()); final int numShards = scaledRandomIntBetween(2, 20); assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards)) + .setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, numShards)) ); ensureGreen("test"); diff --git a/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringTests.java b/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringTests.java index b04c1e26f4a..d09761c5a51 100644 --- a/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringTests.java +++ b/src/test/java/org/elasticsearch/indices/template/IndexTemplateFilteringTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.metadata.IndexTemplateFilter; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -43,7 +42,7 @@ public class IndexTemplateFilteringTests extends ElasticsearchIntegrationTest{ @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("plugin.types", TestPlugin.class.getName()) .build(); diff --git a/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateTests.java b/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateTests.java index 2901db9a5f3..6907736d3cb 100644 --- a/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateTests.java +++ b/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.metadata.AliasMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryParsingException; @@ -322,7 +322,7 @@ public class SimpleIndexTemplateTests extends ElasticsearchIntegrationTest { client().admin().indices().preparePutTemplate("template_1") .setTemplate("te*") - .setSettings(ImmutableSettings.builder().put("does_not_exist", "test")) + .setSettings(Settings.builder().put("does_not_exist", "test")) .get(); response = client().admin().indices().prepareGetTemplates().get(); diff --git a/src/test/java/org/elasticsearch/indices/warmer/GatewayIndicesWarmerTests.java b/src/test/java/org/elasticsearch/indices/warmer/GatewayIndicesWarmerTests.java index f149bde8542..b63a8273c89 100644 --- a/src/test/java/org/elasticsearch/indices/warmer/GatewayIndicesWarmerTests.java +++ b/src/test/java/org/elasticsearch/indices/warmer/GatewayIndicesWarmerTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.indices.warmer.delete.DeleteWarmerResponse import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.warmer.IndexWarmersMetaData; @@ -33,7 +32,6 @@ import org.elasticsearch.test.InternalTestCluster.RestartCallback; import org.hamcrest.Matchers; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -93,7 +91,7 @@ public class GatewayIndicesWarmerTests extends ElasticsearchIntegrationTest { internalCluster().fullRestart(new RestartCallback() { @Override public Settings onNodeStopped(String nodeName) throws Exception { - return ImmutableSettings.EMPTY; + return Settings.EMPTY; } }); @@ -131,7 +129,7 @@ public class GatewayIndicesWarmerTests extends ElasticsearchIntegrationTest { internalCluster().fullRestart(new RestartCallback() { @Override public Settings onNodeStopped(String nodeName) throws Exception { - return ImmutableSettings.EMPTY; + return Settings.EMPTY; } }); diff --git a/src/test/java/org/elasticsearch/indices/warmer/SimpleIndicesWarmerTests.java b/src/test/java/org/elasticsearch/indices/warmer/SimpleIndicesWarmerTests.java index 5802d20f1dd..637c877caf3 100644 --- a/src/test/java/org/elasticsearch/indices/warmer/SimpleIndicesWarmerTests.java +++ b/src/test/java/org/elasticsearch/indices/warmer/SimpleIndicesWarmerTests.java @@ -33,7 +33,6 @@ import org.elasticsearch.action.admin.indices.warmer.get.GetWarmersResponse; import org.elasticsearch.action.admin.indices.warmer.put.PutWarmerResponse; import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.engine.Segment; @@ -211,7 +210,7 @@ public class SimpleIndicesWarmerTests extends ElasticsearchIntegrationTest { client().prepareIndex("test", "test", "1").setSource("foo", "bar").setRefresh(true).execute().actionGet(); logger.info("--> Disabling warmers execution"); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put("index.warmer.enabled", false)).execute().actionGet(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put("index.warmer.enabled", false)).execute().actionGet(); long warmerRunsAfterDisabling = getWarmerRuns(); assertThat(warmerRunsAfterDisabling, greaterThanOrEqualTo(1L)); @@ -273,13 +272,13 @@ public class SimpleIndicesWarmerTests extends ElasticsearchIntegrationTest { LAZY { @Override CreateIndexRequestBuilder createIndex(String indexName, String type, String fieldName) { - return client().admin().indices().prepareCreate(indexName).setSettings(ImmutableSettings.builder().put(SINGLE_SHARD_NO_REPLICA).put(SearchService.NORMS_LOADING_KEY, Loading.LAZY_VALUE)); + return client().admin().indices().prepareCreate(indexName).setSettings(Settings.builder().put(SINGLE_SHARD_NO_REPLICA).put(SearchService.NORMS_LOADING_KEY, Loading.LAZY_VALUE)); } }, EAGER { @Override CreateIndexRequestBuilder createIndex(String indexName, String type, String fieldName) { - return client().admin().indices().prepareCreate(indexName).setSettings(ImmutableSettings.builder().put(SINGLE_SHARD_NO_REPLICA).put(SearchService.NORMS_LOADING_KEY, Loading.EAGER_VALUE)); + return client().admin().indices().prepareCreate(indexName).setSettings(Settings.builder().put(SINGLE_SHARD_NO_REPLICA).put(SearchService.NORMS_LOADING_KEY, Loading.EAGER_VALUE)); } @Override @@ -290,7 +289,7 @@ public class SimpleIndicesWarmerTests extends ElasticsearchIntegrationTest { EAGER_PER_FIELD { @Override CreateIndexRequestBuilder createIndex(String indexName, String type, String fieldName) throws Exception { - return client().admin().indices().prepareCreate(indexName).setSettings(ImmutableSettings.builder().put(SINGLE_SHARD_NO_REPLICA).put(SearchService.NORMS_LOADING_KEY, Loading.LAZY_VALUE)).addMapping(type, JsonXContent.contentBuilder() + return client().admin().indices().prepareCreate(indexName).setSettings(Settings.builder().put(SINGLE_SHARD_NO_REPLICA).put(SearchService.NORMS_LOADING_KEY, Loading.LAZY_VALUE)).addMapping(type, JsonXContent.contentBuilder() .startObject() .startObject(type) .startObject("properties") @@ -311,7 +310,7 @@ public class SimpleIndicesWarmerTests extends ElasticsearchIntegrationTest { return false; } }; - private static Settings SINGLE_SHARD_NO_REPLICA = ImmutableSettings.builder().put("number_of_shards", 1).put("number_of_replicas", 0).build(); + private static Settings SINGLE_SHARD_NO_REPLICA = Settings.builder().put("number_of_shards", 1).put("number_of_replicas", 0).build(); abstract CreateIndexRequestBuilder createIndex(String indexName, String type, String fieldName) throws Exception; @@ -346,7 +345,7 @@ public class SimpleIndicesWarmerTests extends ElasticsearchIntegrationTest { createIndex("test"); ensureGreen(); - assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(IndicesQueryCache.INDEX_CACHE_QUERY_ENABLED, false))); + assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndicesQueryCache.INDEX_CACHE_QUERY_ENABLED, false))); logger.info("register warmer with no query cache, validate no cache is used"); assertAcked(client().admin().indices().preparePutWarmer("warmer_1") .setSearchRequest(client().prepareSearch("test").setTypes("a1").setQuery(QueryBuilders.matchAllQuery())) @@ -368,7 +367,7 @@ public class SimpleIndicesWarmerTests extends ElasticsearchIntegrationTest { assertThat(client().admin().indices().prepareStats("test").setQueryCache(true).get().getTotal().getQueryCache().getMemorySizeInBytes(), equalTo(0l)); logger.info("enable default query caching on the index level, and test that no flag on warmer still caches"); - assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(IndicesQueryCache.INDEX_CACHE_QUERY_ENABLED, true))); + assertAcked(client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndicesQueryCache.INDEX_CACHE_QUERY_ENABLED, true))); assertAcked(client().admin().indices().preparePutWarmer("warmer_1") .setSearchRequest(client().prepareSearch("test").setTypes("a1").setQuery(QueryBuilders.matchAllQuery())) diff --git a/src/test/java/org/elasticsearch/mget/SimpleMgetTests.java b/src/test/java/org/elasticsearch/mget/SimpleMgetTests.java index f9a747b734a..3ad69b71bd4 100644 --- a/src/test/java/org/elasticsearch/mget/SimpleMgetTests.java +++ b/src/test/java/org/elasticsearch/mget/SimpleMgetTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.get.MultiGetRequestBuilder; import org.elasticsearch.action.get.MultiGetResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.fetch.source.FetchSourceContext; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -145,7 +145,7 @@ public class SimpleMgetTests extends ElasticsearchIntegrationTest { @Test public void testThatRoutingPerDocumentIsSupported() throws Exception { assertAcked(prepareCreate("test").addAlias(new Alias("alias")) - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(indexSettings()) .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, between(2, DEFAULT_MAX_NUM_SHARDS)))); ensureYellow(); diff --git a/src/test/java/org/elasticsearch/nested/SimpleNestedTests.java b/src/test/java/org/elasticsearch/nested/SimpleNestedTests.java index 0f5a03180b2..4abc51cfe26 100644 --- a/src/test/java/org/elasticsearch/nested/SimpleNestedTests.java +++ b/src/test/java/org/elasticsearch/nested/SimpleNestedTests.java @@ -30,7 +30,7 @@ import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; @@ -43,7 +43,7 @@ import org.junit.Test; import java.util.ArrayList; import java.util.List; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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.filteredQuery; @@ -1203,7 +1203,7 @@ public class SimpleNestedTests extends ElasticsearchIntegrationTest { @Test public void testCheckFixedBitSetCache() throws Exception { boolean loadFixedBitSeLazily = randomBoolean(); - ImmutableSettings.Builder settingsBuilder = ImmutableSettings.builder().put(indexSettings()) + Settings.Builder settingsBuilder = Settings.builder().put(indexSettings()) .put("index.refresh_interval", -1); if (loadFixedBitSeLazily) { settingsBuilder.put("index.load_fixed_bitset_filters_eagerly", false); diff --git a/src/test/java/org/elasticsearch/network/DirectBufferNetworkTests.java b/src/test/java/org/elasticsearch/network/DirectBufferNetworkTests.java index f89d6a11e61..e41b4b4d7ef 100644 --- a/src/test/java/org/elasticsearch/network/DirectBufferNetworkTests.java +++ b/src/test/java/org/elasticsearch/network/DirectBufferNetworkTests.java @@ -19,24 +19,18 @@ package org.elasticsearch.network; -import org.apache.http.impl.client.HttpClients; import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.http.HttpServerTransport; import org.elasticsearch.node.Node; import org.elasticsearch.test.ElasticsearchIntegrationTest; -import org.elasticsearch.test.rest.client.http.HttpRequestBuilder; import org.hamcrest.Matchers; import org.junit.Test; import java.io.ByteArrayOutputStream; import java.lang.reflect.Field; -import java.net.InetSocketAddress; import java.nio.ByteBuffer; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; @@ -47,7 +41,7 @@ public class DirectBufferNetworkTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(Node.HTTP_ENABLED, true) .put(super.nodeSettings(nodeOrdinal)).build(); } diff --git a/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java b/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java index 25cc99820b6..0c4575ef254 100644 --- a/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java +++ b/src/test/java/org/elasticsearch/node/internal/InternalSettingsPreparerTests.java @@ -27,7 +27,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoTests.java b/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoTests.java index 9e29ef957bb..7b94b5ef117 100644 --- a/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoTests.java +++ b/src/test/java/org/elasticsearch/nodesinfo/SimpleNodesInfoTests.java @@ -25,26 +25,20 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.action.admin.cluster.node.info.PluginInfo; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.nodesinfo.plugin.dummy1.TestPlugin; import org.elasticsearch.nodesinfo.plugin.dummy2.TestNoVersionPlugin; import org.elasticsearch.plugins.PluginTestCase; -import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.hamcrest.ElasticsearchAssertions; import org.junit.Test; import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Paths; import java.util.Collections; import java.util.List; import static org.elasticsearch.client.Requests.clusterHealthRequest; import static org.elasticsearch.client.Requests.nodesInfoRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.*; @@ -156,7 +150,7 @@ public class SimpleNodesInfoTests extends PluginTestCase { } public String startNodeWithPlugins(int nodeId, String ... pluginClassNames) throws URISyntaxException { - return startNodeWithPlugins(ImmutableSettings.EMPTY, "/org/elasticsearch/nodesinfo/node" + Integer.toString(nodeId) + "/", pluginClassNames); + return startNodeWithPlugins(Settings.EMPTY, "/org/elasticsearch/nodesinfo/node" + Integer.toString(nodeId) + "/", pluginClassNames); } diff --git a/src/test/java/org/elasticsearch/operateAllIndices/DestructiveOperationsIntegrationTests.java b/src/test/java/org/elasticsearch/operateAllIndices/DestructiveOperationsIntegrationTests.java index 69dac24aa69..2390e3b9f85 100644 --- a/src/test/java/org/elasticsearch/operateAllIndices/DestructiveOperationsIntegrationTests.java +++ b/src/test/java/org/elasticsearch/operateAllIndices/DestructiveOperationsIntegrationTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.operateAllIndices; import org.elasticsearch.action.support.DestructiveOperations; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -37,7 +36,7 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat // One test for test performance, since cluster scope is test // The cluster scope is test b/c we can't clear cluster settings. public void testDestructiveOperations() throws Exception { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put(DestructiveOperations.REQUIRES_NAME, true) .build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings)); @@ -61,7 +60,7 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat } catch (IllegalArgumentException e) { } - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(DestructiveOperations.REQUIRES_NAME, false) .build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings)); @@ -71,7 +70,7 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat // end delete index: // close index: - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(DestructiveOperations.REQUIRES_NAME, true) .build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings)); @@ -103,7 +102,7 @@ public class DestructiveOperationsIntegrationTests extends ElasticsearchIntegrat } catch (IllegalArgumentException e) { } - settings = ImmutableSettings.builder() + settings = Settings.builder() .put(DestructiveOperations.REQUIRES_NAME, false) .build(); assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings)); diff --git a/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledTest.java b/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledTest.java index c6315ccd2e1..fa8762861e0 100644 --- a/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledTest.java +++ b/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsDisabledTest.java @@ -20,7 +20,6 @@ package org.elasticsearch.options.detailederrors; import org.apache.http.impl.client.HttpClients; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.http.HttpServerTransport; import org.elasticsearch.http.netty.NettyHttpServerTransport; @@ -44,7 +43,7 @@ public class DetailedErrorsDisabledTest extends ElasticsearchIntegrationTest { // Build our cluster settings @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(Node.HTTP_ENABLED, true) .put(NettyHttpServerTransport.SETTING_HTTP_DETAILED_ERRORS_ENABLED, false) diff --git a/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledTest.java b/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledTest.java index 350032dbd94..979e362eae0 100644 --- a/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledTest.java +++ b/src/test/java/org/elasticsearch/options/detailederrors/DetailedErrorsEnabledTest.java @@ -20,7 +20,6 @@ package org.elasticsearch.options.detailederrors; import org.apache.http.impl.client.HttpClients; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.http.HttpServerTransport; import org.elasticsearch.node.Node; @@ -43,7 +42,7 @@ public class DetailedErrorsEnabledTest extends ElasticsearchIntegrationTest { // Build our cluster settings @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(Node.HTTP_ENABLED, true) .build(); diff --git a/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java b/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java index 7dbbf6cbf4b..e14dbf60dab 100644 --- a/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java +++ b/src/test/java/org/elasticsearch/percolator/PercolatorFacetsAndAggregationsTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.percolator; import org.elasticsearch.action.percolate.PercolateRequestBuilder; import org.elasticsearch.action.percolate.PercolateResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.AggregationBuilders; @@ -201,7 +201,7 @@ public class PercolatorFacetsAndAggregationsTests extends ElasticsearchIntegrati @Test public void testSingleShardAggregations() throws Exception { - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put(indexSettings()).put("SETTING_NUMBER_OF_SHARDS", 1)) + assertAcked(prepareCreate("test").setSettings(Settings.builder().put(indexSettings()).put("SETTING_NUMBER_OF_SHARDS", 1)) .addMapping("type", "field1", "type=string", "field2", "type=string")); ensureGreen(); diff --git a/src/test/java/org/elasticsearch/percolator/PercolatorTests.java b/src/test/java/org/elasticsearch/percolator/PercolatorTests.java index 170a54240e0..487019a3333 100644 --- a/src/test/java/org/elasticsearch/percolator/PercolatorTests.java +++ b/src/test/java/org/elasticsearch/percolator/PercolatorTests.java @@ -33,8 +33,8 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.Requests; import org.elasticsearch.common.Strings; import org.elasticsearch.common.lucene.search.function.CombineFunction; -import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.common.settings.ImmutableSettings.Builder; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -65,8 +65,8 @@ import java.util.Set; import java.util.TreeSet; import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder; -import static org.elasticsearch.common.settings.ImmutableSettings.builder; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -2018,7 +2018,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { @Test 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. - ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder() + Settings.Builder settings = Settings.settingsBuilder() .put(indexSettings()) .put("index.percolator.map_unmapped_fields_as_string", true); assertAcked(prepareCreate("test") diff --git a/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java b/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java index 2917db8b8d7..7679ff6724b 100644 --- a/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java +++ b/src/test/java/org/elasticsearch/percolator/RecoveryPercolatorTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.percolator; import com.google.common.base.Predicate; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; @@ -45,7 +44,7 @@ import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder; import static org.elasticsearch.client.Requests.clusterHealthRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.percolator.PercolatorTests.convertFromTextArray; diff --git a/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java b/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java index af800643e8f..ce7549a2d1e 100644 --- a/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java +++ b/src/test/java/org/elasticsearch/percolator/TTLPercolatorTests.java @@ -37,7 +37,7 @@ import org.junit.Test; import java.io.IOException; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.percolator.PercolatorTests.convertFromTextArray; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertMatchCount; diff --git a/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleTests.java b/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleTests.java index ae3e97899b5..832d04c5d0d 100644 --- a/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleTests.java +++ b/src/test/java/org/elasticsearch/plugins/PluggableTransportModuleTests.java @@ -31,7 +31,7 @@ import org.junit.Test; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/plugins/PluginLuceneCheckerTests.java b/src/test/java/org/elasticsearch/plugins/PluginLuceneCheckerTests.java index b7c37f1c83a..1a44b1192eb 100644 --- a/src/test/java/org/elasticsearch/plugins/PluginLuceneCheckerTests.java +++ b/src/test/java/org/elasticsearch/plugins/PluginLuceneCheckerTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.plugins; import com.google.common.collect.Lists; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; -import org.elasticsearch.nodesinfo.SimpleNodesInfoTests; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.hamcrest.ElasticsearchAssertions; @@ -30,7 +29,7 @@ import org.junit.Test; import java.net.URISyntaxException; import java.util.Collections; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * diff --git a/src/test/java/org/elasticsearch/plugins/PluginManagerTests.java b/src/test/java/org/elasticsearch/plugins/PluginManagerTests.java index 21fa628f2a8..5d9c3ba4938 100644 --- a/src/test/java/org/elasticsearch/plugins/PluginManagerTests.java +++ b/src/test/java/org/elasticsearch/plugins/PluginManagerTests.java @@ -27,7 +27,6 @@ import org.elasticsearch.ElasticsearchTimeoutException; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.action.admin.cluster.node.info.PluginInfo; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.env.Environment; @@ -281,7 +280,7 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest { } private Tuple buildInitialSettings() throws IOException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("discovery.zen.ping.multicast.enabled", false) .put("http.enabled", true) .put("path.home", createTempDir()).build(); diff --git a/src/test/java/org/elasticsearch/plugins/PluginManagerUnitTests.java b/src/test/java/org/elasticsearch/plugins/PluginManagerUnitTests.java index 4208075ccf7..3dfb7a04c5b 100644 --- a/src/test/java/org/elasticsearch/plugins/PluginManagerUnitTests.java +++ b/src/test/java/org/elasticsearch/plugins/PluginManagerUnitTests.java @@ -29,7 +29,7 @@ import org.junit.Test; import java.io.IOException; import java.nio.file.Path; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; /** diff --git a/src/test/java/org/elasticsearch/plugins/PluginServiceTests.java b/src/test/java/org/elasticsearch/plugins/PluginServiceTests.java index 5527f2d4698..18f826033c4 100644 --- a/src/test/java/org/elasticsearch/plugins/PluginServiceTests.java +++ b/src/test/java/org/elasticsearch/plugins/PluginServiceTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.cluster.node.info.PluginInfo; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.nodesinfo.SimpleNodesInfoTests; import org.elasticsearch.plugins.loading.classpath.InClassPathPlugin; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; @@ -34,9 +33,8 @@ import org.junit.Test; import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.PathMatcher; -import java.nio.file.Paths; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.endsWith; import static org.hamcrest.Matchers.instanceOf; diff --git a/src/test/java/org/elasticsearch/plugins/PluginTestCase.java b/src/test/java/org/elasticsearch/plugins/PluginTestCase.java index 1b0668120da..dd3cb164aaa 100644 --- a/src/test/java/org/elasticsearch/plugins/PluginTestCase.java +++ b/src/test/java/org/elasticsearch/plugins/PluginTestCase.java @@ -20,7 +20,6 @@ package org.elasticsearch.plugins; import org.elasticsearch.cluster.ClusterService; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Ignore; @@ -29,7 +28,7 @@ import java.net.URISyntaxException; import java.net.URL; import static org.elasticsearch.client.Requests.clusterHealthRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * Base class that lets you start a node with plugins. @@ -39,7 +38,7 @@ public abstract class PluginTestCase extends ElasticsearchIntegrationTest { public String startNodeWithPlugins(Settings nodeSettings, String pluginDir, String ... pluginClassNames) throws URISyntaxException { URL resource = getClass().getResource(pluginDir); - ImmutableSettings.Builder settings = settingsBuilder(); + Settings.Builder settings = settingsBuilder(); settings.put(nodeSettings); if (resource != null) { settings.put("path.plugins", getDataPath(pluginDir).toAbsolutePath()); diff --git a/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginTests.java b/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginTests.java index 148f81391de..96673555e09 100644 --- a/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginTests.java +++ b/src/test/java/org/elasticsearch/plugins/ResponseHeaderPluginTests.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.plugins; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.responseheader.TestResponseHeaderPlugin; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -40,7 +39,7 @@ public class ResponseHeaderPluginTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put("plugin.types", TestResponseHeaderPlugin.class.getName()) .put("force.http.enabled", true) diff --git a/src/test/java/org/elasticsearch/plugins/SitePluginRelativePathConfigTests.java b/src/test/java/org/elasticsearch/plugins/SitePluginRelativePathConfigTests.java index 83755d7980c..d350e43c0f4 100644 --- a/src/test/java/org/elasticsearch/plugins/SitePluginRelativePathConfigTests.java +++ b/src/test/java/org/elasticsearch/plugins/SitePluginRelativePathConfigTests.java @@ -32,7 +32,7 @@ import org.junit.Test; import java.nio.file.Path; import static org.apache.lucene.util.Constants.WINDOWS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.SUITE; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasStatus; diff --git a/src/test/java/org/elasticsearch/plugins/SitePluginTests.java b/src/test/java/org/elasticsearch/plugins/SitePluginTests.java index 8df880a3aa3..35ae9844fc1 100644 --- a/src/test/java/org/elasticsearch/plugins/SitePluginTests.java +++ b/src/test/java/org/elasticsearch/plugins/SitePluginTests.java @@ -34,7 +34,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.rest.RestStatus.*; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasStatus; diff --git a/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java b/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java index b73215dfee0..dd859b46fb4 100644 --- a/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java +++ b/src/test/java/org/elasticsearch/recovery/FullRollingRestartTests.java @@ -19,12 +19,10 @@ package org.elasticsearch.recovery; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.common.Priority; import org.elasticsearch.common.collect.MapBuilder; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.zen.ZenDiscovery; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -57,7 +55,7 @@ public class FullRollingRestartTests extends ElasticsearchIntegrationTest { @Test @Slow public void testFullRollingRestart() throws Exception { - Settings settings = ImmutableSettings.builder().put(ZenDiscovery.SETTING_JOIN_TIMEOUT, "30s").build(); + Settings settings = Settings.builder().put(ZenDiscovery.SETTING_JOIN_TIMEOUT, "30s").build(); internalCluster().startNode(settings); createIndex("test"); diff --git a/src/test/java/org/elasticsearch/recovery/RecoveriesCollectionTests.java b/src/test/java/org/elasticsearch/recovery/RecoveriesCollectionTests.java index db256bc9a19..37bf22aa470 100644 --- a/src/test/java/org/elasticsearch/recovery/RecoveriesCollectionTests.java +++ b/src/test/java/org/elasticsearch/recovery/RecoveriesCollectionTests.java @@ -23,7 +23,7 @@ import com.google.common.base.Predicates; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.shard.IndexShard; @@ -160,7 +160,7 @@ public class RecoveriesCollectionTests extends ElasticsearchSingleNodeTest { protected void createIndex() { createIndex("test", - ImmutableSettings.builder() + Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1, IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .build()); ensureGreen(); diff --git a/src/test/java/org/elasticsearch/recovery/RecoverySettingsTest.java b/src/test/java/org/elasticsearch/recovery/RecoverySettingsTest.java index 1afeea039d6..998b4a5bbd2 100644 --- a/src/test/java/org/elasticsearch/recovery/RecoverySettingsTest.java +++ b/src/test/java/org/elasticsearch/recovery/RecoverySettingsTest.java @@ -18,7 +18,7 @@ */ package org.elasticsearch.recovery; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.recovery.RecoverySettings; import org.elasticsearch.test.ElasticsearchSingleNodeTest; import org.junit.Test; @@ -116,12 +116,12 @@ public class RecoverySettingsTest extends ElasticsearchSingleNodeTest { } private void innerTestSettings(String key, int newValue, Validator validator) { - client().admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableSettings.builder().put(key, newValue)).get(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(key, newValue)).get(); validator.validate(getInstanceFromNode(RecoverySettings.class), newValue); } private void innerTestSettings(String key, boolean newValue, Validator validator) { - client().admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableSettings.builder().put(key, newValue)).get(); + client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(key, newValue)).get(); validator.validate(getInstanceFromNode(RecoverySettings.class), newValue); } diff --git a/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java b/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java index 547fc0858c4..cccfe8024b7 100644 --- a/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java +++ b/src/test/java/org/elasticsearch/recovery/RecoveryWhileUnderLoadTests.java @@ -20,12 +20,10 @@ package org.elasticsearch.recovery; import com.google.common.base.Predicate; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; import org.elasticsearch.common.Priority; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; @@ -35,7 +33,6 @@ import org.elasticsearch.index.translog.Translog; import org.elasticsearch.index.translog.TranslogConfig; import org.elasticsearch.test.BackgroundIndexer; import org.elasticsearch.test.ElasticsearchIntegrationTest; -import org.elasticsearch.test.junit.annotations.TestLogging; import org.junit.Test; import java.util.Arrays; @@ -43,7 +40,7 @@ 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/recovery/RelocationTests.java b/src/test/java/org/elasticsearch/recovery/RelocationTests.java index 2d8c3881161..cd4a337e7e7 100644 --- a/src/test/java/org/elasticsearch/recovery/RelocationTests.java +++ b/src/test/java/org/elasticsearch/recovery/RelocationTests.java @@ -24,7 +24,6 @@ import com.carrotsearch.hppc.procedures.IntProcedure; import com.google.common.base.Predicate; import com.google.common.util.concurrent.ListenableFuture; import org.apache.lucene.index.IndexFileNames; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; @@ -33,10 +32,8 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.ClusterStateListener; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.ShardRoutingState; @@ -45,11 +42,9 @@ import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDeci import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Priority; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.discovery.DiscoveryService; -import org.elasticsearch.discovery.DiscoverySettings; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.IndexShardState; @@ -80,7 +75,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; @@ -95,7 +90,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()).build(); } @@ -107,7 +102,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest { logger.info("--> creating test index ..."); client().admin().indices().prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) ) @@ -363,9 +358,9 @@ public class RelocationTests extends ElasticsearchIntegrationTest { public void testMoveShardsWhileRelocation() throws Exception { final String indexName = "test"; - ListenableFuture blueFuture = internalCluster().startNodeAsync(ImmutableSettings.builder().put("node.color", "blue").build()); - ListenableFuture redFuture = internalCluster().startNodeAsync(ImmutableSettings.builder().put("node.color", "red").build()); - internalCluster().startNode(ImmutableSettings.builder().put("node.color", "green").build()); + ListenableFuture blueFuture = internalCluster().startNodeAsync(Settings.builder().put("node.color", "blue").build()); + ListenableFuture redFuture = internalCluster().startNodeAsync(Settings.builder().put("node.color", "red").build()); + internalCluster().startNode(Settings.builder().put("node.color", "green").build()); final String blueNodeName = blueFuture.get(); final String redNodeName = redFuture.get(); @@ -375,7 +370,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest { client().admin().indices().prepareCreate(indexName) .setSettings( - ImmutableSettings.builder() + Settings.builder() .put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "blue") .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) ).get(); @@ -400,7 +395,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest { IndicesStatsResponse statsResponse = client().admin().indices().prepareStats(indexName).get(); long chunkSize = statsResponse.getIndex(indexName).getShards()[0].getStats().getStore().size().bytes() / 10; assertTrue(client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder() + .setTransientSettings(Settings.builder() // one chunk per sec.. .put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC, chunkSize) .put(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, chunkSize) @@ -408,7 +403,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest { .get().isAcknowledged()); client().admin().indices().prepareUpdateSettings(indexName).setSettings( - ImmutableSettings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red") + Settings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "red") ).get(); // Lets wait a bit and then move again to hopefully trigger recovery cancellations. @@ -424,12 +419,12 @@ public class RelocationTests extends ElasticsearchIntegrationTest { ); assertTrue(applied); client().admin().indices().prepareUpdateSettings(indexName).setSettings( - ImmutableSettings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "green") + Settings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + "color", "green") ).get(); // Restore the recovery speed to not timeout cluster health call assertTrue(client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder() + .setTransientSettings(Settings.builder() .put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC, "20mb") .put(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, "512kb") ) @@ -452,7 +447,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest { final String p_node = internalCluster().startNode(); client().admin().indices().prepareCreate(indexName) - .setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1, IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)).get(); + .setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1, IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)).get(); internalCluster().startNodesAsync(2).get(); @@ -476,13 +471,13 @@ public class RelocationTests extends ElasticsearchIntegrationTest { } } - client().admin().indices().prepareUpdateSettings(indexName).setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)).get(); + client().admin().indices().prepareUpdateSettings(indexName).setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)).get(); corruptionCount.await(); logger.info("--> stopping replica assignment"); assertAcked(client().admin().cluster().prepareUpdateSettings() - .setTransientSettings(ImmutableSettings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, "none"))); + .setTransientSettings(Settings.builder().put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, "none"))); logger.info("--> wait for all replica shards to be removed, on all nodes"); assertBusy(new Runnable() { diff --git a/src/test/java/org/elasticsearch/recovery/SimpleRecoveryTests.java b/src/test/java/org/elasticsearch/recovery/SimpleRecoveryTests.java index 610d5786a04..f91ce01967c 100644 --- a/src/test/java/org/elasticsearch/recovery/SimpleRecoveryTests.java +++ b/src/test/java/org/elasticsearch/recovery/SimpleRecoveryTests.java @@ -22,13 +22,12 @@ package org.elasticsearch.recovery; import org.elasticsearch.action.admin.indices.flush.FlushResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; import static org.elasticsearch.client.Requests.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -40,7 +39,7 @@ public class SimpleRecoveryTests extends ElasticsearchIntegrationTest { } protected Settings recoverySettings() { - return ImmutableSettings.Builder.EMPTY_SETTINGS; + return Settings.Builder.EMPTY_SETTINGS; } @Override diff --git a/src/test/java/org/elasticsearch/recovery/SmallFileChunkSizeRecoveryTests.java b/src/test/java/org/elasticsearch/recovery/SmallFileChunkSizeRecoveryTests.java index a69abf40434..eb2f0af69ee 100644 --- a/src/test/java/org/elasticsearch/recovery/SmallFileChunkSizeRecoveryTests.java +++ b/src/test/java/org/elasticsearch/recovery/SmallFileChunkSizeRecoveryTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.recovery; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; /** @@ -29,6 +28,6 @@ public class SmallFileChunkSizeRecoveryTests extends SimpleRecoveryTests { @Override protected Settings recoverySettings() { - return ImmutableSettings.settingsBuilder().put("index.shard.recovery.file_chunk_size", "3b").build(); + return Settings.settingsBuilder().put("index.shard.recovery.file_chunk_size", "3b").build(); } } diff --git a/src/test/java/org/elasticsearch/recovery/SmallTranslogOpsRecoveryTests.java b/src/test/java/org/elasticsearch/recovery/SmallTranslogOpsRecoveryTests.java index 7ddabae20fb..d565bacfd55 100644 --- a/src/test/java/org/elasticsearch/recovery/SmallTranslogOpsRecoveryTests.java +++ b/src/test/java/org/elasticsearch/recovery/SmallTranslogOpsRecoveryTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.recovery; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; /** @@ -29,6 +28,6 @@ public class SmallTranslogOpsRecoveryTests extends SimpleRecoveryTests { @Override protected Settings recoverySettings() { - return ImmutableSettings.settingsBuilder().put("index.shard.recovery.translog_ops", 1).build(); + return Settings.settingsBuilder().put("index.shard.recovery.translog_ops", 1).build(); } } diff --git a/src/test/java/org/elasticsearch/recovery/SmallTranslogSizeRecoveryTests.java b/src/test/java/org/elasticsearch/recovery/SmallTranslogSizeRecoveryTests.java index d74940cac48..500b1c74ca5 100644 --- a/src/test/java/org/elasticsearch/recovery/SmallTranslogSizeRecoveryTests.java +++ b/src/test/java/org/elasticsearch/recovery/SmallTranslogSizeRecoveryTests.java @@ -19,7 +19,6 @@ package org.elasticsearch.recovery; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; /** @@ -29,6 +28,6 @@ public class SmallTranslogSizeRecoveryTests extends SimpleRecoveryTests { @Override protected Settings recoverySettings() { - return ImmutableSettings.settingsBuilder().put("index.shard.recovery.translog_size", "3b").build(); + return Settings.settingsBuilder().put("index.shard.recovery.translog_size", "3b").build(); } } diff --git a/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryTests.java b/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryTests.java index 6a22599b634..02656e9e4e0 100644 --- a/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryTests.java +++ b/src/test/java/org/elasticsearch/recovery/TruncatedRecoveryTests.java @@ -26,7 +26,6 @@ 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.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -47,7 +46,7 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -57,7 +56,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; public class TruncatedRecoveryTests extends ElasticsearchIntegrationTest { protected Settings nodeSettings(int nodeOrdinal) { - ImmutableSettings.Builder builder = ImmutableSettings.builder() + Settings.Builder builder = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, MockTransportService.class.getName()) .put(RecoverySettings.INDICES_RECOVERY_FILE_CHUNK_SIZE, new ByteSizeValue(randomIntBetween(50, 300), ByteSizeUnit.BYTES)); diff --git a/src/test/java/org/elasticsearch/rest/CorsRegexDefaultTests.java b/src/test/java/org/elasticsearch/rest/CorsRegexDefaultTests.java index ba129d0dc9a..da5da159223 100644 --- a/src/test/java/org/elasticsearch/rest/CorsRegexDefaultTests.java +++ b/src/test/java/org/elasticsearch/rest/CorsRegexDefaultTests.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.rest; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -34,7 +33,7 @@ public class CorsRegexDefaultTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(Node.HTTP_ENABLED, true) .put(super.nodeSettings(nodeOrdinal)).build(); } diff --git a/src/test/java/org/elasticsearch/rest/CorsRegexTests.java b/src/test/java/org/elasticsearch/rest/CorsRegexTests.java index ceb7acba016..8e568d847cf 100644 --- a/src/test/java/org/elasticsearch/rest/CorsRegexTests.java +++ b/src/test/java/org/elasticsearch/rest/CorsRegexTests.java @@ -18,21 +18,14 @@ */ package org.elasticsearch.rest; -import org.apache.http.impl.client.HttpClients; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; 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.ElasticsearchIntegrationTest; -import org.elasticsearch.test.rest.client.http.HttpRequestBuilder; import org.elasticsearch.test.rest.client.http.HttpResponse; import org.junit.Test; -import java.net.InetSocketAddress; - import static org.elasticsearch.http.netty.NettyHttpServerTransport.SETTING_CORS_ALLOW_ORIGIN; import static org.elasticsearch.http.netty.NettyHttpServerTransport.SETTING_CORS_ALLOW_CREDENTIALS; import static org.elasticsearch.http.netty.NettyHttpServerTransport.SETTING_CORS_ENABLED; @@ -51,7 +44,7 @@ public class CorsRegexTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(SETTING_CORS_ALLOW_ORIGIN, "/https?:\\/\\/localhost(:[0-9]+)?/") .put(SETTING_CORS_ALLOW_CREDENTIALS, true) diff --git a/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java b/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java index af07a25f3ae..9d87de9a354 100644 --- a/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java +++ b/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java @@ -35,7 +35,6 @@ import org.elasticsearch.client.*; import org.elasticsearch.client.support.AbstractClient; import org.elasticsearch.client.support.Headers; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.rest.FakeRestRequest; @@ -56,7 +55,7 @@ public class HeadersAndContextCopyClientTests extends ElasticsearchTestCase { @Test public void testRegisterRelevantHeaders() throws InterruptedException { - final RestController restController = new RestController(ImmutableSettings.EMPTY); + final RestController restController = new RestController(Settings.EMPTY); int iterations = randomIntBetween(1, 5); @@ -425,7 +424,7 @@ public class HeadersAndContextCopyClientTests extends ElasticsearchTestCase { private class NoOpClient extends AbstractClient { public NoOpClient() { - super(ImmutableSettings.EMPTY, new ThreadPool(getTestName()), Headers.EMPTY); + super(Settings.EMPTY, new ThreadPool(getTestName()), Headers.EMPTY); } @Override diff --git a/src/test/java/org/elasticsearch/rest/RestFilterChainTests.java b/src/test/java/org/elasticsearch/rest/RestFilterChainTests.java index ecf63fdd662..dc537468c28 100644 --- a/src/test/java/org/elasticsearch/rest/RestFilterChainTests.java +++ b/src/test/java/org/elasticsearch/rest/RestFilterChainTests.java @@ -23,7 +23,7 @@ import com.google.common.collect.Lists; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.rest.FakeRestRequest; @@ -42,7 +42,7 @@ public class RestFilterChainTests extends ElasticsearchTestCase { @Test public void testRestFilters() throws InterruptedException { - RestController restController = new RestController(ImmutableSettings.EMPTY); + RestController restController = new RestController(Settings.EMPTY); int numFilters = randomInt(10); Set orders = new HashSet<>(numFilters); @@ -130,7 +130,7 @@ public class RestFilterChainTests extends ElasticsearchTestCase { } }); - RestController restController = new RestController(ImmutableSettings.EMPTY); + RestController restController = new RestController(Settings.EMPTY); restController.registerFilter(testFilter); restController.registerHandler(RestRequest.Method.GET, "/", new RestHandler() { diff --git a/src/test/java/org/elasticsearch/rest/action/admin/indices/upgrade/UpgradeTest.java b/src/test/java/org/elasticsearch/rest/action/admin/indices/upgrade/UpgradeTest.java index 264d1385874..3ea5747899c 100644 --- a/src/test/java/org/elasticsearch/rest/action/admin/indices/upgrade/UpgradeTest.java +++ b/src/test/java/org/elasticsearch/rest/action/admin/indices/upgrade/UpgradeTest.java @@ -20,7 +20,6 @@ package org.elasticsearch.rest.action.admin.indices.upgrade; import com.google.common.base.Predicate; -import org.apache.http.impl.client.HttpClients; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.segments.IndexSegments; @@ -32,7 +31,6 @@ import org.elasticsearch.cluster.routing.allocation.decider.ConcurrentRebalanceA import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.engine.Segment; import org.elasticsearch.node.Node; @@ -43,7 +41,6 @@ import org.elasticsearch.test.rest.client.http.HttpResponse; import org.elasticsearch.test.rest.json.JsonPath; import org.junit.BeforeClass; -import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -67,7 +64,7 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest { public void testUpgrade() throws Exception { // allow the cluster to rebalance quickly - 2 concurrent rebalance are default we can do higher - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); builder.put(ConcurrentRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_CLUSTER_CONCURRENT_REBALANCE, 100); client().admin().cluster().prepareUpdateSettings().setPersistentSettings(builder).get(); @@ -77,7 +74,7 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest { final String indexName = "test" + i; indexNames[i] = indexName; - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("index.routing.allocation.exclude._name", backwardsCluster().newNodePattern()) // don't allow any merges so that we can check segments are upgraded // by the upgrader, and not just regular merging @@ -124,11 +121,11 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest { backwardsCluster().allowOnAllNodes(indexNames); ensureGreen(); // disable allocation entirely until all nodes are upgraded - builder = ImmutableSettings.builder(); + builder = Settings.builder(); builder.put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, EnableAllocationDecider.Allocation.NONE); client().admin().cluster().prepareUpdateSettings().setTransientSettings(builder).get(); backwardsCluster().upgradeAllNodes(); - builder = ImmutableSettings.builder(); + builder = Settings.builder(); // disable rebalanceing entirely for the time being otherwise we might get relocations / rebalance from nodes with old segments builder.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE); builder.put(EnableAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ENABLE, EnableAllocationDecider.Allocation.ALL); @@ -311,7 +308,7 @@ public class UpgradeTest extends ElasticsearchBackwardsCompatIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put(Node.HTTP_ENABLED, true).build(); } } diff --git a/src/test/java/org/elasticsearch/rest/util/RestUtilsTests.java b/src/test/java/org/elasticsearch/rest/util/RestUtilsTests.java index 74a52c99323..b3bf486b1de 100644 --- a/src/test/java/org/elasticsearch/rest/util/RestUtilsTests.java +++ b/src/test/java/org/elasticsearch/rest/util/RestUtilsTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.rest.util; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.support.RestUtils; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; @@ -29,7 +29,7 @@ import java.util.Map; import java.util.regex.Pattern; import static com.google.common.collect.Maps.newHashMap; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** @@ -137,7 +137,7 @@ public class RestUtilsTests extends ElasticsearchTestCase { assertCorsSettingRegexIsNull("/foo"); assertCorsSettingRegexIsNull("foo"); assertCorsSettingRegexIsNull(""); - assertThat(RestUtils.getCorsSettingRegex(ImmutableSettings.EMPTY), is(nullValue())); + assertThat(RestUtils.getCorsSettingRegex(Settings.EMPTY), is(nullValue())); } private void assertCorsSettingRegexIsNull(String settingsValue) { diff --git a/src/test/java/org/elasticsearch/script/CustomScriptContextTests.java b/src/test/java/org/elasticsearch/script/CustomScriptContextTests.java index b2acd54a373..8ad776773ce 100644 --- a/src/test/java/org/elasticsearch/script/CustomScriptContextTests.java +++ b/src/test/java/org/elasticsearch/script/CustomScriptContextTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.script; import com.google.common.collect.ImmutableSet; import org.elasticsearch.common.inject.Module; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.AbstractPlugin; import org.elasticsearch.script.expression.ExpressionScriptEngineService; @@ -42,7 +41,7 @@ public class CustomScriptContextTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put("plugin.types", CustomScriptContextPlugin.class.getName()) .put("script." + PLUGIN_NAME + "_custom_globally_disabled_op", "off") .put("script.engine.expression.inline." + PLUGIN_NAME + "_custom_exp_disabled_op", "off") diff --git a/src/test/java/org/elasticsearch/script/GroovySecurityTests.java b/src/test/java/org/elasticsearch/script/GroovySecurityTests.java index 1fc65e9e9c9..bee96f43b64 100644 --- a/src/test/java/org/elasticsearch/script/GroovySecurityTests.java +++ b/src/test/java/org/elasticsearch/script/GroovySecurityTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.script; import org.apache.lucene.util.Constants; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -47,7 +46,7 @@ public class GroovySecurityTests extends ElasticsearchIntegrationTest { @Test public void testEvilGroovyScripts() throws Exception { int nodes = randomIntBetween(1, 3); - Settings nodeSettings = ImmutableSettings.builder() + Settings nodeSettings = Settings.builder() .put("script.inline", true) .put("script.indexed", true) .build(); diff --git a/src/test/java/org/elasticsearch/script/IndexLookupTests.java b/src/test/java/org/elasticsearch/script/IndexLookupTests.java index cc1900a3fb2..b8aa3a8f3e5 100644 --- a/src/test/java/org/elasticsearch/script/IndexLookupTests.java +++ b/src/test/java/org/elasticsearch/script/IndexLookupTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.script; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; @@ -131,7 +131,7 @@ public class IndexLookupTests extends ElasticsearchIntegrationTest { .startObject("int_payload_field").field("type", "string").field("index_options", "offsets") .field("analyzer", "payload_int").endObject().endObject().endObject().endObject(); assertAcked(prepareCreate("test").addMapping("type1", mapping).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer.payload_int.tokenizer", "whitespace") .putArray("index.analysis.analyzer.payload_int.filter", "delimited_int") @@ -406,7 +406,7 @@ public class IndexLookupTests extends ElasticsearchIntegrationTest { .startObject("int_payload_field").field("type", "string").field("index_options", "offsets") .field("analyzer", "payload_int").endObject().endObject().endObject().endObject(); assertAcked(prepareCreate("test").addMapping("type1", mapping).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put(indexSettings()) .put("index.analysis.analyzer.payload_float.tokenizer", "whitespace") .putArray("index.analysis.analyzer.payload_float.filter", "delimited_float") diff --git a/src/test/java/org/elasticsearch/script/IndexedScriptTests.java b/src/test/java/org/elasticsearch/script/IndexedScriptTests.java index 2eb881156bd..d3dbcb78e17 100644 --- a/src/test/java/org/elasticsearch/script/IndexedScriptTests.java +++ b/src/test/java/org/elasticsearch/script/IndexedScriptTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.indexedscripts.put.PutIndexedScriptResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.script.expression.ExpressionScriptEngineService; @@ -45,7 +44,7 @@ public class IndexedScriptTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - ImmutableSettings.Builder builder = ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)); + Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal)); builder.put("script.engine.groovy.indexed.update", "off"); builder.put("script.engine.groovy.indexed.search", "on"); builder.put("script.engine.groovy.indexed.aggs", "on"); diff --git a/src/test/java/org/elasticsearch/script/NativeScriptTests.java b/src/test/java/org/elasticsearch/script/NativeScriptTests.java index fdccd77ee5e..c478c6d313c 100644 --- a/src/test/java/org/elasticsearch/script/NativeScriptTests.java +++ b/src/test/java/org/elasticsearch/script/NativeScriptTests.java @@ -24,7 +24,6 @@ import com.google.common.collect.Lists; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.inject.Injector; import org.elasticsearch.common.inject.ModulesBuilder; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.env.Environment; @@ -48,7 +47,7 @@ public class NativeScriptTests extends ElasticsearchTestCase { @Test public void testNativeScript() throws InterruptedException { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("script.native.my.type", MyNativeScriptFactory.class.getName()) .put("name", "testNativeScript") .put("path.home", createTempDir()) @@ -68,7 +67,7 @@ public class NativeScriptTests extends ElasticsearchTestCase { @Test public void testFineGrainedSettingsDontAffectNativeScripts() throws IOException { - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder(); + Settings.Builder builder = Settings.settingsBuilder(); if (randomBoolean()) { ScriptType scriptType = randomFrom(ScriptType.values()); builder.put(ScriptModes.SCRIPT_SETTINGS_PREFIX + scriptType, randomFrom(ScriptMode.values())); diff --git a/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java b/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java index 88471f712b4..ea464c489b6 100644 --- a/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java +++ b/src/test/java/org/elasticsearch/script/OnDiskScriptTests.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.script; -import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; @@ -31,7 +30,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/script/ScriptFieldTests.java b/src/test/java/org/elasticsearch/script/ScriptFieldTests.java index 000e50062ed..6c6a022fb31 100644 --- a/src/test/java/org/elasticsearch/script/ScriptFieldTests.java +++ b/src/test/java/org/elasticsearch/script/ScriptFieldTests.java @@ -31,7 +31,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import java.util.Map; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/script/ScriptModesTests.java b/src/test/java/org/elasticsearch/script/ScriptModesTests.java index f0051d188bb..1ea2145e03b 100644 --- a/src/test/java/org/elasticsearch/script/ScriptModesTests.java +++ b/src/test/java/org/elasticsearch/script/ScriptModesTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.script; import com.google.common.collect.*; import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.script.ScriptService.ScriptType; import org.elasticsearch.script.expression.ExpressionScriptEngineService; import org.elasticsearch.script.groovy.GroovyScriptEngineService; @@ -67,11 +67,11 @@ public class ScriptModesTests extends ElasticsearchTestCase { scriptContextRegistry = new ScriptContextRegistry(contexts.values()); scriptContexts = scriptContextRegistry.scriptContexts().toArray(new ScriptContext[scriptContextRegistry.scriptContexts().size()]); scriptEngines = buildScriptEnginesByLangMap(ImmutableSet.of( - new GroovyScriptEngineService(ImmutableSettings.EMPTY), - new MustacheScriptEngineService(ImmutableSettings.EMPTY), - new ExpressionScriptEngineService(ImmutableSettings.EMPTY), + new GroovyScriptEngineService(Settings.EMPTY), + new MustacheScriptEngineService(Settings.EMPTY), + new ExpressionScriptEngineService(Settings.EMPTY), //add the native engine just to make sure it gets filtered out - new NativeScriptEngineService(ImmutableSettings.EMPTY, Collections.emptyMap()), + new NativeScriptEngineService(Settings.EMPTY, Collections.emptyMap()), new CustomScriptEngineService())); checkedSettings = new HashSet<>(); assertAllSettingsWereChecked = true; @@ -100,7 +100,7 @@ public class ScriptModesTests extends ElasticsearchTestCase { @Test public void testDefaultSettings() { - this.scriptModes = new ScriptModes(scriptEngines, scriptContextRegistry, ImmutableSettings.EMPTY); + this.scriptModes = new ScriptModes(scriptEngines, scriptContextRegistry, Settings.EMPTY); assertScriptModesAllOps(ScriptMode.ON, ALL_LANGS, ScriptType.FILE); assertScriptModesAllOps(ScriptMode.SANDBOX, ALL_LANGS, ScriptType.INDEXED, ScriptType.INLINE); } @@ -108,7 +108,7 @@ public class ScriptModesTests extends ElasticsearchTestCase { @Test(expected = IllegalArgumentException.class) public void testMissingSetting() { assertAllSettingsWereChecked = false; - this.scriptModes = new ScriptModes(scriptEngines, scriptContextRegistry, ImmutableSettings.EMPTY); + this.scriptModes = new ScriptModes(scriptEngines, scriptContextRegistry, Settings.EMPTY); scriptModes.getScriptMode("non_existing", randomFrom(ScriptType.values()), randomFrom(scriptContexts)); } @@ -125,7 +125,7 @@ public class ScriptModesTests extends ElasticsearchTestCase { randomScriptModes[i] = randomFrom(ScriptMode.values()); } ScriptType[] randomScriptTypes = randomScriptTypesSet.toArray(new ScriptType[randomScriptTypesSet.size()]); - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); for (int i = 0; i < randomInt; i++) { builder.put(ScriptModes.SCRIPT_SETTINGS_PREFIX + randomScriptTypes[i], randomScriptModes[i]); } @@ -158,7 +158,7 @@ public class ScriptModesTests extends ElasticsearchTestCase { randomScriptModes[i] = randomFrom(ScriptMode.values()); } ScriptContext[] randomScriptContexts = randomScriptContextsSet.toArray(new ScriptContext[randomScriptContextsSet.size()]); - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); for (int i = 0; i < randomInt; i++) { builder.put(ScriptModes.SCRIPT_SETTINGS_PREFIX + randomScriptContexts[i].getKey(), randomScriptModes[i]); } @@ -176,7 +176,7 @@ public class ScriptModesTests extends ElasticsearchTestCase { @Test public void testConflictingScriptTypeAndOpGenericSettings() { ScriptContext scriptContext = randomFrom(scriptContexts); - ImmutableSettings.Builder builder = ImmutableSettings.builder().put(ScriptModes.SCRIPT_SETTINGS_PREFIX + scriptContext.getKey(), randomFrom(DISABLE_VALUES)) + Settings.Builder builder = Settings.builder().put(ScriptModes.SCRIPT_SETTINGS_PREFIX + scriptContext.getKey(), randomFrom(DISABLE_VALUES)) .put("script.indexed", randomFrom(ENABLE_VALUES)).put("script.inline", ScriptMode.SANDBOX); //operations generic settings have precedence over script type generic settings this.scriptModes = new ScriptModes(scriptEngines, scriptContextRegistry, builder.build()); @@ -188,7 +188,7 @@ public class ScriptModesTests extends ElasticsearchTestCase { @Test public void testEngineSpecificSettings() { - ImmutableSettings.Builder builder = ImmutableSettings.builder() + Settings.Builder builder = Settings.builder() .put(specificEngineOpSettings(GroovyScriptEngineService.NAME, ScriptType.INLINE, ScriptContext.Standard.MAPPING), randomFrom(DISABLE_VALUES)) .put(specificEngineOpSettings(GroovyScriptEngineService.NAME, ScriptType.INLINE, ScriptContext.Standard.UPDATE), randomFrom(DISABLE_VALUES)); ImmutableSet groovyLangSet = ImmutableSet.of(GroovyScriptEngineService.NAME); @@ -204,7 +204,7 @@ public class ScriptModesTests extends ElasticsearchTestCase { @Test public void testInteractionBetweenGenericAndEngineSpecificSettings() { - ImmutableSettings.Builder builder = ImmutableSettings.builder().put("script.inline", randomFrom(DISABLE_VALUES)) + Settings.Builder builder = Settings.builder().put("script.inline", randomFrom(DISABLE_VALUES)) .put(specificEngineOpSettings(MustacheScriptEngineService.NAME, ScriptType.INLINE, ScriptContext.Standard.AGGS), randomFrom(ENABLE_VALUES)) .put(specificEngineOpSettings(MustacheScriptEngineService.NAME, ScriptType.INLINE, ScriptContext.Standard.SEARCH), randomFrom(ENABLE_VALUES)); ImmutableSet mustacheLangSet = ImmutableSet.of(MustacheScriptEngineService.NAME); diff --git a/src/test/java/org/elasticsearch/script/ScriptServiceTests.java b/src/test/java/org/elasticsearch/script/ScriptServiceTests.java index c3f164ab25f..862831606d3 100644 --- a/src/test/java/org/elasticsearch/script/ScriptServiceTests.java +++ b/src/test/java/org/elasticsearch/script/ScriptServiceTests.java @@ -22,7 +22,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.Streams; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.script.ScriptService.ScriptType; @@ -42,7 +41,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.Matchers.*; @@ -100,7 +99,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { } private void buildScriptService(Settings additionalSettings) throws IOException { - Settings finalSettings = ImmutableSettings.builder().put(baseSettings).put(additionalSettings).build(); + Settings finalSettings = Settings.builder().put(baseSettings).put(additionalSettings).build(); Environment environment = new Environment(finalSettings); scriptService = new ScriptService(finalSettings, environment, scriptEngineServices, resourceWatcherService, scriptContextRegistry) { @Override @@ -114,7 +113,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { @Test public void testNotSupportedDisableDynamicSetting() throws IOException { try { - buildScriptService(ImmutableSettings.builder().put(ScriptService.DISABLE_DYNAMIC_SCRIPTING_SETTING, randomUnicodeOfLength(randomIntBetween(1, 10))).build()); + buildScriptService(Settings.builder().put(ScriptService.DISABLE_DYNAMIC_SCRIPTING_SETTING, randomUnicodeOfLength(randomIntBetween(1, 10))).build()); fail("script service should have thrown exception due to non supported script.disable_dynamic setting"); } catch(IllegalArgumentException e) { assertThat(e.getMessage(), containsString(ScriptService.DISABLE_DYNAMIC_SCRIPTING_SETTING + " is not a supported setting, replace with fine-grained script settings")); @@ -123,7 +122,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { @Test public void testScriptsWithoutExtensions() throws IOException { - buildScriptService(ImmutableSettings.EMPTY); + buildScriptService(Settings.EMPTY); logger.info("--> setup two test files one with extension and another without"); Path testFileNoExt = scriptsFilePath.resolve("test_no_ext"); Path testFileWithExt = scriptsFilePath.resolve("test_script.tst"); @@ -151,7 +150,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { @Test public void testScriptsSameNameDifferentLanguage() throws IOException { - buildScriptService(ImmutableSettings.EMPTY); + buildScriptService(Settings.EMPTY); createFileScripts("groovy", "expression"); CompiledScript groovyScript = scriptService.compile(new Script(GroovyScriptEngineService.NAME, "file_script", ScriptType.FILE, null), randomFrom(scriptContexts)); assertThat(groovyScript.lang(), equalTo(GroovyScriptEngineService.NAME)); @@ -161,7 +160,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { @Test public void testInlineScriptCompiledOnceMultipleLangAcronyms() throws IOException { - buildScriptService(ImmutableSettings.EMPTY); + buildScriptService(Settings.EMPTY); CompiledScript compiledScript1 = scriptService.compile(new Script("test", "script", ScriptType.INLINE, null), randomFrom(scriptContexts)); CompiledScript compiledScript2 = scriptService.compile(new Script("test2", "script", ScriptType.INLINE, null), randomFrom(scriptContexts)); assertThat(compiledScript1, sameInstance(compiledScript2)); @@ -169,7 +168,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { @Test public void testFileScriptCompiledOnceMultipleLangAcronyms() throws IOException { - buildScriptService(ImmutableSettings.EMPTY); + buildScriptService(Settings.EMPTY); createFileScripts("test"); CompiledScript compiledScript1 = scriptService.compile(new Script("test", "file_script", ScriptType.FILE, null), randomFrom(scriptContexts)); CompiledScript compiledScript2 = scriptService.compile(new Script("test2", "file_script", ScriptType.FILE, null), randomFrom(scriptContexts)); @@ -178,7 +177,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { @Test public void testDefaultBehaviourFineGrainedSettings() throws IOException { - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); //rarely inject the default settings, which have no effect if (rarely()) { builder.put("script.file", randomFrom(ScriptModesTests.ENABLE_VALUES)); @@ -247,7 +246,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { engineSettings.put(settingKey, randomFrom(ScriptMode.values())); } //set the selected fine-grained settings - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); for (Map.Entry entry : scriptSourceSettings.entrySet()) { switch (entry.getValue()) { case ON: @@ -338,7 +337,7 @@ public class ScriptServiceTests extends ElasticsearchTestCase { @Test public void testCompileNonRegisteredContext() throws IOException { - buildScriptService(ImmutableSettings.EMPTY); + buildScriptService(Settings.EMPTY); String pluginName; String unknownContext; do { diff --git a/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTest.java b/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTest.java index 3b6f0f479f1..ed7de33cde1 100644 --- a/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTest.java +++ b/src/test/java/org/elasticsearch/script/mustache/MustacheScriptEngineTest.java @@ -19,7 +19,7 @@ package org.elasticsearch.script.mustache; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Before; import org.junit.Test; @@ -41,7 +41,7 @@ public class MustacheScriptEngineTest extends ElasticsearchTestCase { @Before public void setup() { - qe = new MustacheScriptEngineService(ImmutableSettings.Builder.EMPTY_SETTINGS); + qe = new MustacheScriptEngineService(Settings.Builder.EMPTY_SETTINGS); escaper = new JsonEscapingMustacheFactory(); } diff --git a/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java b/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java index 4f2fbcb51de..e83f477d335 100644 --- a/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java +++ b/src/test/java/org/elasticsearch/search/StressSearchServiceReaperTest.java @@ -19,10 +19,8 @@ package org.elasticsearch.search; import org.apache.lucene.util.English; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -42,7 +40,7 @@ public class StressSearchServiceReaperTest extends ElasticsearchIntegrationTest @Override protected Settings nodeSettings(int nodeOrdinal) { // very frequent checks - return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal)) + return Settings.builder().put(super.nodeSettings(nodeOrdinal)) .put(SearchService.KEEPALIVE_INTERVAL_KEY, TimeValue.timeValueMillis(1)).build(); } diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java index 91ed3d9eda2..6379ba4709f 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/ChildrenTests.java @@ -22,7 +22,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.aggregations.bucket.children.Children; import org.elasticsearch.search.aggregations.bucket.terms.Terms; @@ -345,7 +345,7 @@ public class ChildrenTests extends ElasticsearchIntegrationTest { String childType = "city"; assertAcked( prepareCreate(indexName) - .setSettings(ImmutableSettings.builder() + .setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) ) diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java index ea0e365d427..b4ec3e33424 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.bucket; import org.elasticsearch.Version; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.mapper.core.DateFieldMapper; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; @@ -61,7 +60,7 @@ public class DateHistogramOffsetTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(AssertingLocalTransport.ASSERTING_TRANSPORT_MIN_VERSION_KEY, Version.V_1_4_0_Beta1).build(); } diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramTests.java index d3114d20283..d66a244b632 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramTests.java @@ -22,7 +22,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.joda.Joda; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.mapper.core.DateFieldMapper; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; import org.elasticsearch.search.aggregations.bucket.histogram.Histogram; @@ -1096,7 +1096,7 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest { prepareCreate("idx2") .setSettings( - ImmutableSettings.builder().put(indexSettings()).put("index.number_of_shards", 1) + Settings.builder().put(indexSettings()).put("index.number_of_shards", 1) .put("index.number_of_replicas", 0)).execute().actionGet(); int numOfBuckets = randomIntBetween(3, 6); int emptyBucketIndex = randomIntBetween(1, numOfBuckets - 2); // should be in the middle diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedTests.java index bd3e501146c..9b4a5bb78b5 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/NestedTests.java @@ -21,7 +21,7 @@ package org.elasticsearch.search.aggregations.bucket; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; import org.elasticsearch.search.aggregations.bucket.filter.Filter; @@ -403,7 +403,7 @@ public class NestedTests extends ElasticsearchIntegrationTest { .endObject() .endObject().endObject().endObject(); assertAcked(prepareCreate("idx2") - .setSettings(ImmutableSettings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)) + .setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("provider", mapping)); ensureGreen("idx2"); @@ -472,7 +472,7 @@ public class NestedTests extends ElasticsearchIntegrationTest { public void nestedSameDocIdProcessedMultipleTime() throws Exception { assertAcked( prepareCreate("idx4") - .setSettings(ImmutableSettings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)) + .setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("product", "categories", "type=string", "name", "type=string", "property", "type=nested") ); ensureGreen("idx4"); diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedTests.java index dd0853c0bba..01321634cd3 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/ReverseNestedTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.search.aggregations.bucket; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; import org.elasticsearch.search.aggregations.bucket.filter.Filter; @@ -507,7 +507,7 @@ public class ReverseNestedTests extends ElasticsearchIntegrationTest { .endObject().endObject().endObject(); assertAcked( prepareCreate("idx3") - .setSettings(ImmutableSettings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)) + .setSettings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("product", mapping) ); diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreTests.java index 787b7decb91..10dacac88e2 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsSignificanceScoreTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -55,7 +54,7 @@ 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; import static org.hamcrest.Matchers.*; @@ -491,7 +490,7 @@ public class SignificantTermsSignificanceScoreTests extends ElasticsearchIntegra @Test public void testNoNumberFormatExceptionWithDefaultScriptingEngine() throws ExecutionException, InterruptedException, IOException { - assertAcked(client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.builder().put("index.number_of_shards", 1))); + assertAcked(client().admin().indices().prepareCreate("test").setSettings(Settings.builder().put("index.number_of_shards", 1))); index("test", "doc", "1", "{\"field\":\"a\"}"); index("test", "doc", "11", "{\"field\":\"a\"}"); index("test", "doc", "2", "{\"field\":\"b\"}"); diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsTests.java index 9f993eb9f39..8e5431d6535 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/SignificantTermsTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.bucket; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.TermQueryBuilder; @@ -64,7 +63,7 @@ public class SignificantTermsTests extends ElasticsearchIntegrationTest { @Override public Settings indexSettings() { - return ImmutableSettings.builder() + return Settings.builder() .put("index.number_of_shards", numberOfShards()) .put("index.number_of_replicas", numberOfReplicas()) .build(); diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorTests.java b/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorTests.java index e0fa33e89d4..22ab6276baa 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.search.aggregations.bucket; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket; @@ -73,7 +73,7 @@ public class TermsDocCountErrorTests extends ElasticsearchIntegrationTest{ .field(DOUBLE_FIELD_NAME, 1.0 * randomInt(numUniqueTerms)) .endObject())); } - assertAcked(prepareCreate("idx_single_shard").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1))); + assertAcked(prepareCreate("idx_single_shard").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1))); for (int i = 0; i < numDocs; i++) { builders.add(client().prepareIndex("idx_single_shard", "type", ""+i).setSource(jsonBuilder() .startObject() diff --git a/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityTests.java b/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityTests.java index 21c3e702e9d..df5ee5c534e 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.metrics; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; import org.elasticsearch.search.aggregations.bucket.global.Global; @@ -45,7 +44,7 @@ public class CardinalityTests extends ElasticsearchIntegrationTest { @Override public Settings indexSettings() { - return ImmutableSettings.builder() + return Settings.builder() .put("index.number_of_shards", numberOfShards()) .put("index.number_of_replicas", numberOfReplicas()) .build(); diff --git a/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsTests.java b/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsTests.java index 75ce7c267df..386ae1416e5 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/metrics/GeoBoundsTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.search.aggregations.metrics; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.geo.GeoPoint; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArray; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -139,7 +139,7 @@ public class GeoBoundsTests extends ElasticsearchIntegrationTest { .field("tag", "tag" + i) .endObject())); } - assertAcked(prepareCreate("high_card_idx").setSettings(ImmutableSettings.builder().put("number_of_shards", 2)) + assertAcked(prepareCreate("high_card_idx").setSettings(Settings.builder().put("number_of_shards", 2)) .addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=geo_point", MULTI_VALUED_FIELD_NAME, "type=geo_point", NUMBER_FIELD_NAME, "type=long", "tag", "type=string,index=not_analyzed")); diff --git a/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricTests.java b/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricTests.java index 10a8df25b98..ce1a4b50fac 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricTests.java +++ b/src/test/java/org/elasticsearch/search/aggregations/metrics/ScriptedMetricTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.search.aggregations.metrics; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.indexedscripts.put.PutIndexedScriptResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.script.groovy.GroovyScriptEngineService; import org.elasticsearch.search.aggregations.Aggregation; @@ -113,7 +112,7 @@ public class ScriptedMetricTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put("path.conf", getDataPath("/org/elasticsearch/search/aggregations/metrics/scripted/conf")) .build(); diff --git a/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java b/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java index f11f72292e7..589c9bb230a 100644 --- a/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java +++ b/src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java @@ -35,7 +35,7 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout; diff --git a/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java b/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java index b4fef4f623d..e720f449f87 100644 --- a/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java +++ b/src/test/java/org/elasticsearch/search/basic/SearchWithRandomExceptionsTests.java @@ -30,8 +30,8 @@ import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Requests; -import org.elasticsearch.common.settings.ImmutableSettings.Builder; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; @@ -48,7 +48,7 @@ import java.io.IOException; import java.util.Random; import java.util.concurrent.ExecutionException; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; public class SearchWithRandomExceptionsTests extends ElasticsearchIntegrationTest { diff --git a/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresTests.java b/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresTests.java index 2336dcc60fa..f75301f8bac 100644 --- a/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresTests.java +++ b/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresTests.java @@ -37,7 +37,7 @@ import org.junit.Test; import java.io.IOException; import static org.elasticsearch.client.Requests.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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.*; diff --git a/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchTests.java b/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchTests.java index 988274f515d..2f9533671e9 100644 --- a/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchTests.java +++ b/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchTests.java @@ -21,6 +21,7 @@ package org.elasticsearch.search.basic; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import com.google.common.base.Charsets; @@ -31,7 +32,6 @@ import org.elasticsearch.action.search.MultiSearchResponse; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Requests; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.functionscore.script.ScriptScoreFunctionBuilder; @@ -51,7 +51,7 @@ import java.util.Set; import static org.elasticsearch.action.search.SearchType.*; import static org.elasticsearch.client.Requests.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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.termQuery; @@ -75,7 +75,7 @@ public class TransportTwoNodesSearchTests extends ElasticsearchIntegrationTest { private Set prepareData(int numShards) throws Exception { Set fullExpectedIds = Sets.newTreeSet(); - ImmutableSettings.Builder settingsBuilder = settingsBuilder() + Settings.Builder settingsBuilder = settingsBuilder() .put(indexSettings()) .put("routing.hash.type", "simple"); @@ -116,7 +116,7 @@ public class TransportTwoNodesSearchTests extends ElasticsearchIntegrationTest { @Test public void testDfsQueryThenFetch() throws Exception { - ImmutableSettings.Builder settingsBuilder = settingsBuilder() + Settings.Builder settingsBuilder = settingsBuilder() .put(indexSettings()) .put("routing.hash.type", "simple"); client().admin().indices().create(createIndexRequest("test") diff --git a/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java b/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java index f5fa9693b6c..733f0a26cd2 100644 --- a/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java +++ b/src/test/java/org/elasticsearch/search/child/ParentFieldLoadingTest.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.ShardRouting; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.mapper.DocumentMapper; @@ -49,7 +48,7 @@ import static org.hamcrest.Matchers.greaterThan; */ public class ParentFieldLoadingTest extends ElasticsearchIntegrationTest { - private final Settings indexSettings = ImmutableSettings.builder() + private final Settings indexSettings = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexShard.INDEX_REFRESH_INTERVAL, -1) diff --git a/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java b/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java index cc975c11f3f..0d4329d5bb7 100644 --- a/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java +++ b/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java @@ -29,9 +29,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.lucene.search.function.CombineFunction; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; @@ -65,12 +63,10 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicReference; import static com.google.common.collect.Maps.newHashMap; import static org.elasticsearch.common.io.Streams.copyToStringFromClasspath; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; @@ -111,7 +107,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)) // aggressive filter caching so that we can assert on the filter cache size .put(FilterCacheModule.FilterCacheSettings.FILTER_CACHE_TYPE, IndexFilterCache.class) .put(FilterCacheSettings.FILTER_CACHE_EVERYTHING, true) @@ -288,7 +284,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest { @LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elasticsearch/elasticsearch/issues/9270") public void testParentFieldDataCacheBug() throws Exception { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.builder().put(indexSettings()) + .setSettings(Settings.builder().put(indexSettings()) .put("index.refresh_interval", -1)) // Disable automatic refresh, so that the _parent doesn't get warmed .addMapping("parent", XContentFactory.jsonBuilder().startObject().startObject("parent") .startObject("properties") diff --git a/src/test/java/org/elasticsearch/search/compress/SearchSourceCompressTests.java b/src/test/java/org/elasticsearch/search/compress/SearchSourceCompressTests.java index 34c826379a0..e2a88a8fb39 100644 --- a/src/test/java/org/elasticsearch/search/compress/SearchSourceCompressTests.java +++ b/src/test/java/org/elasticsearch/search/compress/SearchSourceCompressTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Priority; import org.elasticsearch.common.compress.CompressorFactory; import org.elasticsearch.common.compress.lzf.LZFCompressor; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -54,7 +53,7 @@ public class SearchSourceCompressTests extends ElasticsearchSingleNodeTest { } catch (Exception e) { // ignore } - Settings settings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); createIndex("test", settings); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/search/fields/SearchFieldsTests.java b/src/test/java/org/elasticsearch/search/fields/SearchFieldsTests.java index 8fda328a5be..a7110a7745b 100644 --- a/src/test/java/org/elasticsearch/search/fields/SearchFieldsTests.java +++ b/src/test/java/org/elasticsearch/search/fields/SearchFieldsTests.java @@ -30,7 +30,7 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.joda.Joda; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.search.SearchHit; @@ -435,7 +435,7 @@ public class SearchFieldsTests extends ElasticsearchIntegrationTest { @Test public void testGetFields_complexField() throws Exception { client().admin().indices().prepareCreate("my-index") - .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) + .setSettings(Settings.settingsBuilder().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/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptTests.java b/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptTests.java index 4f30b5aab8b..82567eeb5c8 100644 --- a/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptTests.java +++ b/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptTests.java @@ -19,20 +19,16 @@ package org.elasticsearch.search.functionscore; -import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.Explanation; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.lucene.search.function.CombineFunction; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.fielddata.ScriptDocValues; import org.elasticsearch.script.AbstractDoubleSearchScript; -import org.elasticsearch.script.AbstractSearchScript; import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.ExplainableSearchScript; -import org.elasticsearch.script.LeafSearchScript; import org.elasticsearch.script.NativeScriptFactory; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHits; @@ -47,7 +43,7 @@ import java.util.Map; import java.util.concurrent.ExecutionException; import static org.elasticsearch.client.Requests.searchRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; diff --git a/src/test/java/org/elasticsearch/search/functionscore/FunctionScoreBackwardCompatibilityTests.java b/src/test/java/org/elasticsearch/search/functionscore/FunctionScoreBackwardCompatibilityTests.java index 79fb834c78d..68f4a33d824 100644 --- a/src/test/java/org/elasticsearch/search/functionscore/FunctionScoreBackwardCompatibilityTests.java +++ b/src/test/java/org/elasticsearch/search/functionscore/FunctionScoreBackwardCompatibilityTests.java @@ -22,7 +22,6 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.common.geo.GeoPoint; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest; import org.junit.Test; @@ -87,7 +86,7 @@ public class FunctionScoreBackwardCompatibilityTests extends ElasticsearchBackwa checkFunctionScoreStillWorks(ids); logClusterState(); // prevent any kind of allocation during the upgrade we recover from gateway - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); boolean upgraded; int upgradedNodesCounter = 1; do { @@ -97,13 +96,13 @@ public class FunctionScoreBackwardCompatibilityTests extends ElasticsearchBackwa logClusterState(); checkFunctionScoreStillWorks(ids); } while (upgraded); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); logger.debug("done function_score while upgrading"); } @Override protected Settings commonNodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder().put(super.commonNodeSettings(nodeOrdinal)) + return Settings.builder().put(super.commonNodeSettings(nodeOrdinal)) .put("script.inline", "on").build(); } diff --git a/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginTests.java b/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginTests.java index 3224a5b3630..05551cf4932 100644 --- a/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginTests.java +++ b/src/test/java/org/elasticsearch/search/functionscore/FunctionScorePluginTests.java @@ -39,7 +39,7 @@ import org.junit.Test; import static org.elasticsearch.client.Requests.indexRequest; import static org.elasticsearch.client.Requests.searchRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; diff --git a/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterSearchTests.java b/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterSearchTests.java index c352614dc5a..8aaff21dc8e 100644 --- a/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterSearchTests.java +++ b/src/test/java/org/elasticsearch/search/highlight/CustomHighlighterSearchTests.java @@ -31,7 +31,7 @@ import org.junit.Test; import java.io.IOException; import java.util.Map; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHighlight; import static org.hamcrest.Matchers.equalTo; diff --git a/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java b/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java index bc4f78bc50b..b3e723f213a 100644 --- a/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java +++ b/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchTests.java @@ -22,12 +22,10 @@ import com.carrotsearch.randomizedtesting.generators.RandomPicks; import com.google.common.base.Joiner; import com.google.common.collect.Iterables; import org.apache.lucene.util.LuceneTestCase.Slow; -import org.elasticsearch.Version; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings.Builder; +import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.*; @@ -47,7 +45,7 @@ import java.util.HashMap; import java.util.Map; import static org.elasticsearch.client.Requests.searchRequest; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.search.builder.SearchSourceBuilder.highlight; diff --git a/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisTests.java b/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisTests.java index 017e323bf16..63f5586d40c 100644 --- a/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisTests.java +++ b/src/test/java/org/elasticsearch/search/morelikethis/MoreLikeThisTests.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.MoreLikeThisQueryBuilder; @@ -199,7 +199,7 @@ public class MoreLikeThisTests extends ElasticsearchIntegrationTest { .endObject() .endObject().endObject().string(); assertAcked(prepareCreate("foo", 2, - ImmutableSettings.builder().put(SETTING_NUMBER_OF_SHARDS, 2).put(SETTING_NUMBER_OF_REPLICAS, 0)) + Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 2).put(SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("bar", mapping)); ensureGreen(); diff --git a/src/test/java/org/elasticsearch/search/preference/SearchPreferenceTests.java b/src/test/java/org/elasticsearch/search/preference/SearchPreferenceTests.java index 85e20e7fcbc..bdfac267224 100644 --- a/src/test/java/org/elasticsearch/search/preference/SearchPreferenceTests.java +++ b/src/test/java/org/elasticsearch/search/preference/SearchPreferenceTests.java @@ -29,7 +29,7 @@ import org.junit.Test; import java.io.IOException; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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.*; diff --git a/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java b/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java index 66205a1b032..d0131cffde6 100644 --- a/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java +++ b/src/test/java/org/elasticsearch/search/query/MultiMatchQueryTests.java @@ -46,7 +46,7 @@ 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/search/query/SearchQueryTests.java b/src/test/java/org/elasticsearch/search/query/SearchQueryTests.java index 64ea1c2f3ca..895fb8f27ef 100644 --- a/src/test/java/org/elasticsearch/search/query/SearchQueryTests.java +++ b/src/test/java/org/elasticsearch/search/query/SearchQueryTests.java @@ -30,7 +30,6 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.MapperParsingException; @@ -54,7 +53,7 @@ import java.util.Set; import java.util.concurrent.ExecutionException; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction; @@ -627,7 +626,7 @@ public class SearchQueryTests extends ElasticsearchIntegrationTest { } private void typeFilterTests(String index) throws Exception { - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); assertAcked(prepareCreate("test").setSettings(indexSettings) .addMapping("type1", jsonBuilder().startObject().startObject("type1") .startObject("_type").field("index", index).endObject() @@ -661,7 +660,7 @@ public class SearchQueryTests extends ElasticsearchIntegrationTest { } private void idsQueryTests(String index) throws Exception { - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id).build(); assertAcked(client().admin().indices().prepareCreate("test").setSettings(indexSettings) .addMapping("type1", jsonBuilder().startObject().startObject("type1") .startObject("_id").field("index", index).endObject() @@ -2423,7 +2422,7 @@ public class SearchQueryTests extends ElasticsearchIntegrationTest { @Test public void testFilteredQuery() throws Exception { - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder().put(indexSettings()); + Settings.Builder builder = Settings.settingsBuilder().put(indexSettings()); createIndex("test"); int numDocs = randomIntBetween(100, 150); IndexRequestBuilder[] docs = new IndexRequestBuilder[numDocs]; diff --git a/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java b/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java index 81b10faed93..afeb93f9be4 100644 --- a/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java +++ b/src/test/java/org/elasticsearch/search/rescore/QueryRescorerTests.java @@ -28,8 +28,8 @@ import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.common.lucene.search.function.CombineFunction; -import org.elasticsearch.common.settings.ImmutableSettings.Builder; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings.Builder; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.MatchQueryBuilder; @@ -94,7 +94,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { "type1", jsonBuilder().startObject().startObject("type1").startObject("properties").startObject("field1") .field("analyzer", "whitespace").field("type", "string").endObject().endObject().endObject().endObject()) - .setSettings(ImmutableSettings.settingsBuilder().put(indexSettings()).put("index.number_of_shards", 1))); + .setSettings(Settings.settingsBuilder().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(); @@ -135,7 +135,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { @Test public void testMoreDocs() throws Exception { - Builder builder = ImmutableSettings.builder(); + Builder builder = Settings.builder(); builder.put("index.analysis.analyzer.synonym.tokenizer", "whitespace"); builder.putArray("index.analysis.analyzer.synonym.filter", "synonym", "lowercase"); builder.put("index.analysis.filter.synonym.type", "synonym"); @@ -214,7 +214,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { // Tests a rescore window smaller than number of hits: @Test public void testSmallRescoreWindow() throws Exception { - Builder builder = ImmutableSettings.builder(); + Builder builder = Settings.builder(); builder.put("index.analysis.analyzer.synonym.tokenizer", "whitespace"); builder.putArray("index.analysis.analyzer.synonym.filter", "synonym", "lowercase"); builder.put("index.analysis.filter.synonym.type", "synonym"); @@ -285,7 +285,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { // Tests a rescorer that penalizes the scores: @Test public void testRescorerMadeScoresWorse() throws Exception { - Builder builder = ImmutableSettings.builder(); + Builder builder = Settings.builder(); builder.put("index.analysis.analyzer.synonym.tokenizer", "whitespace"); builder.putArray("index.analysis.analyzer.synonym.filter", "synonym", "lowercase"); builder.put("index.analysis.filter.synonym.type", "synonym"); @@ -697,7 +697,7 @@ public class QueryRescorerTests extends ElasticsearchIntegrationTest { } private int indexRandomNumbers(String analyzer, int shards, boolean dummyDocs) throws Exception { - Builder builder = ImmutableSettings.settingsBuilder().put(indexSettings()); + Builder builder = Settings.settingsBuilder().put(indexSettings()); if (shards > 0) { builder.put(SETTING_NUMBER_OF_SHARDS, shards); diff --git a/src/test/java/org/elasticsearch/search/scriptfilter/ScriptQuerySearchTests.java b/src/test/java/org/elasticsearch/search/scriptfilter/ScriptQuerySearchTests.java index f483d0e031f..430b86a6cb5 100644 --- a/src/test/java/org/elasticsearch/search/scriptfilter/ScriptQuerySearchTests.java +++ b/src/test/java/org/elasticsearch/search/scriptfilter/ScriptQuerySearchTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.search.scriptfilter; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.cache.filter.FilterCacheModule; import org.elasticsearch.index.cache.filter.FilterCacheModule.FilterCacheSettings; @@ -45,7 +44,7 @@ public class ScriptQuerySearchTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)) + return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)) // aggressive filter caching so that we can assert on the number of iterations of the script filters .put(FilterCacheModule.FilterCacheSettings.FILTER_CACHE_TYPE, IndexFilterCache.class) .put(FilterCacheSettings.FILTER_CACHE_EVERYTHING, true) diff --git a/src/test/java/org/elasticsearch/search/scroll/SearchScrollTests.java b/src/test/java/org/elasticsearch/search/scroll/SearchScrollTests.java index 21dd1f3a1f8..b61a2ce33c7 100644 --- a/src/test/java/org/elasticsearch/search/scroll/SearchScrollTests.java +++ b/src/test/java/org/elasticsearch/search/scroll/SearchScrollTests.java @@ -23,7 +23,7 @@ import org.elasticsearch.action.search.*; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Priority; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.UncategorizedExecutionException; import org.elasticsearch.common.xcontent.XContentFactory; @@ -54,7 +54,7 @@ public class SearchScrollTests extends ElasticsearchIntegrationTest { @Test public void testSimpleScrollQueryThenFetch() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().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(); @@ -106,7 +106,7 @@ public class SearchScrollTests extends ElasticsearchIntegrationTest { @Test public void testSimpleScrollQueryThenFetchSmallSizeUnevenDistribution() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().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(); @@ -180,7 +180,7 @@ public class SearchScrollTests extends ElasticsearchIntegrationTest { @Test public void testScrollAndUpdateIndex() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 5)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().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++) { @@ -225,7 +225,7 @@ public class SearchScrollTests extends ElasticsearchIntegrationTest { @Test public void testSimpleScrollQueryThenFetch_clearScrollIds() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().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(); @@ -337,7 +337,7 @@ public class SearchScrollTests extends ElasticsearchIntegrationTest { @Test public void testSimpleScrollQueryThenFetch_clearAllScrollIds() throws Exception { - client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 3)).execute().actionGet(); + client().admin().indices().prepareCreate("test").setSettings(Settings.settingsBuilder().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(); @@ -456,7 +456,7 @@ public class SearchScrollTests extends ElasticsearchIntegrationTest { @Test public void testStringSortMissingAscTerminates() throws Exception { assertAcked(prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)) + .setSettings(Settings.settingsBuilder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)) .addMapping("test", "no_field", "type=string", "some_field", "type=string")); client().prepareIndex("test", "test", "1").setSource("some_field", "test").get(); refresh(); diff --git a/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesTests.java b/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesTests.java index 6d76c04e122..836d76b5a94 100644 --- a/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesTests.java +++ b/src/test/java/org/elasticsearch/search/scroll/SearchScrollWithFailingNodesTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.search.scroll; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.cluster.routing.allocation.decider.ShardsLimitAllocationDecider; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -58,7 +58,7 @@ public class SearchScrollWithFailingNodesTests extends ElasticsearchIntegrationT assertAcked( prepareCreate("test") // Enforces that only one shard can only be allocated to a single node - .setSettings(ImmutableSettings.builder().put(indexSettings()).put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE, 1)) + .setSettings(Settings.builder().put(indexSettings()).put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE, 1)) ); List writes = new ArrayList<>(); diff --git a/src/test/java/org/elasticsearch/search/sort/SortParserTests.java b/src/test/java/org/elasticsearch/search/sort/SortParserTests.java index 1d9bf3c78c2..cad9db70852 100644 --- a/src/test/java/org/elasticsearch/search/sort/SortParserTests.java +++ b/src/test/java/org/elasticsearch/search/sort/SortParserTests.java @@ -22,7 +22,7 @@ package org.elasticsearch.search.sort; import org.elasticsearch.common.geo.GeoPoint; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; @@ -39,7 +39,7 @@ public class SortParserTests extends ElasticsearchSingleNodeTest { 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", ImmutableSettings.settingsBuilder().build(), "type", mapping); + IndexService indexService = createIndex("testidx", Settings.settingsBuilder().build(), "type", mapping); TestSearchContext context = (TestSearchContext) createSearchContext(indexService); context.setTypes("type"); diff --git a/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java b/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java index 55e30467863..3422a7394ae 100644 --- a/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java +++ b/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java @@ -28,7 +28,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.GroupShardsIterator; import org.elasticsearch.cluster.routing.ShardIterator; import org.elasticsearch.cluster.routing.ShardRouting; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.search.stats.SearchStats.Stats; @@ -63,7 +63,7 @@ public class SearchStatsTests extends ElasticsearchIntegrationTest { final int shardsIdx1 = randomIntBetween(1, 10); // we make sure each node gets at least a single shard... final int shardsIdx2 = Math.max(numNodes - shardsIdx1, randomIntBetween(1, 10)); assertThat(numNodes, lessThanOrEqualTo(shardsIdx1 + shardsIdx2)); - assertAcked(prepareCreate("test1").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test1").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, shardsIdx1) .put(SETTING_NUMBER_OF_REPLICAS, 0))); int docsTest1 = scaledRandomIntBetween(3*shardsIdx1, 5*shardsIdx1); @@ -73,7 +73,7 @@ public class SearchStatsTests extends ElasticsearchIntegrationTest { refresh(); } } - assertAcked(prepareCreate("test2").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test2").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, shardsIdx2) .put(SETTING_NUMBER_OF_REPLICAS, 0))); int docsTest2 = scaledRandomIntBetween(3*shardsIdx2, 5*shardsIdx2); diff --git a/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java b/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java index ea7adb38a29..a87c66aa67b 100644 --- a/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java +++ b/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchTests.java @@ -33,7 +33,6 @@ import org.elasticsearch.action.percolate.PercolateResponse; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.suggest.SuggestResponse; import org.elasticsearch.client.Requests; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -60,7 +59,7 @@ 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.ImmutableSettings.settingsBuilder; +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; @@ -778,7 +777,7 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest { @Test public void testThatSuggestStopFilterWorks() throws Exception { - ImmutableSettings.Builder settingsBuilder = settingsBuilder() + Settings.Builder settingsBuilder = settingsBuilder() .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") @@ -891,7 +890,7 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest { private void createIndexAndMappingAndSettings(Settings settings, CompletionMappingBuilder completionMappingBuilder) throws IOException { assertAcked(client().admin().indices().prepareCreate(INDEX) - .setSettings(ImmutableSettings.settingsBuilder().put(indexSettings()).put(settings)) + .setSettings(Settings.settingsBuilder().put(indexSettings()).put(settings)) .addMapping(TYPE, jsonBuilder().startObject() .startObject(TYPE).startObject("properties") .startObject(FIELD) @@ -909,7 +908,7 @@ public class CompletionSuggestSearchTests extends ElasticsearchIntegrationTest { } private void createIndexAndMapping(CompletionMappingBuilder completionMappingBuilder) throws IOException { - createIndexAndMappingAndSettings(ImmutableSettings.EMPTY, completionMappingBuilder); + createIndexAndMappingAndSettings(Settings.EMPTY, completionMappingBuilder); } private void createData(boolean optimize) throws IOException, InterruptedException, ExecutionException { diff --git a/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java b/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java index a8d7b28bead..c6f48e7600b 100644 --- a/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java +++ b/src/test/java/org/elasticsearch/search/suggest/CustomSuggesterSearchTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.suggest; import com.google.common.collect.Lists; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -44,7 +43,7 @@ public class CustomSuggesterSearchTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("plugin.types", CustomSuggesterPlugin.class.getName()).build(); + return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("plugin.types", CustomSuggesterPlugin.class.getName()).build(); } @Test diff --git a/src/test/java/org/elasticsearch/search/suggest/SuggestSearchTests.java b/src/test/java/org/elasticsearch/search/suggest/SuggestSearchTests.java index ebc8fcf0713..06d0c86b89a 100644 --- a/src/test/java/org/elasticsearch/search/suggest/SuggestSearchTests.java +++ b/src/test/java/org/elasticsearch/search/suggest/SuggestSearchTests.java @@ -44,7 +44,7 @@ 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.ImmutableSettings.settingsBuilder; +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; diff --git a/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java b/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java index 32e9d30f82f..757723ef4d0 100644 --- a/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java +++ b/src/test/java/org/elasticsearch/search/suggest/completion/CompletionPostingsFormatTest.java @@ -52,7 +52,6 @@ import org.apache.lucene.util.LineFileDocs; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.analysis.NamedAnalyzer; import org.elasticsearch.index.codec.postingsformat.Elasticsearch090PostingsFormat; @@ -78,7 +77,7 @@ import static org.hamcrest.Matchers.is; public class CompletionPostingsFormatTest extends ElasticsearchTestCase { - Settings indexSettings = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT.id).build(); + Settings indexSettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT.id).build(); @Test public void testCompletionPostingsFormat() throws IOException { diff --git a/src/test/java/org/elasticsearch/search/timeout/SearchTimeoutTests.java b/src/test/java/org/elasticsearch/search/timeout/SearchTimeoutTests.java index 9b2c601864d..48bfa9069b0 100644 --- a/src/test/java/org/elasticsearch/search/timeout/SearchTimeoutTests.java +++ b/src/test/java/org/elasticsearch/search/timeout/SearchTimeoutTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.search.timeout; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -37,7 +36,7 @@ public class SearchTimeoutTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).build(); + return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).build(); } @Test diff --git a/src/test/java/org/elasticsearch/similarity/SimilarityTests.java b/src/test/java/org/elasticsearch/similarity/SimilarityTests.java index 6f726043e06..8dd58e2307a 100644 --- a/src/test/java/org/elasticsearch/similarity/SimilarityTests.java +++ b/src/test/java/org/elasticsearch/similarity/SimilarityTests.java @@ -20,7 +20,7 @@ package org.elasticsearch.similarity; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; @@ -54,7 +54,7 @@ public class SimilarityTests extends ElasticsearchIntegrationTest { .endObject() .endObject() .endObject()) - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 0) .put("similarity.custom.type", "BM25") diff --git a/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java b/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java index e607c64a2d3..52e74e84ea2 100644 --- a/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java +++ b/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreTests.java @@ -46,7 +46,6 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Priority; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; @@ -72,7 +71,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; @@ -102,7 +101,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> set test persistent setting"); client.admin().cluster().prepareUpdateSettings().setPersistentSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 2) .put(IndicesTTLService.INDICES_TTL_INTERVAL, random, TimeUnit.MINUTES)) .execute().actionGet(); @@ -114,7 +113,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> create repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> start snapshot"); @@ -125,7 +124,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> clean the test persistent setting"); client.admin().cluster().prepareUpdateSettings().setPersistentSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 1) .put(IndicesTTLService.INDICES_TTL_INTERVAL, TimeValue.timeValueMinutes(1))) .execute().actionGet(); @@ -172,7 +171,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> create repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", tempDir)).execute().actionGet(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", tempDir)).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> start snapshot"); @@ -210,7 +209,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> create repository"); putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", tempDir)).execute().actionGet(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", tempDir)).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> restore snapshot"); @@ -293,7 +292,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", randomRepoPath()) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -342,7 +341,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests Path repo = randomRepoPath(); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", repo) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -434,7 +433,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> create repository"); logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> start snapshot with default settings - should fail"); @@ -549,7 +548,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> create repository"); PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); int numberOfShards = 6; logger.info("--> create an index that will have some unallocated shards"); @@ -607,12 +606,12 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests // Register mock repositories for (int i = 0; i < 5; i++) { client().admin().cluster().preparePutRepository("test-repo" + i) - .setType("mock").setSettings(ImmutableSettings.settingsBuilder() + .setType("mock").setSettings(Settings.settingsBuilder() .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(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath())).get(); } @@ -630,7 +629,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests logger.info("--> creating repository"); assertAcked(client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -703,7 +702,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests } logger.info("--> update index settings to back to normal"); - assertAcked(client().admin().indices().prepareUpdateSettings("test-*").setSettings(ImmutableSettings.builder() + assertAcked(client().admin().indices().prepareUpdateSettings("test-*").setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "node") )); @@ -749,7 +748,7 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests index(name, "doc", Integer.toString(i), "foo", "bar" + i); } - assertAcked(client().admin().indices().prepareUpdateSettings(name).setSettings(ImmutableSettings.builder() + assertAcked(client().admin().indices().prepareUpdateSettings(name).setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "all") .put(IndexStore.INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC, between(100, 50000)) )); diff --git a/src/test/java/org/elasticsearch/snapshots/RepositoriesTests.java b/src/test/java/org/elasticsearch/snapshots/RepositoriesTests.java index 389613b9449..197e10408fe 100644 --- a/src/test/java/org/elasticsearch/snapshots/RepositoriesTests.java +++ b/src/test/java/org/elasticsearch/snapshots/RepositoriesTests.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.snapshots; -import com.carrotsearch.randomizedtesting.LifecycleScope; import com.google.common.collect.ImmutableList; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; @@ -31,7 +30,6 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.RepositoriesMetaData; import org.elasticsearch.cluster.metadata.RepositoryMetaData; import org.elasticsearch.common.io.FileSystemUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.repositories.RepositoryException; import org.elasticsearch.repositories.RepositoryVerificationException; @@ -60,7 +58,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-1") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", location) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -83,7 +81,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { logger.info("--> creating another repository"); putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -142,7 +140,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { String location = createTempDir().toAbsolutePath().toString(); try { client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", location)) + .setType("fs").setSettings(Settings.settingsBuilder().put("location", location)) .get(); fail("Shouldn't be here"); } catch (RepositoryException ex) { @@ -154,7 +152,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { public void repositoryAckTimeoutTest() 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(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(5, 100)) @@ -164,7 +162,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { logger.info("--> creating repository test-repo-2 with standard timeout - should ack"); putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(5, 100)) @@ -185,7 +183,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { public void repositoryVerificationTest() throws Exception { Client client = client(); - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("location", randomRepoPath()) .put("random_control_io_exception_rate", 1.0).build(); logger.info("--> creating repository that cannot write any files - should fail"); @@ -206,7 +204,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { try { client.admin().cluster().preparePutRepository("test-repo-1") .setType(MockRepositoryModule.class.getCanonicalName()) - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("location", location) .put("localize_location", true) ).get(); @@ -220,7 +218,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { public void repositoryVerificationTimeoutTest() throws Exception { Client client = client(); - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("location", randomRepoPath()) .put("random_control_io_exception_rate", 1.0).build(); logger.info("--> creating repository that cannot write any files - should fail"); @@ -241,7 +239,7 @@ public class RepositoriesTests extends AbstractSnapshotTests { try { client.admin().cluster().preparePutRepository("test-repo-1") .setType(MockRepositoryModule.class.getCanonicalName()) - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("location", location) .put("localize_location", true) ).get(); diff --git a/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java b/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java index 7137ed5620c..c2008946afd 100644 --- a/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java +++ b/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreTests.java @@ -49,7 +49,6 @@ import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDeci import org.elasticsearch.cluster.service.PendingClusterTask; import org.elasticsearch.common.Priority; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.shard.ShardId; @@ -74,7 +73,7 @@ import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.elasticsearch.index.shard.IndexShard.INDEX_REFRESH_INTERVAL; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*; @@ -89,7 +88,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -201,7 +200,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository(repoName) - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", absolutePath) )); @@ -230,7 +229,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -246,7 +245,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { NumShards numShards = getNumShards("test"); cluster().wipeIndices("test"); - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, numShards.numPrimaries))); ensureGreen(); String newIndexUUID = client().admin().indices().prepareGetSettings("test").get().getSetting("test", IndexMetaData.SETTING_UUID); @@ -279,13 +278,13 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); logger.info("--> create index with foo type"); - assertAcked(prepareCreate("test-idx", 2, ImmutableSettings.builder() + assertAcked(prepareCreate("test-idx", 2, Settings.builder() .put(indexSettings()).put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)).put("refresh_interval", 10))); NumShards numShards = getNumShards("test-idx"); @@ -300,7 +299,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> delete the index and recreate it with bar type"); cluster().wipeIndices("test-idx"); - assertAcked(prepareCreate("test-idx", 2, ImmutableSettings.builder() + assertAcked(prepareCreate("test-idx", 2, Settings.builder() .put(SETTING_NUMBER_OF_SHARDS, numShards.numPrimaries).put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)).put("refresh_interval", 5))); assertAcked(client().admin().indices().preparePutMapping("test-idx").setType("bar").setSource("baz", "type=string")); ensureGreen(); @@ -328,7 +327,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())).get(); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> snapshot"); @@ -345,7 +344,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath()))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); logger.info("--> create test indices"); createIndex("test-idx-1", "test-idx-2", "test-idx-3"); @@ -401,7 +400,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath()))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", randomRepoPath()))); logger.info("--> creating test template"); assertThat(client.admin().indices().preparePutTemplate("test-template").setTemplate("te*").addMapping("test-mapping", "{}").get().isAcknowledged(), equalTo(true)); @@ -435,7 +434,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); Path location = randomRepoPath(); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", location))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", location))); logger.info("--> creating test template"); assertThat(client.admin().indices().preparePutTemplate("test-template").setTemplate("te*").addMapping("test-mapping", "{}").get().isAcknowledged(), equalTo(true)); @@ -514,7 +513,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", randomRepoPath()) .put("random", randomAsciiOfLength(10)) .put("random_control_io_exception_rate", 0.2)) @@ -564,7 +563,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", randomRepoPath()) .put("random", randomAsciiOfLength(10)) .put("random_data_file_io_exception_rate", 0.3))); @@ -631,7 +630,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); createIndex("test-idx"); ensureGreen(); @@ -651,7 +650,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> update repository with mock version"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("random_data_file_io_exception_rate", 0.3))); @@ -673,7 +672,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); createIndex("test-idx"); ensureGreen(); @@ -693,7 +692,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> update repository with mock version"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("random_data_file_io_exception_rate", 1.0) // Fail completely @@ -720,7 +719,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> restoring working repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); logger.info("--> trying to restore index again"); restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); @@ -737,11 +736,11 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()))); logger.info("--> creating index that cannot be allocated"); - prepareCreate("test-idx", 2, ImmutableSettings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + ".tag", "nowhere").put("index.number_of_shards", 3)).get(); + prepareCreate("test-idx", 2, Settings.builder().put(FilterAllocationDecider.INDEX_ROUTING_INCLUDE_GROUP + ".tag", "nowhere").put("index.number_of_shards", 3)).get(); logger.info("--> snapshot"); CreateSnapshotResponse createSnapshotResponse = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx").get(); @@ -759,7 +758,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { Path repo = randomRepoPath(); logger.info("--> creating repository at " + repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -816,7 +815,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { Path repo = randomRepoPath(); logger.info("--> creating repository at " + repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -855,7 +854,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { Path repo = randomRepoPath(); logger.info("--> creating repository at " + repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -890,7 +889,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { Path repo = randomRepoPath(); logger.info("--> creating repository at " + repo.toAbsolutePath()); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", repo) .put("compress", false) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -931,7 +930,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()))); createIndex("test-idx", "test-idx-closed"); @@ -969,7 +968,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()))); createIndex("test-idx"); @@ -990,7 +989,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()))); createIndex("test-idx-1", "test-idx-2", "test-idx-3"); @@ -1111,13 +1110,13 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200))); // Create index on 2 nodes and make sure each node has a primary by setting no replicas - assertAcked(prepareCreate("test-idx", 2, ImmutableSettings.builder().put("number_of_replicas", 0))); + assertAcked(prepareCreate("test-idx", 2, Settings.builder().put("number_of_replicas", 0))); logger.info("--> indexing some data"); for (int i = 0; i < 100; i++) { @@ -1136,7 +1135,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { waitForBlock(blockedNode, "test-repo", TimeValue.timeValueSeconds(60)); logger.info("--> execution was blocked on node [{}], moving shards away from this node", blockedNode); - ImmutableSettings.Builder excludeSettings = ImmutableSettings.builder().put("index.routing.allocation.exclude._name", blockedNode); + Settings.Builder excludeSettings = Settings.builder().put("index.routing.allocation.exclude._name", blockedNode); client().admin().indices().prepareUpdateSettings("test-idx").setSettings(excludeSettings).get(); logger.info("--> unblocking blocked node"); @@ -1157,7 +1156,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> replace mock repository with real one at the same location"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); logger.info("--> restore index"); RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); @@ -1173,7 +1172,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -1181,7 +1180,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); // Create index on 2 nodes and make sure each node has a primary by setting no replicas - assertAcked(prepareCreate("test-idx", 2, ImmutableSettings.builder().put("number_of_replicas", 0))); + assertAcked(prepareCreate("test-idx", 2, Settings.builder().put("number_of_replicas", 0))); logger.info("--> indexing some data"); for (int i = 0; i < 100; i++) { @@ -1211,7 +1210,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> trying to move repository to another location"); try { client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", repositoryLocation.resolve("test")) + .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation.resolve("test")) ).get(); fail("shouldn't be able to replace in-use repository"); } catch (Exception ex) { @@ -1220,7 +1219,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> trying to create a repository with different name"); assertAcked(client.admin().cluster().preparePutRepository("test-repo-2") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", repositoryLocation.resolve("test")))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation.resolve("test")))); logger.info("--> unblocking blocked node"); unblockNode(blockedNode); @@ -1240,7 +1239,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> replace mock repository with real one at the same location"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", repositoryLocation))); + .setType("fs").setSettings(Settings.settingsBuilder().put("location", repositoryLocation))); logger.info("--> restore index"); RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); @@ -1256,7 +1255,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); Path repositoryLocation = randomRepoPath(); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", repositoryLocation) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -1283,7 +1282,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> create read-only URL repository"); assertAcked(client.admin().cluster().preparePutRepository("url-repo") - .setType("url").setSettings(ImmutableSettings.settingsBuilder() + .setType("url").setSettings(Settings.settingsBuilder() .put("url", repositoryLocation.toUri().toURL()) .put("list_directories", randomBoolean()))); logger.info("--> restore index after deletion"); @@ -1316,7 +1315,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { boolean throttleSnapshot = randomBoolean(); boolean throttleRestore = randomBoolean(); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", repositoryLocation) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(1000, 10000)) @@ -1374,7 +1373,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType(MockRepositoryModule.class.getCanonicalName()).setSettings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("location", repositoryLocation) .put("random", randomAsciiOfLength(10)) .put("wait_after_unblock", 200) @@ -1382,7 +1381,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); // Create index on 2 nodes and make sure each node has a primary by setting no replicas - assertAcked(prepareCreate("test-idx", 2, ImmutableSettings.builder().put("number_of_replicas", 0))); + assertAcked(prepareCreate("test-idx", 2, Settings.builder().put("number_of_replicas", 0))); logger.info("--> indexing some data"); for (int i = 0; i < 100; i++) { @@ -1472,13 +1471,13 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); // Create index on 1 nodes and make sure each node has a primary by setting no replicas - assertAcked(prepareCreate("test-idx", 1, ImmutableSettings.builder().put("number_of_replicas", 0))); + assertAcked(prepareCreate("test-idx", 1, Settings.builder().put("number_of_replicas", 0))); logger.info("--> indexing some data"); for (int i = 0; i < 100; i++) { @@ -1488,7 +1487,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { assertThat(client.prepareCount("test-idx").get().getCount(), equalTo(100L)); // Update settings to make sure that relocation is slow so we can start snapshot before relocation is finished - assertAcked(client.admin().indices().prepareUpdateSettings("test-idx").setSettings(ImmutableSettings.builder() + assertAcked(client.admin().indices().prepareUpdateSettings("test-idx").setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "all") .put(IndexStore.INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC, 100) )); @@ -1504,7 +1503,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { client.admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(false).setIndices("test-idx").get(); // Update settings to back to normal - assertAcked(client.admin().indices().prepareUpdateSettings("test-idx").setSettings(ImmutableSettings.builder() + assertAcked(client.admin().indices().prepareUpdateSettings("test-idx").setSettings(Settings.builder() .put(IndexStore.INDEX_STORE_THROTTLE_TYPE, "node") )); @@ -1520,13 +1519,13 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); // only one shard - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1))); + assertAcked(prepareCreate("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1))); ensureGreen(); logger.info("--> indexing"); @@ -1583,14 +1582,14 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); logger.info("--> create test index with synonyms search analyzer"); - ImmutableSettings.Builder indexSettings = ImmutableSettings.builder() + Settings.Builder indexSettings = Settings.builder() .put(indexSettings()) .put(SETTING_NUMBER_OF_REPLICAS, between(0, 1)) .put(INDEX_REFRESH_INTERVAL, "10s") @@ -1623,12 +1622,12 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> delete the index and recreate it while changing refresh interval and analyzer"); cluster().wipeIndices("test-idx"); - Settings newIndexSettings = ImmutableSettings.builder() + Settings newIndexSettings = Settings.builder() .put("refresh_interval", "5s") .put("index.analysis.analyzer.my_analyzer.type", "standard") .build(); - Settings newIncorrectIndexSettings = ImmutableSettings.builder() + Settings newIncorrectIndexSettings = Settings.builder() .put(newIndexSettings) .put(SETTING_NUMBER_OF_SHARDS, numberOfShards + 100) .build(); @@ -1641,7 +1640,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { .setWaitForCompletion(true), SnapshotRestoreException.class); logger.info("--> try restoring while changing the number of replicas to a negative number - should fail"); - Settings newIncorrectReplicasIndexSettings = ImmutableSettings.builder() + Settings newIncorrectReplicasIndexSettings = Settings.builder() .put(newIndexSettings) .put(SETTING_NUMBER_OF_REPLICAS.substring(IndexMetaData.INDEX_SETTING_PREFIX.length()), randomIntBetween(-10, -1)) .build(); @@ -1700,7 +1699,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType(MockRepositoryModule.class.getCanonicalName()).setSettings(ImmutableSettings.settingsBuilder() + .setType(MockRepositoryModule.class.getCanonicalName()).setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)) @@ -1752,7 +1751,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType(MockRepositoryModule.class.getCanonicalName()).setSettings(ImmutableSettings.settingsBuilder() + .setType(MockRepositoryModule.class.getCanonicalName()).setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)) @@ -1832,7 +1831,7 @@ public class SharedClusterSnapshotRestoreTests extends AbstractSnapshotTests { logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); diff --git a/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityTest.java b/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityTest.java index 24151b55389..7fe1bdb1c33 100644 --- a/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityTest.java +++ b/src/test/java/org/elasticsearch/snapshots/SnapshotBackwardsCompatibilityTest.java @@ -18,10 +18,8 @@ */ package org.elasticsearch.snapshots; -import com.carrotsearch.randomizedtesting.LifecycleScope; import com.carrotsearch.randomizedtesting.generators.RandomPicks; -import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotIndexShardStatus; @@ -33,9 +31,8 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.common.io.FileSystemUtils; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchBackwardsCompatIntegrationTest; -import org.junit.Ignore; import org.junit.Test; import java.io.IOException; @@ -58,7 +55,7 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo public void testSnapshotAndRestore() throws ExecutionException, InterruptedException, IOException { logger.info("--> creating repository"); assertAcked(client().admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", randomRepoPath().toAbsolutePath()) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); @@ -113,7 +110,7 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo assertThat(client().prepareCount(indices).get().getCount(), lessThan((long) (buildersBefore.length + buildersAfter.length))); - client().admin().indices().prepareUpdateSettings(indices).setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); + client().admin().indices().prepareUpdateSettings(indices).setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); backwardsCluster().allowOnAllNodes(indices); logClusterState(); boolean upgraded; @@ -126,7 +123,7 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo countResponse = client().prepareCount().get(); assertHitCount(countResponse, numDocs); } while (upgraded); - client().admin().indices().prepareUpdateSettings(indices).setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); + client().admin().indices().prepareUpdateSettings(indices).setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); logger.info("--> close indices"); client().admin().indices().prepareClose("index_before_*").get(); @@ -168,13 +165,13 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo final Path tempDir = randomRepoPath().toAbsolutePath(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") - .setType("fs").setSettings(ImmutableSettings.settingsBuilder() + .setType("fs").setSettings(Settings.settingsBuilder() .put("location", tempDir) .put("compress", randomBoolean()) .put("chunk_size", randomIntBetween(100, 1000)))); // only one shard - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder() + assertAcked(prepareCreate("test").setSettings(Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) )); @@ -203,7 +200,7 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo } if (frequently()) { logger.info("--> upgrade"); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "none")).get(); backwardsCluster().allowOnAllNodes("test"); logClusterState(); boolean upgraded; @@ -216,11 +213,11 @@ public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCo countResponse = client().prepareCount().get(); assertHitCount(countResponse, numDocs); } while (upgraded); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE, "all")).get(); } if (cluster().numDataNodes() > 1 && randomBoolean()) { // only bump the replicas if we have enough nodes logger.info("--> move from 0 to 1 replica"); - client().admin().indices().prepareUpdateSettings("test").setSettings(ImmutableSettings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)).get(); + client().admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)).get(); } logger.debug("---> repo exists: " + Files.exists(tempDir.resolve("indices/test/0")) + " files: " + Arrays.toString(FileSystemUtils.files(tempDir.resolve("indices/test/0")))); // it's only one shard! CreateSnapshotResponse createSnapshotResponseSecond = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-1").setWaitForCompletion(true).setIndices("test").get(); diff --git a/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java b/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java index c654c57c4f0..e699ae2e100 100644 --- a/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java +++ b/src/test/java/org/elasticsearch/snapshots/mockstore/MockRepository.java @@ -50,7 +50,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** */ diff --git a/src/test/java/org/elasticsearch/stresstest/client/ClientFailover.java b/src/test/java/org/elasticsearch/stresstest/client/ClientFailover.java index d11cec0ab0a..fc56f128ede 100644 --- a/src/test/java/org/elasticsearch/stresstest/client/ClientFailover.java +++ b/src/test/java/org/elasticsearch/stresstest/client/ClientFailover.java @@ -21,7 +21,6 @@ package org.elasticsearch.stresstest.client; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; diff --git a/src/test/java/org/elasticsearch/stresstest/fullrestart/FullRestartStressTest.java b/src/test/java/org/elasticsearch/stresstest/fullrestart/FullRestartStressTest.java index 6690c41270b..59fca1b672b 100644 --- a/src/test/java/org/elasticsearch/stresstest/fullrestart/FullRestartStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/fullrestart/FullRestartStressTest.java @@ -27,7 +27,6 @@ import org.elasticsearch.client.Requests; import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -56,7 +55,7 @@ public class FullRestartStressTest { private int bulkSize = 1000; private int numberOfDocsPerRound = 50000; - private Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS; + private Settings settings = Settings.Builder.EMPTY_SETTINGS; private TimeValue period = TimeValue.timeValueMinutes(20); @@ -201,7 +200,7 @@ public class FullRestartStressTest { System.setProperty("es.logger.prefix", ""); int numberOfNodes = 2; - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.shard.check_on_startup", true) .put("gateway.recover_after_nodes", numberOfNodes) .put("index.number_of_shards", 1) diff --git a/src/test/java/org/elasticsearch/stresstest/gcbehavior/FilterCacheGcStress.java b/src/test/java/org/elasticsearch/stresstest/gcbehavior/FilterCacheGcStress.java index 9fbf44b79c1..315dab87039 100644 --- a/src/test/java/org/elasticsearch/stresstest/gcbehavior/FilterCacheGcStress.java +++ b/src/test/java/org/elasticsearch/stresstest/gcbehavior/FilterCacheGcStress.java @@ -20,7 +20,6 @@ package org.elasticsearch.stresstest.gcbehavior; import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; @@ -35,7 +34,7 @@ public class FilterCacheGcStress { public static void main(String[] args) { - Settings settings = ImmutableSettings.EMPTY; + Settings settings = Settings.EMPTY; Node node = NodeBuilder.nodeBuilder().settings(settings).node(); final Client client = node.client(); diff --git a/src/test/java/org/elasticsearch/stresstest/get/GetStressTest.java b/src/test/java/org/elasticsearch/stresstest/get/GetStressTest.java index 3e4c269a4c0..e2419adf391 100644 --- a/src/test/java/org/elasticsearch/stresstest/get/GetStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/get/GetStressTest.java @@ -20,7 +20,6 @@ package org.elasticsearch.stresstest.get; import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.node.Node; @@ -33,7 +32,7 @@ import java.util.concurrent.atomic.AtomicLong; public class GetStressTest { public static void main(String[] args) throws Exception { - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.number_of_shards", 2) .put("index.number_of_replicas", 1) .build(); diff --git a/src/test/java/org/elasticsearch/stresstest/indexing/BulkIndexingStressTest.java b/src/test/java/org/elasticsearch/stresstest/indexing/BulkIndexingStressTest.java index 07197393794..640a523ebd0 100644 --- a/src/test/java/org/elasticsearch/stresstest/indexing/BulkIndexingStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/indexing/BulkIndexingStressTest.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; @@ -40,7 +39,7 @@ public class BulkIndexingStressTest { final int NUMBER_OF_INDICES = 600; final int BATCH = 300; - final Settings nodeSettings = ImmutableSettings.settingsBuilder().put("index.number_of_shards", 2).build(); + final Settings nodeSettings = Settings.settingsBuilder().put("index.number_of_shards", 2).build(); // ESLogger logger = Loggers.getLogger("org.elasticsearch"); // logger.setLevel("DEBUG"); diff --git a/src/test/java/org/elasticsearch/stresstest/indexing/ConcurrentIndexingVersioningStressTest.java b/src/test/java/org/elasticsearch/stresstest/indexing/ConcurrentIndexingVersioningStressTest.java index 31cd53753ba..3fca8141b81 100644 --- a/src/test/java/org/elasticsearch/stresstest/indexing/ConcurrentIndexingVersioningStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/indexing/ConcurrentIndexingVersioningStressTest.java @@ -21,7 +21,6 @@ package org.elasticsearch.stresstest.indexing; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.SizeValue; import org.elasticsearch.index.query.QueryBuilders; @@ -39,7 +38,7 @@ public class ConcurrentIndexingVersioningStressTest { public static void main(String[] args) throws Exception { - Settings settings = ImmutableSettings.EMPTY; + Settings settings = Settings.EMPTY; Node node1 = nodeBuilder().settings(settings).node(); Node node2 = nodeBuilder().settings(settings).node(); diff --git a/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java b/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java index cc79c10913c..3ea972dce4e 100644 --- a/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java +++ b/src/test/java/org/elasticsearch/stresstest/leaks/GenericStatsLeak.java @@ -19,7 +19,7 @@ package org.elasticsearch.stresstest.leaks; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.monitor.jvm.JvmService; import org.elasticsearch.monitor.network.NetworkService; import org.elasticsearch.monitor.os.OsService; @@ -30,7 +30,7 @@ import org.elasticsearch.node.NodeBuilder; public class GenericStatsLeak { public static void main(String[] args) { - Node node = NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder() + Node node = NodeBuilder.nodeBuilder().settings(Settings.settingsBuilder() .put("monitor.os.refresh_interval", 0) .put("monitor.process.refresh_interval", 0) .put("monitor.network.refresh_interval", 0) diff --git a/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesRemoteStressTest.java b/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesRemoteStressTest.java index 0426ab647fd..591f5ce3090 100644 --- a/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesRemoteStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesRemoteStressTest.java @@ -23,7 +23,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; @@ -49,7 +49,7 @@ public class ManyIndicesRemoteStressTest { Node node = null; // TODO: what is this? a public static void main test?!?!?! if (true) { - client = TransportClient.builder().settings(ImmutableSettings.EMPTY).build().addTransportAddress(new InetSocketTransportAddress("localhost", 9300)); + client = TransportClient.builder().settings(Settings.EMPTY).build().addTransportAddress(new InetSocketTransportAddress("localhost", 9300)); } else { node = NodeBuilder.nodeBuilder().client(true).node(); client = node.client(); @@ -58,7 +58,7 @@ public class ManyIndicesRemoteStressTest { for (int i = 0; i < numberOfIndices; i++) { logger.info("START index [{}] ...", i); client.admin().indices().prepareCreate("index_" + i) - .setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", numberOfShards).put("index.number_of_replicas", numberOfReplicas)) + .setSettings(Settings.settingsBuilder().put("index.number_of_shards", numberOfShards).put("index.number_of_replicas", numberOfReplicas)) .execute().actionGet(); for (int j = 0; j < numberOfDocs; j++) { diff --git a/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesStressTest.java b/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesStressTest.java index 42e952bda68..01476f177c5 100644 --- a/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/manyindices/ManyIndicesStressTest.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; @@ -45,7 +44,7 @@ public class ManyIndicesStressTest { int numberOfIndices = 100; int numberOfDocs = 100; - Settings settings = ImmutableSettings.settingsBuilder() + Settings settings = Settings.settingsBuilder() .put("index.shard.check_on_startup", false) .put("index.number_of_shards", 1) .build(); diff --git a/src/test/java/org/elasticsearch/stresstest/manyindices/ManyNodesManyIndicesRecoveryStressTest.java b/src/test/java/org/elasticsearch/stresstest/manyindices/ManyNodesManyIndicesRecoveryStressTest.java index 57bcd69b91c..ea4d20f9149 100644 --- a/src/test/java/org/elasticsearch/stresstest/manyindices/ManyNodesManyIndicesRecoveryStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/manyindices/ManyNodesManyIndicesRecoveryStressTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.Lists; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.count.CountResponse; import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.node.Node; @@ -39,19 +38,19 @@ public class ManyNodesManyIndicesRecoveryStressTest { final int NUM_DOCS = 2; final int FLUSH_AFTER = 1; - final Settings nodeSettings = ImmutableSettings.settingsBuilder() + final Settings nodeSettings = Settings.settingsBuilder() .put("transport.netty.connections_per_node.low", 0) .put("transport.netty.connections_per_node.med", 0) .put("transport.netty.connections_per_node.high", 1) .build(); - final Settings indexSettings = ImmutableSettings.settingsBuilder() + final Settings indexSettings = Settings.settingsBuilder() .put("index.number_of_shards", 1) .build(); List nodes = Lists.newArrayList(); for (int i = 0; i < NUM_NODES; i++) { - nodes.add(NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder().put(nodeSettings).put("name", "node" + i)).node()); + nodes.add(NodeBuilder.nodeBuilder().settings(Settings.settingsBuilder().put(nodeSettings).put("name", "node" + i)).node()); } Client client = nodes.get(0).client(); @@ -96,7 +95,7 @@ public class ManyNodesManyIndicesRecoveryStressTest { nodes = Lists.newArrayList(); for (int i = 0; i < NUM_NODES; i++) { - nodes.add(NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder().put(nodeSettings).put("name", "node" + i)).node()); + nodes.add(NodeBuilder.nodeBuilder().settings(Settings.settingsBuilder().put(nodeSettings).put("name", "node" + i)).node()); } client = nodes.get(0).client(); diff --git a/src/test/java/org/elasticsearch/stresstest/refresh/RefreshStressTest1.java b/src/test/java/org/elasticsearch/stresstest/refresh/RefreshStressTest1.java index 5ff8506fc9a..eec385241e3 100644 --- a/src/test/java/org/elasticsearch/stresstest/refresh/RefreshStressTest1.java +++ b/src/test/java/org/elasticsearch/stresstest/refresh/RefreshStressTest1.java @@ -21,7 +21,7 @@ package org.elasticsearch.stresstest.refresh; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; @@ -36,13 +36,13 @@ public class RefreshStressTest1 { public static void main(String[] args) throws InterruptedException, IOException { int numberOfShards = 5; Node node = NodeBuilder.nodeBuilder().local(true).loadConfigSettings(false).clusterName("testCluster").settings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("node.name", "node1") .put("index.number_of_shards", numberOfShards) //.put("path.data", new File("target/data").getAbsolutePath()) .build()).node(); Node node2 = NodeBuilder.nodeBuilder().local(true).loadConfigSettings(false).clusterName("testCluster").settings( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("node.name", "node2") .put("index.number_of_shards", numberOfShards) //.put("path.data", new File("target/data").getAbsolutePath()) diff --git a/src/test/java/org/elasticsearch/stresstest/rollingrestart/QuickRollingRestartStressTest.java b/src/test/java/org/elasticsearch/stresstest/rollingrestart/QuickRollingRestartStressTest.java index 3f481109d21..be9281ad3c5 100644 --- a/src/test/java/org/elasticsearch/stresstest/rollingrestart/QuickRollingRestartStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/rollingrestart/QuickRollingRestartStressTest.java @@ -23,7 +23,6 @@ import com.carrotsearch.randomizedtesting.generators.RandomStrings; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.SizeValue; import org.elasticsearch.node.Node; @@ -42,7 +41,7 @@ public class QuickRollingRestartStressTest { Random random = new Random(); - Settings settings = ImmutableSettings.settingsBuilder().build(); + Settings settings = Settings.settingsBuilder().build(); Node[] nodes = new Node[5]; for (int i = 0; i < nodes.length; i++) { diff --git a/src/test/java/org/elasticsearch/stresstest/rollingrestart/RollingRestartStressTest.java b/src/test/java/org/elasticsearch/stresstest/rollingrestart/RollingRestartStressTest.java index 3f58041c2bc..76e27a5554e 100644 --- a/src/test/java/org/elasticsearch/stresstest/rollingrestart/RollingRestartStressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/rollingrestart/RollingRestartStressTest.java @@ -28,7 +28,6 @@ import org.elasticsearch.action.search.SearchType; import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -44,7 +43,7 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicLong; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; /** @@ -66,7 +65,7 @@ public class RollingRestartStressTest { private TimeValue indexerThrottle = TimeValue.timeValueMillis(100); - private Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS; + private Settings settings = Settings.Builder.EMPTY_SETTINGS; private TimeValue period = TimeValue.timeValueMinutes(20); diff --git a/src/test/java/org/elasticsearch/stresstest/search1/Search1StressTest.java b/src/test/java/org/elasticsearch/stresstest/search1/Search1StressTest.java index ad03d23e295..0963717e991 100644 --- a/src/test/java/org/elasticsearch/stresstest/search1/Search1StressTest.java +++ b/src/test/java/org/elasticsearch/stresstest/search1/Search1StressTest.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.SizeValue; import org.elasticsearch.common.unit.TimeValue; @@ -64,7 +63,7 @@ public class Search1StressTest { private int numberOfHits = 300; private TimeValue flusherThrottle = TimeValue.timeValueMillis(1000); - private Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS; + private Settings settings = Settings.Builder.EMPTY_SETTINGS; private TimeValue period = TimeValue.timeValueMinutes(20); diff --git a/src/test/java/org/elasticsearch/test/CompositeTestCluster.java b/src/test/java/org/elasticsearch/test/CompositeTestCluster.java index 03f4590daa5..618900c4268 100644 --- a/src/test/java/org/elasticsearch/test/CompositeTestCluster.java +++ b/src/test/java/org/elasticsearch/test/CompositeTestCluster.java @@ -28,7 +28,6 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.FilterClient; import org.elasticsearch.common.breaker.CircuitBreaker; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; @@ -106,7 +105,7 @@ public class CompositeTestCluster extends TestCluster { * external node is running it returns false */ public synchronized boolean upgradeOneNode() throws InterruptedException, IOException { - return upgradeOneNode(ImmutableSettings.EMPTY); + return upgradeOneNode(Settings.EMPTY); } /** @@ -115,7 +114,7 @@ public class CompositeTestCluster extends TestCluster { * @return true iff at least one node as upgraded. */ public synchronized boolean upgradeAllNodes() throws InterruptedException, IOException { - return upgradeAllNodes(ImmutableSettings.EMPTY); + return upgradeAllNodes(Settings.EMPTY); } @@ -172,7 +171,7 @@ public class CompositeTestCluster extends TestCluster { * Allows allocation of shards of the given indices on all nodes in the cluster. */ public void allowOnAllNodes(String... index) { - Settings build = ImmutableSettings.builder().put("index.routing.allocation.exclude._name", "").build(); + Settings build = Settings.builder().put("index.routing.allocation.exclude._name", "").build(); client().admin().indices().prepareUpdateSettings(index).setSettings(build).execute().actionGet(); } @@ -182,7 +181,7 @@ public class CompositeTestCluster extends TestCluster { * be allocated on some other "new" node. */ public void allowOnlyNewNodes(String... index) { - Settings build = ImmutableSettings.builder().put("index.routing.allocation.exclude._name", backwardsNodePattern()).build(); + Settings build = Settings.builder().put("index.routing.allocation.exclude._name", backwardsNodePattern()).build(); client().admin().indices().prepareUpdateSettings(index).setSettings(build).execute().actionGet(); } diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchAllocationTestCase.java b/src/test/java/org/elasticsearch/test/ElasticsearchAllocationTestCase.java index 3b5848dae10..c932d8219f1 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchAllocationTestCase.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchAllocationTestCase.java @@ -30,7 +30,6 @@ import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocators; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecidersModule; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.common.transport.TransportAddress; @@ -50,7 +49,7 @@ import static org.hamcrest.CoreMatchers.is; public abstract class ElasticsearchAllocationTestCase extends ElasticsearchTestCase { public static AllocationService createAllocationService() { - return createAllocationService(ImmutableSettings.Builder.EMPTY_SETTINGS); + return createAllocationService(Settings.Builder.EMPTY_SETTINGS); } public static AllocationService createAllocationService(Settings settings) { @@ -58,7 +57,7 @@ public abstract class ElasticsearchAllocationTestCase extends ElasticsearchTestC } public static AllocationService createAllocationService(Settings settings, Random random) { - return createAllocationService(settings, new NodeSettingsService(ImmutableSettings.Builder.EMPTY_SETTINGS), random); + return createAllocationService(settings, new NodeSettingsService(Settings.Builder.EMPTY_SETTINGS), random); } public static AllocationService createAllocationService(Settings settings, NodeSettingsService nodeSettingsService, Random random) { diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java index cba934593a0..4d01d53d221 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java @@ -27,7 +27,6 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.recovery.RecoverySettings; import org.elasticsearch.test.junit.annotations.TestLogging; @@ -134,7 +133,7 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti } @Override - protected ImmutableSettings.Builder setRandomSettings(Random random, ImmutableSettings.Builder builder) { + protected Settings.Builder setRandomSettings(Random random, Settings.Builder builder) { if (globalCompatibilityVersion().before(Version.V_1_3_2)) { // if we test against nodes before 1.3.2 we disable all the compression due to a known bug // see #7210 @@ -204,7 +203,7 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti private Settings addLoggerSettings(Settings externalNodesSettings) { TestLogging logging = getClass().getAnnotation(TestLogging.class); Map loggingLevels = LoggingListener.getLoggersAndLevelsFromAnnotation(logging); - ImmutableSettings.Builder finalSettings = ImmutableSettings.settingsBuilder(); + Settings.Builder finalSettings = Settings.settingsBuilder(); if (loggingLevels != null) { for (Map.Entry level : loggingLevels.entrySet()) { finalSettings.put("logger." + level.getKey(), level.getValue()); @@ -249,7 +248,7 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti } protected Settings commonNodeSettings(int nodeOrdinal) { - ImmutableSettings.Builder builder = ImmutableSettings.builder().put(requiredSettings()) + Settings.Builder builder = Settings.builder().put(requiredSettings()) .put(TransportModule.TRANSPORT_TYPE_KEY, NettyTransport.class.getName()) // run same transport / disco as external .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, TransportService.class.getName()); if (compatibilityVersion().before(Version.V_1_3_2)) { diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index df786df3d6a..ea05c58ae35 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -78,7 +78,6 @@ import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.regex.Regex; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.TransportAddress; @@ -165,7 +164,7 @@ import java.util.concurrent.atomic.AtomicLong; 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.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.XContentTestUtils.convertToMap; import static org.elasticsearch.test.XContentTestUtils.mapsEqualIgnoringArrayOrder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -383,8 +382,8 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase // TODO move settings for random directory etc here into the index based randomized settings. if (cluster().size() > 0) { - ImmutableSettings.Builder randomSettingsBuilder = - setRandomSettings(getRandom(), ImmutableSettings.builder()) + Settings.Builder randomSettingsBuilder = + setRandomSettings(getRandom(), Settings.builder()) .put(SETTING_INDEX_SEED, getRandom().nextLong()); randomSettingsBuilder.put(SETTING_NUMBER_OF_SHARDS, numberOfShards()) @@ -488,7 +487,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase } } - protected ImmutableSettings.Builder setRandomSettings(Random random, ImmutableSettings.Builder builder) { + protected Settings.Builder setRandomSettings(Random random, Settings.Builder builder) { setRandomMerge(random, builder); setRandomTranslogSettings(random, builder); setRandomNormsLoading(random, builder); @@ -542,7 +541,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase return builder; } - private static ImmutableSettings.Builder setRandomScriptingSettings(Random random, ImmutableSettings.Builder builder) { + private static Settings.Builder setRandomScriptingSettings(Random random, Settings.Builder builder) { if (random.nextBoolean()) { builder.put(ScriptService.SCRIPT_CACHE_SIZE_SETTING, RandomInts.randomIntBetween(random, -100, 2000)); } @@ -552,7 +551,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase return builder; } - private static ImmutableSettings.Builder setRandomMerge(Random random, ImmutableSettings.Builder builder) { + private static Settings.Builder setRandomMerge(Random random, Settings.Builder builder) { if (random.nextBoolean()) { builder.put(AbstractMergePolicyProvider.INDEX_COMPOUND_FORMAT, random.nextBoolean() ? random.nextDouble() : random.nextBoolean()); @@ -585,14 +584,14 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase return builder; } - private static ImmutableSettings.Builder setRandomNormsLoading(Random random, ImmutableSettings.Builder builder) { + private static Settings.Builder setRandomNormsLoading(Random random, Settings.Builder builder) { if (random.nextBoolean()) { builder.put(SearchService.NORMS_LOADING_KEY, RandomPicks.randomFrom(random, Arrays.asList(FieldMapper.Loading.EAGER, FieldMapper.Loading.LAZY))); } return builder; } - private static ImmutableSettings.Builder setRandomTranslogSettings(Random random, ImmutableSettings.Builder builder) { + private static Settings.Builder setRandomTranslogSettings(Random random, Settings.Builder builder) { if (random.nextBoolean()) { builder.put(TranslogService.INDEX_TRANSLOG_FLUSH_THRESHOLD_OPS, RandomInts.randomIntBetween(random, 1, 10000)); } @@ -784,7 +783,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase * can be controlled through specific methods. */ public Settings indexSettings() { - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); int numberOfShards = numberOfShards(); if (numberOfShards > 0) { builder.put(SETTING_NUMBER_OF_SHARDS, numberOfShards).build(); @@ -840,7 +839,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase *

*/ public final CreateIndexRequestBuilder prepareCreate(String index, int numNodes) { - return prepareCreate(index, numNodes, ImmutableSettings.builder()); + return prepareCreate(index, numNodes, Settings.builder()); } /** @@ -852,10 +851,10 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase * rules based on index.routing.allocation.exclude._name. *

*/ - public CreateIndexRequestBuilder prepareCreate(String index, int numNodes, ImmutableSettings.Builder settingsBuilder) { + public CreateIndexRequestBuilder prepareCreate(String index, int numNodes, Settings.Builder settingsBuilder) { internalCluster().ensureAtLeastNumDataNodes(numNodes); - ImmutableSettings.Builder builder = ImmutableSettings.builder().put(indexSettings()).put(settingsBuilder.build()); + Settings.Builder builder = Settings.builder().put(indexSettings()).put(settingsBuilder.build()); if (numNodes > 0) { getExcludeSettings(index, numNodes, builder); @@ -863,7 +862,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase return client().admin().indices().prepareCreate(index).setSettings(builder.build()); } - private ImmutableSettings.Builder getExcludeSettings(String index, int num, ImmutableSettings.Builder builder) { + private Settings.Builder getExcludeSettings(String index, int num, Settings.Builder builder) { String exclude = Joiner.on(',').join(internalCluster().allDataNodesButN(num)); builder.put("index.routing.allocation.exclude._name", exclude); return builder; @@ -954,7 +953,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase public void allowNodes(String index, int n) { assert index != null; internalCluster().ensureAtLeastNumDataNodes(n); - ImmutableSettings.Builder builder = ImmutableSettings.builder(); + Settings.Builder builder = Settings.builder(); if (n > 0) { getExcludeSettings(index, n, builder); } @@ -1466,25 +1465,25 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase /** Disables translog flushing for the specified index */ public static void disableTranslogFlush(String index) { - Settings settings = ImmutableSettings.builder().put(TranslogService.INDEX_TRANSLOG_DISABLE_FLUSH, true).build(); + Settings settings = Settings.builder().put(TranslogService.INDEX_TRANSLOG_DISABLE_FLUSH, true).build(); client().admin().indices().prepareUpdateSettings(index).setSettings(settings).get(); } /** Enables translog flushing for the specified index */ public static void enableTranslogFlush(String index) { - Settings settings = ImmutableSettings.builder().put(TranslogService.INDEX_TRANSLOG_DISABLE_FLUSH, false).build(); + Settings settings = Settings.builder().put(TranslogService.INDEX_TRANSLOG_DISABLE_FLUSH, false).build(); client().admin().indices().prepareUpdateSettings(index).setSettings(settings).get(); } /** Disables an index block for the specified index */ public static void disableIndexBlock(String index, String block) { - Settings settings = ImmutableSettings.builder().put(block, false).build(); + Settings settings = Settings.builder().put(block, false).build(); client().admin().indices().prepareUpdateSettings(index).setSettings(settings).get(); } /** Enables an index block for the specified index */ public static void enableIndexBlock(String index, String block) { - Settings settings = ImmutableSettings.builder().put(block, true).build(); + Settings settings = Settings.builder().put(block, true).build(); client().admin().indices().prepareUpdateSettings(index).setSettings(settings).get(); } @@ -1718,7 +1717,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase * add by default. */ protected Settings transportClientSettings() { - return ImmutableSettings.EMPTY; + return Settings.EMPTY; } private ExternalTestCluster buildExternalCluster(String clusterAddresses) { @@ -1762,7 +1761,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase SettingsSource settingsSource = new SettingsSource() { @Override public Settings node(int nodeOrdinal) { - return ImmutableSettings.builder().put(Node.HTTP_ENABLED, false). + return Settings.builder().put(Node.HTTP_ENABLED, false). put(nodeSettings(nodeOrdinal)).build(); } @@ -2049,7 +2048,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase Files.move(src, dest); assertFalse(Files.exists(src)); assertTrue(Files.exists(dest)); - ImmutableSettings.Builder builder = ImmutableSettings.builder() + Settings.Builder builder = Settings.builder() .put(settings) .put("path.data", dataDir.toAbsolutePath()); diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchSingleNodeTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchSingleNodeTest.java index 93f10ee5878..49be171eba2 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchSingleNodeTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchSingleNodeTest.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.test; -import com.carrotsearch.randomizedtesting.LifecycleScope; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; @@ -31,7 +30,6 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Priority; import org.elasticsearch.common.lease.Releasables; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.BigArrays; @@ -119,7 +117,7 @@ public abstract class ElasticsearchSingleNodeTest extends ElasticsearchTestCase } private static Node newNode() { - Node build = NodeBuilder.nodeBuilder().local(true).data(true).settings(ImmutableSettings.builder() + Node build = NodeBuilder.nodeBuilder().local(true).data(true).settings(Settings.builder() .put(ClusterName.SETTING, InternalTestCluster.clusterName("single-node-cluster", randomLong())) .put("path.home", createTempDir()) .put("node.name", nodeName()) @@ -168,7 +166,7 @@ public abstract class ElasticsearchSingleNodeTest extends ElasticsearchTestCase * Create a new index on the singleton node with empty index settings. */ protected static IndexService createIndex(String index) { - return createIndex(index, ImmutableSettings.EMPTY); + return createIndex(index, Settings.EMPTY); } /** diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java b/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java index 299a60a9715..f8a580f9bf3 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchTestCase.java @@ -44,7 +44,6 @@ import org.elasticsearch.cluster.routing.DjbHashFunction; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsAbortPolicy; import org.elasticsearch.common.util.concurrent.EsExecutors; @@ -183,7 +182,7 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase { public static void setProcessors() { int numCpu = TestUtil.nextInt(random(), 1, 4); System.setProperty(EsExecutors.DEFAULT_SYSPROP, Integer.toString(numCpu)); - assertEquals(numCpu, EsExecutors.boundedNumberOfProcessors(ImmutableSettings.EMPTY)); + assertEquals(numCpu, EsExecutors.boundedNumberOfProcessors(Settings.EMPTY)); } @AfterClass @@ -493,11 +492,11 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase { } public NodeEnvironment newNodeEnvironment() throws IOException { - return newNodeEnvironment(ImmutableSettings.EMPTY); + return newNodeEnvironment(Settings.EMPTY); } public NodeEnvironment newNodeEnvironment(Settings settings) throws IOException { - Settings build = ImmutableSettings.builder() + Settings build = Settings.builder() .put(settings) .put("path.home", createTempDir().toAbsolutePath()) .putArray("path.data", tmpPaths()).build(); @@ -505,8 +504,8 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase { } /** Return consistent index settings for the provided index version. */ - public static ImmutableSettings.Builder settings(Version version) { - ImmutableSettings.Builder builder = ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version); + public static Settings.Builder settings(Version version) { + Settings.Builder builder = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, version); if (version.before(Version.V_2_0_0)) { builder.put(IndexMetaData.SETTING_LEGACY_ROUTING_HASH_FUNCTION, DjbHashFunction.class); } diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchTokenStreamTestCase.java b/src/test/java/org/elasticsearch/test/ElasticsearchTokenStreamTestCase.java index e5fd76b518a..f3a8e5a2905 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchTokenStreamTestCase.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchTokenStreamTestCase.java @@ -28,7 +28,7 @@ import org.apache.lucene.util.TimeUnits; import org.elasticsearch.Version; import org.elasticsearch.bootstrap.BootstrapForTesting; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter; @Listeners({ @@ -51,7 +51,7 @@ public abstract class ElasticsearchTokenStreamTestCase extends BaseTokenStreamTe return VersionUtils.randomVersion(random()); } - public ImmutableSettings.Builder newAnalysisSettingsBuilder() { - return ImmutableSettings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT); + public Settings.Builder newAnalysisSettingsBuilder() { + return Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT); } } diff --git a/src/test/java/org/elasticsearch/test/ExternalNode.java b/src/test/java/org/elasticsearch/test/ExternalNode.java index 4b6ceed0a06..40a6223aca9 100644 --- a/src/test/java/org/elasticsearch/test/ExternalNode.java +++ b/src/test/java/org/elasticsearch/test/ExternalNode.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.discovery.DiscoveryModule; @@ -40,21 +39,20 @@ import java.io.Closeable; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Random; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * Simple helper class to start external nodes to be used within a test cluster */ final class ExternalNode implements Closeable { - public static final Settings REQUIRED_SETTINGS = ImmutableSettings.builder() + public static final Settings REQUIRED_SETTINGS = Settings.builder() .put("config.ignore_system_properties", true) .put(DiscoveryModule.DISCOVERY_TYPE_KEY, "zen") .put("node.mode", "network").build(); // we need network mode for this @@ -87,7 +85,7 @@ final class ExternalNode implements Closeable { synchronized ExternalNode start(Client localNode, Settings defaultSettings, String nodeName, String clusterName, int nodeOrdinal) throws IOException, InterruptedException { ExternalNode externalNode = new ExternalNode(path, clusterName, random.nextLong(), settingsSource); - Settings settings = ImmutableSettings.builder().put(defaultSettings).put(settingsSource.node(nodeOrdinal)).build(); + Settings settings = Settings.builder().put(defaultSettings).put(settingsSource.node(nodeOrdinal)).build(); externalNode.startInternal(localNode, settings, nodeName, clusterName); return externalNode; } @@ -106,7 +104,7 @@ final class ExternalNode implements Closeable { } params.add("-Des.cluster.name=" + clusterName); params.add("-Des.node.name=" + nodeName); - ImmutableSettings.Builder externaNodeSettingsBuilder = ImmutableSettings.builder(); + Settings.Builder externaNodeSettingsBuilder = Settings.builder(); for (Map.Entry entry : settings.getAsMap().entrySet()) { switch (entry.getKey()) { case "cluster.name": diff --git a/src/test/java/org/elasticsearch/test/ExternalTestCluster.java b/src/test/java/org/elasticsearch/test/ExternalTestCluster.java index cd30b9937fb..fcb977a6104 100644 --- a/src/test/java/org/elasticsearch/test/ExternalTestCluster.java +++ b/src/test/java/org/elasticsearch/test/ExternalTestCluster.java @@ -30,7 +30,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.TransportAddress; @@ -66,7 +65,7 @@ public final class ExternalTestCluster extends TestCluster { public ExternalTestCluster(TransportAddress... transportAddresses) { super(0); - Settings clientSettings = ImmutableSettings.settingsBuilder() + Settings clientSettings = Settings.settingsBuilder() .put("name", InternalTestCluster.TRANSPORT_CLIENT_PREFIX + EXTERNAL_CLUSTER_PREFIX + counter.getAndIncrement()) .put("config.ignore_system_properties", true) // prevents any settings to be replaced by system properties. .put("client.transport.ignore_cluster_name", true) diff --git a/src/test/java/org/elasticsearch/test/InternalTestCluster.java b/src/test/java/org/elasticsearch/test/InternalTestCluster.java index 0ca7ae60ff6..34593a9e111 100644 --- a/src/test/java/org/elasticsearch/test/InternalTestCluster.java +++ b/src/test/java/org/elasticsearch/test/InternalTestCluster.java @@ -58,9 +58,8 @@ import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.network.NetworkUtils; -import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.common.settings.ImmutableSettings.Builder; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.unit.ByteSizeUnit; @@ -82,7 +81,6 @@ import org.elasticsearch.index.shard.IndexShardModule; import org.elasticsearch.index.shard.IndexShardState; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.store.IndexStoreModule; -import org.elasticsearch.index.translog.Translog; import org.elasticsearch.index.translog.TranslogConfig; import org.elasticsearch.index.translog.TranslogWriter; import org.elasticsearch.indices.IndicesService; @@ -90,7 +88,6 @@ import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache; import org.elasticsearch.indices.recovery.RecoverySettings; -import org.elasticsearch.monitor.sigar.SigarService; import org.elasticsearch.node.Node; import org.elasticsearch.node.service.NodeService; import org.elasticsearch.plugins.PluginsService; @@ -123,7 +120,7 @@ import java.util.concurrent.atomic.AtomicInteger; import static junit.framework.Assert.fail; import static org.apache.lucene.util.LuceneTestCase.*; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.test.ElasticsearchTestCase.assertBusy; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout; @@ -266,7 +263,7 @@ public final class InternalTestCluster extends TestCluster { logger.info("Setup InternalTestCluster [{}] with seed [{}] using [{}] data nodes and [{}] client nodes", clusterName, SeedUtils.formatSeed(clusterSeed), numSharedDataNodes, numSharedClientNodes); this.settingsSource = settingsSource; - Builder builder = ImmutableSettings.settingsBuilder(); + Builder builder = Settings.settingsBuilder(); 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); @@ -314,7 +311,7 @@ public final class InternalTestCluster extends TestCluster { } public static String nodeMode() { - Builder builder = ImmutableSettings.builder(); + Builder builder = Settings.builder(); if (Strings.isEmpty(System.getProperty("es.node.mode")) && Strings.isEmpty(System.getProperty("es.node.local"))) { return "local"; // default if nothing is specified } @@ -348,7 +345,7 @@ public final class InternalTestCluster extends TestCluster { } private Settings getSettings(int nodeOrdinal, long nodeSeed, Settings others) { - Builder builder = ImmutableSettings.settingsBuilder().put(defaultSettings) + Builder builder = Settings.settingsBuilder().put(defaultSettings) .put(getRandomNodeSettings(nodeSeed)); Settings settings = settingsSource.node(nodeOrdinal); if (settings != null) { @@ -366,7 +363,7 @@ public final class InternalTestCluster extends TestCluster { private static Settings getRandomNodeSettings(long seed) { Random random = new Random(seed); - Builder builder = ImmutableSettings.settingsBuilder() + Builder builder = Settings.settingsBuilder() // decrease the routing schedule so new nodes will be added quickly - some random value between 30 and 80 ms .put("cluster.routing.schedule", (30 + random.nextInt(50)) + "ms") .put(SETTING_CLUSTER_NODE_SEED, seed); @@ -409,7 +406,7 @@ public final class InternalTestCluster extends TestCluster { if (random.nextInt(10) == 0) { // node gets an extra cpu this time - builder.put(EsExecutors.PROCESSORS, 1 + EsExecutors.boundedNumberOfProcessors(ImmutableSettings.EMPTY)); + builder.put(EsExecutors.PROCESSORS, 1 + EsExecutors.boundedNumberOfProcessors(Settings.EMPTY)); } if (random.nextBoolean()) { @@ -656,7 +653,7 @@ public final class InternalTestCluster extends TestCluster { return randomNodeAndClient.client(random); } int nodeId = nextNodeId.getAndIncrement(); - Settings settings = getSettings(nodeId, random.nextLong(), ImmutableSettings.EMPTY); + Settings settings = getSettings(nodeId, random.nextLong(), Settings.EMPTY); startNodeClient(settings); return getRandomNodeAndClient(new ClientNodePredicate()).client(random); } @@ -826,7 +823,7 @@ public final class InternalTestCluster extends TestCluster { } Settings newSettings = callback.onNodeStopped(name); if (newSettings == null) { - newSettings = ImmutableSettings.EMPTY; + newSettings = Settings.EMPTY; } if (callback.clearData(name)) { NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, node); @@ -862,7 +859,7 @@ public final class InternalTestCluster extends TestCluster { TransportClientFactory(boolean sniff, Settings settings, Path baseDir) { this.sniff = sniff; - this.settings = settings != null ? settings : ImmutableSettings.EMPTY; + this.settings = settings != null ? settings : Settings.EMPTY; this.baseDir = baseDir; } @@ -934,7 +931,7 @@ public final class InternalTestCluster extends TestCluster { NodeAndClient nodeAndClient = nodes.get(buildNodeName); if (nodeAndClient == null) { changed = true; - Builder clientSettingsBuilder = ImmutableSettings.builder().put("node.client", true); + Builder clientSettingsBuilder = Settings.builder().put("node.client", true); nodeAndClient = buildNode(i, sharedNodesSeeds[i], clientSettingsBuilder.build(), Version.CURRENT); nodeAndClient.node.start(); logger.info("Start Shared Node [{}] not shared", nodeAndClient.name); @@ -1402,14 +1399,14 @@ public final class InternalTestCluster extends TestCluster { * Starts a node with default settings and returns it's name. */ public synchronized String startNode() { - return startNode(ImmutableSettings.EMPTY, Version.CURRENT); + return startNode(Settings.EMPTY, Version.CURRENT); } /** * Starts a node with default settings ad the specified version and returns it's name. */ public synchronized String startNode(Version version) { - return startNode(ImmutableSettings.EMPTY, version); + return startNode(Settings.EMPTY, version); } /** @@ -1440,7 +1437,7 @@ public final class InternalTestCluster extends TestCluster { * Starts a node in an async manner with the given settings and returns future with its name. */ public synchronized ListenableFuture startNodeAsync() { - return startNodeAsync(ImmutableSettings.EMPTY, Version.CURRENT); + return startNodeAsync(Settings.EMPTY, Version.CURRENT); } /** @@ -1476,7 +1473,7 @@ public final class InternalTestCluster extends TestCluster { * Starts multiple nodes in an async manner and returns future with its name. */ public synchronized ListenableFuture> startNodesAsync(final int numNodes) { - return startNodesAsync(numNodes, ImmutableSettings.EMPTY, Version.CURRENT); + return startNodesAsync(numNodes, Settings.EMPTY, Version.CURRENT); } /** @@ -1713,7 +1710,7 @@ public final class InternalTestCluster extends TestCluster { * Executed once the give node name has been stopped. */ public Settings onNodeStopped(String nodeName) throws Exception { - return ImmutableSettings.EMPTY; + return Settings.EMPTY; } /** diff --git a/src/test/java/org/elasticsearch/test/cache/recycler/MockPageCacheRecycler.java b/src/test/java/org/elasticsearch/test/cache/recycler/MockPageCacheRecycler.java index 6613a786449..eea29f82302 100644 --- a/src/test/java/org/elasticsearch/test/cache/recycler/MockPageCacheRecycler.java +++ b/src/test/java/org/elasticsearch/test/cache/recycler/MockPageCacheRecycler.java @@ -22,7 +22,6 @@ package org.elasticsearch.test.cache.recycler; import com.google.common.base.Predicate; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.recycler.Recycler.V; diff --git a/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java b/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java index b36bf8f95db..6b63243b546 100644 --- a/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java +++ b/src/test/java/org/elasticsearch/test/discovery/ClusterDiscoveryConfiguration.java @@ -22,7 +22,6 @@ import com.carrotsearch.randomizedtesting.RandomizedTest; import com.google.common.primitives.Ints; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.network.NetworkUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.SettingsSource; @@ -36,7 +35,7 @@ import java.util.Set; public class ClusterDiscoveryConfiguration extends SettingsSource { - static Settings DEFAULT_NODE_SETTINGS = ImmutableSettings.settingsBuilder().put("discovery.type", "zen").build(); + static Settings DEFAULT_NODE_SETTINGS = Settings.settingsBuilder().put("discovery.type", "zen").build(); final int numOfNodes; final Settings nodeSettings; @@ -44,8 +43,8 @@ public class ClusterDiscoveryConfiguration extends SettingsSource { public ClusterDiscoveryConfiguration(int numOfNodes, Settings extraSettings) { this.numOfNodes = numOfNodes; - this.nodeSettings = ImmutableSettings.builder().put(DEFAULT_NODE_SETTINGS).put(extraSettings).build(); - this.transportClientSettings = ImmutableSettings.builder().put(extraSettings).build(); + this.nodeSettings = Settings.builder().put(DEFAULT_NODE_SETTINGS).put(extraSettings).build(); + this.transportClientSettings = Settings.builder().put(extraSettings).build(); } @Override @@ -76,7 +75,7 @@ public class ClusterDiscoveryConfiguration extends SettingsSource { } public UnicastZen(int numOfNodes, int numOfUnicastHosts) { - this(numOfNodes, numOfUnicastHosts, ImmutableSettings.EMPTY); + this(numOfNodes, numOfUnicastHosts, Settings.EMPTY); } public UnicastZen(int numOfNodes, int numOfUnicastHosts, Settings extraSettings) { @@ -99,7 +98,7 @@ public class ClusterDiscoveryConfiguration extends SettingsSource { } public UnicastZen(int numOfNodes, int[] unicastHostOrdinals) { - this(numOfNodes, ImmutableSettings.EMPTY, unicastHostOrdinals); + this(numOfNodes, Settings.EMPTY, unicastHostOrdinals); } public UnicastZen(int numOfNodes, Settings extraSettings, int[] unicastHostOrdinals) { @@ -116,7 +115,7 @@ public class ClusterDiscoveryConfiguration extends SettingsSource { @Override public Settings node(int nodeOrdinal) { - ImmutableSettings.Builder builder = ImmutableSettings.builder() + Settings.Builder builder = Settings.builder() .put("discovery.zen.ping.multicast.enabled", false); String[] unicastHosts = new String[unicastHostOrdinals.length]; diff --git a/src/test/java/org/elasticsearch/test/gateway/NoopGatewayAllocator.java b/src/test/java/org/elasticsearch/test/gateway/NoopGatewayAllocator.java index 96365e11eff..ac582511032 100644 --- a/src/test/java/org/elasticsearch/test/gateway/NoopGatewayAllocator.java +++ b/src/test/java/org/elasticsearch/test/gateway/NoopGatewayAllocator.java @@ -22,7 +22,7 @@ package org.elasticsearch.test.gateway; import org.elasticsearch.cluster.routing.allocation.FailedRerouteAllocation; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.cluster.routing.allocation.StartedRerouteAllocation; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.gateway.GatewayAllocator; /** @@ -33,7 +33,7 @@ public class NoopGatewayAllocator extends GatewayAllocator { public static final NoopGatewayAllocator INSTANCE = new NoopGatewayAllocator(); private NoopGatewayAllocator() { - super(ImmutableSettings.EMPTY, null, null); + super(Settings.EMPTY, null, null); } @Override diff --git a/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTestCase.java b/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTestCase.java index 9661e3950c6..5951a9a5815 100644 --- a/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTestCase.java +++ b/src/test/java/org/elasticsearch/test/rest/ElasticsearchRestTestCase.java @@ -32,7 +32,6 @@ import org.apache.lucene.util.TimeUnits; import org.elasticsearch.common.Strings; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.node.Node; @@ -141,7 +140,7 @@ public abstract class ElasticsearchRestTestCase extends ElasticsearchIntegration @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.builder() + return Settings.builder() .put(Node.HTTP_ENABLED, true) .put(super.nodeSettings(nodeOrdinal)).build(); } @@ -305,7 +304,7 @@ public abstract class ElasticsearchRestTestCase extends ElasticsearchIntegration * Used to obtain settings for the REST client that is used to send REST requests. */ protected Settings restClientSettings() { - return ImmutableSettings.EMPTY; + return Settings.EMPTY; } @Before diff --git a/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java b/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java index 00e493da1c3..036d98cc187 100644 --- a/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java +++ b/src/test/java/org/elasticsearch/test/store/MockFSDirectoryService.java @@ -32,9 +32,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.lucene.Lucene; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.*; @@ -210,7 +208,7 @@ public class MockFSDirectoryService extends FsDirectoryService { } private FsDirectoryService randomDirectorService(IndexStore indexStore, ShardPath path) { - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder(); + Settings.Builder builder = Settings.settingsBuilder(); builder.put(indexSettings); builder.put(IndexStoreModule.STORE_TYPE, RandomPicks.randomFrom(random, IndexStoreModule.Type.values())); return new FsDirectoryService(builder.build(), indexStore, path); diff --git a/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java b/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java index ade21f3182b..2020c9f2710 100644 --- a/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java +++ b/src/test/java/org/elasticsearch/test/store/MockFSIndexStore.java @@ -21,9 +21,7 @@ package org.elasticsearch.test.store; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.index.Index; -import org.elasticsearch.index.IndexService; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.settings.IndexSettingsService; import org.elasticsearch.index.store.DirectoryService; diff --git a/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java b/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java index 47bcff77b99..d7ffab93115 100644 --- a/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java +++ b/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java @@ -34,7 +34,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Random; -import static org.elasticsearch.test.InternalTestCluster.clusterName; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasEntry; diff --git a/src/test/java/org/elasticsearch/test/transport/MockTransportService.java b/src/test/java/org/elasticsearch/test/transport/MockTransportService.java index c5bc4db69d4..2a566a1ff53 100644 --- a/src/test/java/org/elasticsearch/test/transport/MockTransportService.java +++ b/src/test/java/org/elasticsearch/test/transport/MockTransportService.java @@ -19,7 +19,6 @@ package org.elasticsearch.test.transport; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.Lifecycle; import org.elasticsearch.common.component.LifecycleListener; diff --git a/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolTests.java b/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolTests.java index 59dbb6fb7fa..2e4ef0fe209 100644 --- a/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolTests.java +++ b/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.common.network.MulticastChannel; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -51,7 +50,7 @@ import java.util.Set; import java.util.concurrent.*; import java.util.regex.Pattern; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; @@ -64,7 +63,7 @@ public class SimpleThreadPoolTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("threadpool.search.type", "cached").build(); + return Settings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("threadpool.search.type", "cached").build(); } @Test @@ -194,7 +193,7 @@ public class SimpleThreadPoolTests extends ElasticsearchIntegrationTest { @Test public void testThreadPoolLeakingThreadsWithTribeNode() { - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("node.name", "thread_pool_leaking_threads_tribe_node") .put("path.home", createTempDir()) .put("tribe.t1.cluster.name", "non_existing_cluster") diff --git a/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java b/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java index d89fa06371f..1984406306f 100644 --- a/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java +++ b/src/test/java/org/elasticsearch/threadpool/ThreadPoolSerializationTests.java @@ -33,9 +33,8 @@ import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; import java.util.Map; -import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; diff --git a/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java b/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java index c697184ec6e..27a379e5de5 100644 --- a/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java +++ b/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.threadpool; import com.google.common.util.concurrent.MoreExecutors; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor; import org.elasticsearch.test.ElasticsearchTestCase; @@ -33,7 +32,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.*; /** @@ -52,7 +51,7 @@ public class UpdateThreadPoolSettingsTests extends ElasticsearchTestCase { @Test public void testCachedExecutorType() throws InterruptedException { ThreadPool threadPool = new ThreadPool( - ImmutableSettings.settingsBuilder() + Settings.settingsBuilder() .put("threadpool.search.type", "cached") .put("name","testCachedExecutorType").build()); @@ -202,7 +201,7 @@ public class UpdateThreadPoolSettingsTests extends ElasticsearchTestCase { @Test(timeout = 10000) public void testShutdownDownNowDoesntBlock() throws Exception { - ThreadPool threadPool = new ThreadPool(ImmutableSettings.settingsBuilder() + ThreadPool threadPool = new ThreadPool(Settings.settingsBuilder() .put("threadpool.search.type", "cached") .put("name","testCachedExecutorType").build()); @@ -231,7 +230,7 @@ public class UpdateThreadPoolSettingsTests extends ElasticsearchTestCase { @Test public void testCustomThreadPool() throws Exception { - ThreadPool threadPool = new ThreadPool(ImmutableSettings.settingsBuilder() + ThreadPool threadPool = new ThreadPool(Settings.settingsBuilder() .put("threadpool.my_pool1.type", "cached") .put("threadpool.my_pool2.type", "fixed") .put("threadpool.my_pool2.size", "1") @@ -265,7 +264,7 @@ public class UpdateThreadPoolSettingsTests extends ElasticsearchTestCase { assertThat(foundPool2, is(true)); // Updating my_pool2 - Settings settings = ImmutableSettings.builder() + Settings settings = Settings.builder() .put("threadpool.my_pool2.size", "10") .build(); threadPool.updateSettings(settings); diff --git a/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java b/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java index 09bdd79c70a..8370eba81de 100644 --- a/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java +++ b/src/test/java/org/elasticsearch/transport/AbstractSimpleTransportTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.unit.TimeValue; @@ -68,12 +67,12 @@ public abstract class AbstractSimpleTransportTests extends ElasticsearchTestCase super.setUp(); threadPool = new ThreadPool(getClass().getName()); serviceA = build( - ImmutableSettings.builder().put("name", "TS_A", TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(), + Settings.builder().put("name", "TS_A", TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(), version0 ); nodeA = new DiscoveryNode("TS_A", "TS_A", serviceA.boundAddress().publishAddress(), ImmutableMap.of(), version0); serviceB = build( - ImmutableSettings.builder().put("name", "TS_B", TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(), + Settings.builder().put("name", "TS_B", TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(), version1 ); nodeB = new DiscoveryNode("TS_B", "TS_B", serviceB.boundAddress().publishAddress(), ImmutableMap.of(), version1); @@ -661,7 +660,7 @@ public abstract class AbstractSimpleTransportTests extends ElasticsearchTestCase excludeSettings = "DOESN'T_MATCH"; } - serviceA.applySettings(ImmutableSettings.builder() + serviceA.applySettings(Settings.builder() .put(TransportService.SETTING_TRACE_LOG_INCLUDE, includeSettings, TransportService.SETTING_TRACE_LOG_EXCLUDE, excludeSettings) .build()); diff --git a/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java b/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java index bc506de6bdc..289659867d2 100644 --- a/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java +++ b/src/test/java/org/elasticsearch/transport/ContextAndHeaderTransportTests.java @@ -59,7 +59,7 @@ import org.junit.Test; import java.util.*; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.node.Node.HTTP_ENABLED; import static org.elasticsearch.rest.RestStatus.OK; diff --git a/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java b/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java index 94392d6e3a6..0002c5f46ac 100644 --- a/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java +++ b/src/test/java/org/elasticsearch/transport/NettySizeHeaderFrameDecoderTests.java @@ -40,7 +40,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.Socket; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; /** diff --git a/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java b/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java index 2dc29f17ec7..4c04c79ff73 100644 --- a/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java +++ b/src/test/java/org/elasticsearch/transport/local/SimpleLocalTransportTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.transport.local; import org.elasticsearch.Version; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.transport.AbstractSimpleTransportTests; @@ -29,7 +28,7 @@ public class SimpleLocalTransportTests extends AbstractSimpleTransportTests { @Override protected MockTransportService build(Settings settings, Version version) { - MockTransportService transportService = new MockTransportService(ImmutableSettings.EMPTY, new LocalTransport(settings, threadPool, version), threadPool); + MockTransportService transportService = new MockTransportService(Settings.EMPTY, new LocalTransport(settings, threadPool, version), threadPool); transportService.start(); return transportService; } diff --git a/src/test/java/org/elasticsearch/transport/netty/NettyScheduledPingTests.java b/src/test/java/org/elasticsearch/transport/netty/NettyScheduledPingTests.java index 8fe32cfc27e..6b885c21a79 100644 --- a/src/test/java/org/elasticsearch/transport/netty/NettyScheduledPingTests.java +++ b/src/test/java/org/elasticsearch/transport/netty/NettyScheduledPingTests.java @@ -23,7 +23,6 @@ import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.network.NetworkService; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.test.ElasticsearchTestCase; @@ -47,7 +46,7 @@ public class NettyScheduledPingTests extends ElasticsearchTestCase { int startPort = 11000 + randomIntBetween(0, 255); int endPort = startPort + 10; - Settings settings = ImmutableSettings.builder().put(NettyTransport.PING_SCHEDULE, "5ms").put("transport.tcp.port", startPort + "-" + endPort).build(); + Settings settings = Settings.builder().put(NettyTransport.PING_SCHEDULE, "5ms").put("transport.tcp.port", startPort + "-" + endPort).build(); final NettyTransport nettyA = new NettyTransport(settings, threadPool, new NetworkService(settings), BigArrays.NON_RECYCLING_INSTANCE, Version.CURRENT); MockTransportService serviceA = new MockTransportService(settings, nettyA, threadPool); diff --git a/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationTests.java b/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationTests.java index ac54fb70e07..637a65f1df3 100644 --- a/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationTests.java +++ b/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortIntegrationTests.java @@ -32,7 +32,7 @@ import org.junit.Test; import java.util.Locale; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.*; diff --git a/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java b/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java index 62bc8af5966..213500dc4df 100644 --- a/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java +++ b/src/test/java/org/elasticsearch/transport/netty/NettyTransportMultiPortTests.java @@ -44,7 +44,7 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.Matchers.is; public class NettyTransportMultiPortTests extends ElasticsearchTestCase { diff --git a/src/test/java/org/elasticsearch/transport/netty/NettyTransportTests.java b/src/test/java/org/elasticsearch/transport/netty/NettyTransportTests.java index 5edc6b0dfa7..403f2a7a2e0 100644 --- a/src/test/java/org/elasticsearch/transport/netty/NettyTransportTests.java +++ b/src/test/java/org/elasticsearch/transport/netty/NettyTransportTests.java @@ -43,7 +43,7 @@ import org.junit.Test; import java.io.IOException; import java.net.InetSocketAddress; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import static org.hamcrest.Matchers.containsString; diff --git a/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java b/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java index 8b30fd44136..663e928e529 100644 --- a/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java +++ b/src/test/java/org/elasticsearch/transport/netty/SimpleNettyTransportTests.java @@ -23,7 +23,6 @@ import org.apache.lucene.util.LuceneTestCase.Slow; import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.network.NetworkService; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.util.BigArrays; @@ -39,7 +38,7 @@ public class SimpleNettyTransportTests extends AbstractSimpleTransportTests { protected MockTransportService build(Settings settings, Version version) { int startPort = 11000 + randomIntBetween(0, 255); int endPort = startPort + 10; - settings = ImmutableSettings.builder().put(settings).put("transport.tcp.port", startPort + "-" + endPort).build(); + settings = Settings.builder().put(settings).put("transport.tcp.port", startPort + "-" + endPort).build(); MockTransportService transportService = new MockTransportService(settings, new NettyTransport(settings, threadPool, new NetworkService(settings), BigArrays.NON_RECYCLING_INSTANCE, version), threadPool); transportService.start(); return transportService; diff --git a/src/test/java/org/elasticsearch/tribe/TribeTests.java b/src/test/java/org/elasticsearch/tribe/TribeTests.java index 880f88ef4d1..7a0a8f769b9 100644 --- a/src/test/java/org/elasticsearch/tribe/TribeTests.java +++ b/src/test/java/org/elasticsearch/tribe/TribeTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Priority; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.node.Node; @@ -106,13 +105,13 @@ public class TribeTests extends ElasticsearchIntegrationTest { private void setupTribeNode(Settings settings) { ImmutableMap asMap = internalCluster().getDefaultSettings().getAsMap(); - ImmutableSettings.Builder tribe1Defaults = ImmutableSettings.builder(); - ImmutableSettings.Builder tribe2Defaults = ImmutableSettings.builder(); + Settings.Builder tribe1Defaults = Settings.builder(); + Settings.Builder tribe2Defaults = Settings.builder(); for (Map.Entry entry : asMap.entrySet()) { tribe1Defaults.put("tribe.t1." + entry.getKey(), entry.getValue()); tribe2Defaults.put("tribe.t2." + entry.getKey(), entry.getValue()); } - Settings merged = ImmutableSettings.builder() + Settings merged = Settings.builder() .put("tribe.t1.cluster.name", internalCluster().getClusterName()) .put("tribe.t2.cluster.name", cluster2.getClusterName()) .put("tribe.blocks.write", false) @@ -137,7 +136,7 @@ public class TribeTests extends ElasticsearchIntegrationTest { assertAcked(cluster2.client().admin().indices().prepareCreate("test2")); - setupTribeNode(ImmutableSettings.builder() + setupTribeNode(Settings.builder() .put("tribe.blocks.write", true) .put("tribe.blocks.metadata", true) .build()); @@ -176,7 +175,7 @@ public class TribeTests extends ElasticsearchIntegrationTest { assertAcked(cluster2.client().admin().indices().prepareCreate("test2")); assertAcked(cluster2.client().admin().indices().prepareCreate("block_test2")); - setupTribeNode(ImmutableSettings.builder() + setupTribeNode(Settings.builder() .put("tribe.blocks.write.indices", "block_*") .build()); logger.info("wait till tribe has the same nodes as the 2 clusters"); @@ -210,7 +209,7 @@ public class TribeTests extends ElasticsearchIntegrationTest { assertAcked(cluster().client().admin().indices().prepareCreate("test1")); assertAcked(cluster2.client().admin().indices().prepareCreate("test2")); - setupTribeNode(ImmutableSettings.builder() + setupTribeNode(Settings.builder() .put("tribe.on_conflict", "drop") .build()); @@ -240,7 +239,7 @@ public class TribeTests extends ElasticsearchIntegrationTest { assertAcked(internalCluster().client().admin().indices().prepareCreate("test1")); assertAcked(cluster2.client().admin().indices().prepareCreate("test2")); - setupTribeNode(ImmutableSettings.builder() + setupTribeNode(Settings.builder() .put("tribe.on_conflict", "prefer_" + tribe) .build()); logger.info("wait till tribe has the same nodes as the 2 clusters"); @@ -256,7 +255,7 @@ public class TribeTests extends ElasticsearchIntegrationTest { @Test public void testTribeOnOneCluster() throws Exception { - setupTribeNode(ImmutableSettings.EMPTY); + setupTribeNode(Settings.EMPTY); logger.info("create 2 indices, test1 on t1, and test2 on t2"); assertAcked(internalCluster().client().admin().indices().prepareCreate("test1")); assertAcked(cluster2.client().admin().indices().prepareCreate("test2")); @@ -338,7 +337,7 @@ public class TribeTests extends ElasticsearchIntegrationTest { ensureGreen(internalCluster()); assertAcked(internalCluster().client().admin().indices().prepareClose("test1")); - setupTribeNode(ImmutableSettings.EMPTY); + setupTribeNode(Settings.EMPTY); awaitSameNodeCounts(); //the closed index is not part of the tribe node cluster state diff --git a/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java b/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java index 2f1e81eead7..5959ed3a6c4 100644 --- a/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java +++ b/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.tribe; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; @@ -51,14 +50,14 @@ public class TribeUnitTests extends ElasticsearchTestCase { @BeforeClass public static void createTribes() { - Settings baseSettings = ImmutableSettings.builder() + Settings baseSettings = Settings.builder() .put("config.ignore_system_properties", true) .put("http.enabled", false) .put("node.mode", NODE_MODE) .put("path.home", createTempDir()).build(); - tribe1 = NodeBuilder.nodeBuilder().settings(ImmutableSettings.builder().put(baseSettings).put("cluster.name", "tribe1").put("node.name", "tribe1_node")).node(); - tribe2 = NodeBuilder.nodeBuilder().settings(ImmutableSettings.builder().put(baseSettings).put("cluster.name", "tribe2").put("node.name", "tribe2_node")).node(); + tribe1 = NodeBuilder.nodeBuilder().settings(Settings.builder().put(baseSettings).put("cluster.name", "tribe1").put("node.name", "tribe1_node")).node(); + tribe2 = NodeBuilder.nodeBuilder().settings(Settings.builder().put(baseSettings).put("cluster.name", "tribe2").put("node.name", "tribe2_node")).node(); } @AfterClass @@ -76,7 +75,7 @@ public class TribeUnitTests extends ElasticsearchTestCase { System.setProperty("es.tribe.t2.cluster.name", "tribe2"); try { - assertTribeNodeSuccesfullyCreated(ImmutableSettings.EMPTY); + assertTribeNodeSuccesfullyCreated(Settings.EMPTY); } finally { System.clearProperty("es.cluster.name"); System.clearProperty("es.tribe.t1.cluster.name"); @@ -87,14 +86,14 @@ public class TribeUnitTests extends ElasticsearchTestCase { @Test public void testThatTribeClientsIgnoreGlobalConfig() throws Exception { Path pathConf = getDataPath("elasticsearch.yml").getParent(); - Settings settings = ImmutableSettings.builder().put("config.ignore_system_properties", true).put("path.conf", pathConf).build(); + Settings settings = Settings.builder().put("config.ignore_system_properties", true).put("path.conf", pathConf).build(); assertTribeNodeSuccesfullyCreated(settings); } private static void assertTribeNodeSuccesfullyCreated(Settings extraSettings) throws Exception { //tribe node doesn't need the node.mode setting, as it's forced local internally anyways. The tribe clients do need it to make sure //they can find their corresponding tribes using the proper transport - Settings settings = ImmutableSettings.builder().put("http.enabled", false).put("node.name", "tribe_node") + Settings settings = Settings.builder().put("http.enabled", false).put("node.name", "tribe_node") .put("tribe.t1.node.mode", NODE_MODE).put("tribe.t2.node.mode", NODE_MODE) .put("path.home", createTempDir()).put(extraSettings).build(); diff --git a/src/test/java/org/elasticsearch/ttl/SimpleTTLTests.java b/src/test/java/org/elasticsearch/ttl/SimpleTTLTests.java index 70435ea6750..ae6da859e4b 100644 --- a/src/test/java/org/elasticsearch/ttl/SimpleTTLTests.java +++ b/src/test/java/org/elasticsearch/ttl/SimpleTTLTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; @@ -38,7 +37,7 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.ElasticsearchIntegrationTest.*; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; diff --git a/src/test/java/org/elasticsearch/update/UpdateByNativeScriptTests.java b/src/test/java/org/elasticsearch/update/UpdateByNativeScriptTests.java index b58f6342dfa..444e4591a04 100644 --- a/src/test/java/org/elasticsearch/update/UpdateByNativeScriptTests.java +++ b/src/test/java/org/elasticsearch/update/UpdateByNativeScriptTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.update; import com.google.common.collect.Maps; import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.script.*; import org.elasticsearch.test.ElasticsearchIntegrationTest; @@ -41,7 +40,7 @@ public class UpdateByNativeScriptTests extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put("script.native.custom.type", CustomNativeScriptFactory.class.getName()) .build(); diff --git a/src/test/java/org/elasticsearch/update/UpdateTests.java b/src/test/java/org/elasticsearch/update/UpdateTests.java index 8d58a9b763e..78ceb19ff94 100644 --- a/src/test/java/org/elasticsearch/update/UpdateTests.java +++ b/src/test/java/org/elasticsearch/update/UpdateTests.java @@ -30,7 +30,7 @@ import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateRequestBuilder; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.client.transport.NoNodeAvailableException; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.VersionType; @@ -620,7 +620,7 @@ public class UpdateTests extends ElasticsearchIntegrationTest { .startObject("_ttl").field("enabled", true).endObject() .endObject() .endObject()) - .setSettings(ImmutableSettings.builder().put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class))); + .setSettings(Settings.builder().put(MergePolicyModule.MERGE_POLICY_TYPE_KEY, NoMergePolicyProvider.class))); ensureGreen(); final int numberOfThreads = scaledRandomIntBetween(3,5); diff --git a/src/test/java/org/elasticsearch/validate/SimpleValidateQueryTests.java b/src/test/java/org/elasticsearch/validate/SimpleValidateQueryTests.java index 3c006cdfdfb..a00a773ad85 100644 --- a/src/test/java/org/elasticsearch/validate/SimpleValidateQueryTests.java +++ b/src/test/java/org/elasticsearch/validate/SimpleValidateQueryTests.java @@ -24,7 +24,7 @@ import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilder; @@ -121,7 +121,7 @@ public class SimpleValidateQueryTests extends ElasticsearchIntegrationTest { @Test //https://github.com/elasticsearch/elasticsearch/issues/3629 public void explainDateRangeInQueryString() { - assertAcked(prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder() + assertAcked(prepareCreate("test").setSettings(Settings.settingsBuilder() .put(indexSettings()) .put("index.number_of_shards", 1))); @@ -180,7 +180,7 @@ public class SimpleValidateQueryTests extends ElasticsearchIntegrationTest { @Test public void explainMatchPhrasePrefix() { assertAcked(prepareCreate("test").setSettings( - ImmutableSettings.settingsBuilder().put(indexSettings()) + Settings.settingsBuilder().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/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java b/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java index a0395cf98b9..11d49cef827 100644 --- a/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java +++ b/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java @@ -28,7 +28,7 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicReference; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +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; diff --git a/src/test/java/org/elasticsearch/versioning/SimpleVersioningTests.java b/src/test/java/org/elasticsearch/versioning/SimpleVersioningTests.java index 5c9dd5f7b84..afdde7da3d4 100644 --- a/src/test/java/org/elasticsearch/versioning/SimpleVersioningTests.java +++ b/src/test/java/org/elasticsearch/versioning/SimpleVersioningTests.java @@ -27,8 +27,6 @@ import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; -import com.carrotsearch.randomizedtesting.RandomizedTest; -import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.lucene.util.TestUtil; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.bulk.BulkResponse; @@ -37,13 +35,12 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.lucene.uid.Versions; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.VersionType; import org.elasticsearch.index.engine.DocumentAlreadyExistsException; import org.elasticsearch.index.engine.FlushNotAllowedEngineException; import org.elasticsearch.index.engine.VersionConflictEngineException; import org.elasticsearch.test.ElasticsearchIntegrationTest; -import org.elasticsearch.test.store.MockFSDirectoryService; import org.junit.Test; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -753,7 +750,7 @@ public class SimpleVersioningTests extends ElasticsearchIntegrationTest { .admin() .indices() .prepareCreate("test") - .setSettings(ImmutableSettings.settingsBuilder() + .setSettings(Settings.settingsBuilder() .put("index.number_of_shards", 1)) .execute(). actionGet(); diff --git a/src/test/java/org/elasticsearch/watcher/ResourceWatcherServiceTests.java b/src/test/java/org/elasticsearch/watcher/ResourceWatcherServiceTests.java index e6ba5e5373d..501289eadcd 100644 --- a/src/test/java/org/elasticsearch/watcher/ResourceWatcherServiceTests.java +++ b/src/test/java/org/elasticsearch/watcher/ResourceWatcherServiceTests.java @@ -19,14 +19,11 @@ package org.elasticsearch.watcher; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.junit.Test; -import java.util.concurrent.TimeUnit; - import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; import static org.hamcrest.Matchers.*; @@ -40,14 +37,14 @@ public class ResourceWatcherServiceTests extends ElasticsearchTestCase { ThreadPool threadPool = new ThreadPool("test"); // checking the defaults - Settings settings = ImmutableSettings.builder().build(); + Settings settings = Settings.builder().build(); ResourceWatcherService service = new ResourceWatcherService(settings, threadPool); assertThat(service.highMonitor.interval, is(ResourceWatcherService.Frequency.HIGH.interval)); assertThat(service.mediumMonitor.interval, is(ResourceWatcherService.Frequency.MEDIUM.interval)); assertThat(service.lowMonitor.interval, is(ResourceWatcherService.Frequency.LOW.interval)); // checking bwc - settings = ImmutableSettings.builder() + settings = Settings.builder() .put("watcher.interval", "40s") // only applies to medium .build(); service = new ResourceWatcherService(settings, threadPool); @@ -56,7 +53,7 @@ public class ResourceWatcherServiceTests extends ElasticsearchTestCase { assertThat(service.lowMonitor.interval.millis(), is(timeValueSeconds(60).millis())); // checking custom - settings = ImmutableSettings.builder() + settings = Settings.builder() .put("watcher.interval.high", "10s") .put("watcher.interval.medium", "20s") .put("watcher.interval.low", "30s") @@ -72,7 +69,7 @@ public class ResourceWatcherServiceTests extends ElasticsearchTestCase { @Test public void testHandle() throws Exception { ThreadPool threadPool = new ThreadPool("test"); - Settings settings = ImmutableSettings.builder().build(); + Settings settings = Settings.builder().build(); ResourceWatcherService service = new ResourceWatcherService(settings, threadPool); ResourceWatcher watcher = new ResourceWatcher() { @Override