Absorb ImmutableSettings into Settings

This commit is contained in:
Michael McCandless 2015-05-26 09:40:29 -04:00 committed by mikemccand
parent 75e618d3a2
commit 7efb36da54
3 changed files with 21 additions and 24 deletions

View File

@ -20,7 +20,6 @@
package org.elasticsearch.cloud.gce;
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;
@ -36,7 +35,7 @@ public abstract class AbstractGceTest 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);

View File

@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.cloud.gce.GceComputeService;
import org.elasticsearch.cloud.gce.GceComputeService.Fields;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.gce.mock.*;
import org.elasticsearch.plugins.PluginsService;
@ -60,7 +59,7 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
}
protected Settings settingsBuilder(int nodeOrdinal, Class<? extends GceComputeService> mock, Settings settings) {
ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder()
Settings.Builder builder = Settings.settingsBuilder()
.put("discovery.type", "gce")
.put("cloud.gce.api.impl", mock)
// We need the network to make the mock working
@ -94,10 +93,10 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void nodes_with_different_tags_and_no_tag_set() {
startNode(1,
GceComputeServiceTwoNodesDifferentTagsMock.class,
ImmutableSettings.EMPTY);
Settings.EMPTY);
startNode(2,
GceComputeServiceTwoNodesDifferentTagsMock.class,
ImmutableSettings.EMPTY);
Settings.EMPTY);
// We expect having 2 nodes as part of the cluster, let's test that
checkNumberOfNodes(2);
@ -113,10 +112,10 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void nodes_with_different_tags_and_one_tag_set() {
startNode(1,
GceComputeServiceTwoNodesDifferentTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
Settings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
startNode(2,
GceComputeServiceTwoNodesDifferentTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
Settings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
// We expect having 1 nodes as part of the cluster, let's test that
checkNumberOfNodes(1);
@ -132,10 +131,10 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void nodes_with_different_tags_and_two_tag_set() {
startNode(1,
GceComputeServiceTwoNodesDifferentTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
Settings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
startNode(2,
GceComputeServiceTwoNodesDifferentTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
Settings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
// We expect having 1 nodes as part of the cluster, let's test that
checkNumberOfNodes(1);
@ -145,10 +144,10 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void nodes_with_same_tags_and_no_tag_set() {
startNode(1,
GceComputeServiceTwoNodesSameTagsMock.class,
ImmutableSettings.EMPTY);
Settings.EMPTY);
startNode(2,
GceComputeServiceTwoNodesSameTagsMock.class,
ImmutableSettings.EMPTY);
Settings.EMPTY);
// We expect having 2 nodes as part of the cluster, let's test that
checkNumberOfNodes(2);
@ -158,10 +157,10 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void nodes_with_same_tags_and_one_tag_set() {
startNode(1,
GceComputeServiceTwoNodesSameTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
Settings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
startNode(2,
GceComputeServiceTwoNodesSameTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
Settings.settingsBuilder().put(Fields.TAGS, "elasticsearch").build());
// We expect having 2 nodes as part of the cluster, let's test that
checkNumberOfNodes(2);
@ -171,10 +170,10 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void nodes_with_same_tags_and_two_tags_set() {
startNode(1,
GceComputeServiceTwoNodesSameTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
Settings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
startNode(2,
GceComputeServiceTwoNodesSameTagsMock.class,
ImmutableSettings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
Settings.settingsBuilder().put(Fields.TAGS, Lists.newArrayList("elasticsearch", "dev")).build());
// We expect having 2 nodes as part of the cluster, let's test that
checkNumberOfNodes(2);
@ -184,11 +183,11 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void multiple_zones_and_two_nodes_in_same_zone() {
startNode(1,
GceComputeServiceTwoNodesOneZoneMock.class,
ImmutableSettings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
Settings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
"us-central1-f", "europe-west1-a", "europe-west1-b")).build());
startNode(2,
GceComputeServiceTwoNodesOneZoneMock.class,
ImmutableSettings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
Settings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
"us-central1-f", "europe-west1-a", "europe-west1-b")).build());
// We expect having 2 nodes as part of the cluster, let's test that
@ -199,11 +198,11 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void multiple_zones_and_two_nodes_in_different_zones() {
startNode(1,
GceComputeServiceTwoNodesTwoZonesMock.class,
ImmutableSettings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
Settings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
"us-central1-f", "europe-west1-a", "europe-west1-b")).build());
startNode(2,
GceComputeServiceTwoNodesTwoZonesMock.class,
ImmutableSettings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
Settings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
"us-central1-f", "europe-west1-a", "europe-west1-b")).build());
// We expect having 2 nodes as part of the cluster, let's test that
@ -217,7 +216,7 @@ public class GceComputeEngineTest extends ElasticsearchIntegrationTest {
public void zero_node_43() {
startNode(1,
GceComputeServiceZeroNodeMock.class,
ImmutableSettings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
Settings.settingsBuilder().put(Fields.ZONE, Lists.newArrayList("us-central1-a", "us-central1-b",
"us-central1-f", "europe-west1-a", "europe-west1-b")).build());
}

View File

@ -21,7 +21,6 @@ package org.elasticsearch.gce.itest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.cloud.gce.AbstractGceTest;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.PluginsService;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
@ -43,7 +42,7 @@ public class GceSimpleITest extends AbstractGceTest {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return ImmutableSettings.builder()
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
.build();
@ -62,7 +61,7 @@ public class GceSimpleITest extends AbstractGceTest {
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())
.build();
}
}