From 7aada44da32b026589e1ec4317aaa3300dcb1aef Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Tue, 26 May 2015 09:36:17 -0400 Subject: [PATCH] Absorb ImmutableSettings into Settings --- .../cloud/aws/AbstractAwsTest.java | 3 +-- .../discovery/ec2/Ec2DiscoveryITest.java | 2 +- .../ec2/Ec2DiscoveryUpdateSettingsITest.java | 2 +- .../s3/AbstractS3SnapshotRestoreTest.java | 21 +++++++++---------- .../s3/S3SnapshotRestoreOverHttpTest.java | 3 +-- .../s3/S3SnapshotRestoreOverHttpsTest.java | 3 +-- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java b/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java index 084fd25524d..974bc96a900 100644 --- a/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java +++ b/src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java @@ -22,7 +22,6 @@ package org.elasticsearch.cloud.aws; import com.carrotsearch.randomizedtesting.annotations.TestGroup; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.FailedToResolveConfigException; @@ -79,7 +78,7 @@ public abstract class AbstractAwsTest extends ElasticsearchIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - ImmutableSettings.Builder settings = ImmutableSettings.builder() + Settings.Builder settings = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("path.home", createTempDir()) .put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true) diff --git a/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryITest.java b/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryITest.java index d656d6485f6..f1c44063500 100644 --- a/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryITest.java +++ b/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryITest.java @@ -27,7 +27,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * Just an empty Node Start test to check eveything if fine when diff --git a/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsITest.java b/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsITest.java index f3038b6f017..6d74bcbaf92 100644 --- a/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsITest.java +++ b/src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsITest.java @@ -28,7 +28,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope; import org.junit.Test; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; +import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.hamcrest.CoreMatchers.is; /** diff --git a/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java b/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java index 2a79a907309..af8cfb11780 100644 --- a/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java +++ b/src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java @@ -32,7 +32,6 @@ import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.cloud.aws.AbstractAwsTest; import org.elasticsearch.cloud.aws.AwsS3Service; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.PluginsService; import org.elasticsearch.repositories.RepositoryMissingException; @@ -60,7 +59,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { public Settings indexSettings() { // During restore we frequently restore index to exactly the same state it was before, that might cause the same // checksum file to be written twice during restore operation - return ImmutableSettings.builder().put(super.indexSettings()) + return Settings.builder().put(super.indexSettings()) .put(MockFSDirectoryService.RANDOM_PREVENT_DOUBLE_WRITE, false) .put(MockFSDirectoryService.RANDOM_NO_DELETE_OPEN_FILE, false) .put("cloud.enabled", true) @@ -88,7 +87,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Client client = client(); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", internalCluster().getInstance(Settings.class).get("repositories.s3.bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) .put("chunk_size", randomIntBetween(1000, 10000)) ).get(); @@ -160,7 +159,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Client client = client(); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", internalCluster().getInstance(Settings.class).get("repositories.s3.bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) .put("chunk_size", randomIntBetween(1000, 10000)) .put("server_side_encryption", true) @@ -254,7 +253,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.private-bucket."); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) .put("bucket", bucketSettings.get("bucket")) ).get(); @@ -267,7 +266,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.private-bucket."); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) .put("region", bucketSettings.get("region")) .put("access_key", bucketSettings.get("access_key")) @@ -285,7 +284,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.external-bucket."); logger.info("--> creating s3 repostoriy with endpoint [{}], bucket[{}] and path [{}]", bucketSettings.get("endpoint"), bucketSettings.get("bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("bucket", bucketSettings.get("bucket")) .put("endpoint", bucketSettings.get("endpoint")) .put("access_key", bucketSettings.get("access_key")) @@ -306,7 +305,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.remote-bucket."); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) .put("bucket", bucketSettings.get("bucket")) // Below setting intentionally omitted to assert bucket is not available in default region. @@ -323,7 +322,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Settings bucketSettings = settings.getByPrefix("repositories.s3.remote-bucket."); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) .put("bucket", bucketSettings.get("bucket")) .put("region", bucketSettings.get("region")) @@ -341,7 +340,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { Client client = client(); logger.info("--> creating s3 repository with bucket[{}] and path [{}]", internalCluster().getInstance(Settings.class).get("repositories.s3.bucket"), basePath); PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -363,7 +362,7 @@ abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest { ClusterAdminClient client = client().admin().cluster(); logger.info("--> creating s3 repository without any path"); PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo") - .setType("s3").setSettings(ImmutableSettings.settingsBuilder() + .setType("s3").setSettings(Settings.settingsBuilder() .put("base_path", basePath) ).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); diff --git a/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpTest.java b/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpTest.java index e674fa0eb5b..045d18a6709 100644 --- a/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpTest.java +++ b/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpTest.java @@ -19,7 +19,6 @@ package org.elasticsearch.repositories.s3; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; /** @@ -27,7 +26,7 @@ import org.elasticsearch.common.settings.Settings; public class S3SnapshotRestoreOverHttpTest extends AbstractS3SnapshotRestoreTest { @Override public Settings nodeSettings(int nodeOrdinal) { - ImmutableSettings.Builder settings = ImmutableSettings.builder() + Settings.Builder settings = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("cloud.aws.s3.protocol", "http"); return settings.build(); diff --git a/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpsTest.java b/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpsTest.java index 1f1236d2641..ca098cbaec3 100644 --- a/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpsTest.java +++ b/src/test/java/org/elasticsearch/repositories/s3/S3SnapshotRestoreOverHttpsTest.java @@ -19,7 +19,6 @@ package org.elasticsearch.repositories.s3; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; /** @@ -27,7 +26,7 @@ import org.elasticsearch.common.settings.Settings; public class S3SnapshotRestoreOverHttpsTest extends AbstractS3SnapshotRestoreTest { @Override public Settings nodeSettings(int nodeOrdinal) { - ImmutableSettings.Builder settings = ImmutableSettings.builder() + Settings.Builder settings = Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("cloud.aws.s3.protocol", "https"); return settings.build();