Absorb ImmutableSettings into Settings
This commit is contained in:
parent
52bcb1b1a3
commit
0706aeead1
|
@ -21,7 +21,6 @@ package org.elasticsearch.azure.itest;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.cloud.azure.AbstractAzureTest;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
|
@ -41,7 +40,7 @@ public class AzureSimpleITest extends AbstractAzureTest {
|
|||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return ImmutableSettings.builder()
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
// For now we let the user who runs tests to define if he wants or not to run discovery tests
|
||||
// by setting in elasticsearch.yml: discovery.type: azure
|
||||
|
@ -62,7 +61,7 @@ public class AzureSimpleITest extends AbstractAzureTest {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.cloud.azure;
|
||||
|
||||
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;
|
||||
|
@ -39,7 +38,7 @@ public abstract class AbstractAzureTest extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return ImmutableSettings.builder()
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put(PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
|
||||
.put(readSettingsFromFile())
|
||||
|
@ -47,7 +46,7 @@ public abstract class AbstractAzureTest extends ElasticsearchIntegrationTest {
|
|||
}
|
||||
|
||||
protected Settings readSettingsFromFile() {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.builder();
|
||||
Settings.Builder settings = Settings.builder();
|
||||
settings.put("path.home", createTempDir());
|
||||
Environment environment = new Environment(settings.build());
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
|||
import org.elasticsearch.cloud.azure.management.AzureComputeService;
|
||||
import org.elasticsearch.cloud.azure.management.AzureComputeService.Discovery;
|
||||
import org.elasticsearch.cloud.azure.management.AzureComputeService.Management;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
|
@ -39,7 +38,7 @@ public abstract class AbstractAzureComputeServiceTest extends ElasticsearchInteg
|
|||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.builder()
|
||||
Settings.Builder settings = Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put(PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true);
|
||||
return settings.build();
|
||||
|
@ -53,7 +52,7 @@ public abstract class AbstractAzureComputeServiceTest extends ElasticsearchInteg
|
|||
}
|
||||
|
||||
protected Settings settingsBuilder() {
|
||||
ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder builder = Settings.settingsBuilder()
|
||||
.put("discovery.type", "azure")
|
||||
.put(Management.API_IMPLEMENTATION, mock)
|
||||
// We need the network to make the mock working
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.discovery.azure;
|
||||
|
||||
import org.elasticsearch.cloud.azure.management.AzureComputeServiceTwoNodesMock;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.MasterNotDiscoveredException;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
|
@ -47,7 +46,7 @@ public class AzureMinimumMasterNodesTest extends AbstractAzureComputeServiceTest
|
|||
|
||||
@Override
|
||||
protected final Settings settingsBuilder() {
|
||||
ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder builder = Settings.settingsBuilder()
|
||||
.put(super.settingsBuilder())
|
||||
.put("discovery.zen.minimum_master_nodes", 2)
|
||||
// Make the test run faster
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.discovery.azure;
|
|||
import org.elasticsearch.cloud.azure.management.AzureComputeService.Discovery;
|
||||
import org.elasticsearch.cloud.azure.management.AzureComputeService.Management;
|
||||
import org.elasticsearch.cloud.azure.management.AzureComputeServiceSimpleMock;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class AzureSimpleTest extends AbstractAzureComputeServiceTest {
|
|||
|
||||
@Test
|
||||
public void one_node_should_run_using_private_ip() {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder settings = Settings.settingsBuilder()
|
||||
.put(Management.SERVICE_NAME, "dummy")
|
||||
.put(Discovery.HOST_TYPE, "private_ip")
|
||||
.put(super.settingsBuilder());
|
||||
|
@ -55,7 +55,7 @@ public class AzureSimpleTest extends AbstractAzureComputeServiceTest {
|
|||
|
||||
@Test
|
||||
public void one_node_should_run_using_public_ip() {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder settings = Settings.settingsBuilder()
|
||||
.put(Management.SERVICE_NAME, "dummy")
|
||||
.put(Discovery.HOST_TYPE, "public_ip")
|
||||
.put(super.settingsBuilder());
|
||||
|
@ -70,7 +70,7 @@ public class AzureSimpleTest extends AbstractAzureComputeServiceTest {
|
|||
|
||||
@Test
|
||||
public void one_node_should_run_using_wrong_settings() {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder settings = Settings.settingsBuilder()
|
||||
.put(Management.SERVICE_NAME, "dummy")
|
||||
.put(Discovery.HOST_TYPE, "do_not_exist")
|
||||
.put(super.settingsBuilder());
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.discovery.azure;
|
|||
import org.elasticsearch.cloud.azure.management.AzureComputeService.Discovery;
|
||||
import org.elasticsearch.cloud.azure.management.AzureComputeService.Management;
|
||||
import org.elasticsearch.cloud.azure.management.AzureComputeServiceTwoNodesMock;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class AzureTwoStartedNodesTest extends AbstractAzureComputeServiceTest {
|
|||
|
||||
@Test
|
||||
public void two_nodes_should_run_using_private_ip() {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder settings = Settings.settingsBuilder()
|
||||
.put(Management.SERVICE_NAME, "dummy")
|
||||
.put(Discovery.HOST_TYPE, "private_ip")
|
||||
.put(super.settingsBuilder());
|
||||
|
@ -59,7 +59,7 @@ public class AzureTwoStartedNodesTest extends AbstractAzureComputeServiceTest {
|
|||
|
||||
@Test
|
||||
public void two_nodes_should_run_using_public_ip() {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder settings = Settings.settingsBuilder()
|
||||
.put(Management.SERVICE_NAME, "dummy")
|
||||
.put(Discovery.HOST_TYPE, "public_ip")
|
||||
.put(super.settingsBuilder());
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.index.store;
|
||||
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
|
||||
|
@ -27,7 +26,7 @@ public class SmbMMapFsTest extends AbstractAzureFsTest {
|
|||
|
||||
@Override
|
||||
public Settings indexSettings() {
|
||||
return ImmutableSettings.builder()
|
||||
return Settings.builder()
|
||||
.put(super.indexSettings())
|
||||
.put("index.store.type", "smb_mmap_fs")
|
||||
.build();
|
||||
|
|
|
@ -19,14 +19,13 @@
|
|||
|
||||
package org.elasticsearch.index.store;
|
||||
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
|
||||
public class SmbSimpleFsTest extends AbstractAzureFsTest {
|
||||
@Override
|
||||
public Settings indexSettings() {
|
||||
return ImmutableSettings.builder()
|
||||
return Settings.builder()
|
||||
.put(super.indexSettings())
|
||||
.put("index.store.type", "smb_simple_fs")
|
||||
.build();
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.cloud.azure.AbstractAzureTest;
|
|||
import org.elasticsearch.cloud.azure.storage.AzureStorageService;
|
||||
import org.elasticsearch.cloud.azure.storage.AzureStorageService.Storage;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.repositories.RepositoryMissingException;
|
||||
|
@ -65,7 +64,7 @@ public abstract class AbstractAzureRepositoryServiceTest extends AbstractAzureTe
|
|||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder()
|
||||
Settings.Builder builder = Settings.settingsBuilder()
|
||||
.put(PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
|
||||
.put(Storage.API_IMPLEMENTATION, mock)
|
||||
.put(Storage.CONTAINER, "snapshots");
|
||||
|
@ -81,7 +80,7 @@ public abstract class AbstractAzureRepositoryServiceTest extends AbstractAzureTe
|
|||
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(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.cloud.azure.storage.AzureStorageServiceImpl;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.base.Predicate;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.repositories.RepositoryMissingException;
|
||||
import org.elasticsearch.repositories.RepositoryVerificationException;
|
||||
|
@ -75,7 +74,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return ImmutableSettings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
// In snapshot tests, we explicitly disable cloud discovery
|
||||
.put("discovery.type", "local")
|
||||
.build();
|
||||
|
@ -85,7 +84,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
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)
|
||||
.build();
|
||||
|
@ -105,7 +104,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
Client client = client();
|
||||
logger.info("--> creating azure repository with path [{}]", getRepositoryPath());
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("azure").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setType("azure").setSettings(Settings.settingsBuilder()
|
||||
.put(Storage.CONTAINER, getContainerName())
|
||||
.put(Storage.BASE_PATH, getRepositoryPath())
|
||||
.put(Storage.CHUNK_SIZE, randomIntBetween(1000, 10000))
|
||||
|
@ -178,14 +177,14 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
Client client = client();
|
||||
logger.info("--> creating azure repository with path [{}]", getRepositoryPath());
|
||||
PutRepositoryResponse putRepositoryResponse1 = client.admin().cluster().preparePutRepository("test-repo1")
|
||||
.setType("azure").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setType("azure").setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, getContainerName().concat("-1"))
|
||||
.put(Repository.BASE_PATH, getRepositoryPath())
|
||||
.put(Repository.CHUNK_SIZE, randomIntBetween(1000, 10000))
|
||||
).get();
|
||||
assertThat(putRepositoryResponse1.isAcknowledged(), equalTo(true));
|
||||
PutRepositoryResponse putRepositoryResponse2 = client.admin().cluster().preparePutRepository("test-repo2")
|
||||
.setType("azure").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setType("azure").setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, getContainerName().concat("-2"))
|
||||
.put(Repository.BASE_PATH, getRepositoryPath())
|
||||
.put(Repository.CHUNK_SIZE, randomIntBetween(1000, 10000))
|
||||
|
@ -258,7 +257,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
ClusterAdminClient client = client().admin().cluster();
|
||||
logger.info("--> creating azure repository without any path");
|
||||
PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure")
|
||||
.setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, getContainerName())
|
||||
).get();
|
||||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
|
@ -279,7 +278,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
|
||||
logger.info("--> creating azure repository path [{}]", getRepositoryPath());
|
||||
putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure")
|
||||
.setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, getContainerName())
|
||||
.put(Repository.BASE_PATH, getRepositoryPath())
|
||||
).get();
|
||||
|
@ -306,7 +305,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
ClusterAdminClient client = client().admin().cluster();
|
||||
logger.info("--> creating azure repository without any path");
|
||||
PutRepositoryResponse putRepositoryResponse = client.preparePutRepository("test-repo").setType("azure")
|
||||
.setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, getContainerName())
|
||||
).get();
|
||||
assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
|
||||
|
@ -356,7 +355,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
public boolean apply(Object obj) {
|
||||
try {
|
||||
PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("azure").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setType("azure").setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, container)
|
||||
.put(Repository.BASE_PATH, getRepositoryPath())
|
||||
.put(Repository.CHUNK_SIZE, randomIntBetween(1000, 10000))
|
||||
|
@ -388,7 +387,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
Client client = client();
|
||||
logger.info("--> creating azure repository with path [{}]", getRepositoryPath());
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("azure").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setType("azure").setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, getContainerName())
|
||||
.put(Repository.BASE_PATH, getRepositoryPath())
|
||||
.put(Repository.CHUNK_SIZE, randomIntBetween(1000, 10000))
|
||||
|
@ -436,7 +435,7 @@ public class AzureSnapshotRestoreITest extends AbstractAzureTest {
|
|||
logger.info("--> creating azure repository while container is being removed");
|
||||
try {
|
||||
client.preparePutRepository("test-repo").setType("azure")
|
||||
.setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setSettings(Settings.settingsBuilder()
|
||||
.put(Repository.CONTAINER, container)
|
||||
).get();
|
||||
fail("we should get a RepositoryVerificationException");
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotR
|
|||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cloud.azure.storage.AzureStorageServiceMock;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.snapshots.SnapshotState;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
@ -50,7 +50,7 @@ public class AzureSnapshotRestoreTest extends AbstractAzureRepositoryServiceTest
|
|||
Client client = client();
|
||||
logger.info("--> creating azure repository with path [{}]", basePath);
|
||||
PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
|
||||
.setType("azure").setSettings(ImmutableSettings.settingsBuilder()
|
||||
.setType("azure").setSettings(Settings.settingsBuilder()
|
||||
.put("base_path", basePath)
|
||||
.put("chunk_size", randomIntBetween(1000, 10000))
|
||||
).get();
|
||||
|
|
Loading…
Reference in New Issue