From b21494d95db22cc1b16103e4705bee548842b186 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Tue, 26 May 2015 00:36:20 -0400 Subject: [PATCH] FIX: Absorb ImmutableSettings into Settings Original commit: elastic/x-pack-elasticsearch@f0f70f39f1aa4224ae691c5cb05f4940e6e1bfe0 --- .../license/licensor/tools/KeyPairGenerationToolTests.java | 3 +-- .../license/licensor/tools/LicenseGenerationToolTests.java | 3 +-- .../licensor/tools/LicenseVerificationToolTests.java | 3 +-- .../AbstractLicensesConsumerPluginIntegrationTests.java | 3 +-- .../license/plugin/AbstractLicensesIntegrationTests.java | 3 +-- .../plugin/LicensesEagerConsumerPluginIntegrationTests.java | 4 ++-- .../plugin/LicensesLazyConsumerPluginIntegrationTests.java | 4 ++-- .../license/plugin/LicensesPluginIntegrationTests.java | 3 +-- .../license/plugin/LicensesPluginsIntegrationTests.java | 5 ++--- .../license/plugin/LicensesServiceClusterTest.java | 6 ++---- .../license/plugin/LicensesServiceNodeTests.java | 3 +-- 11 files changed, 15 insertions(+), 25 deletions(-) diff --git a/licensor/src/test/java/org/elasticsearch/license/licensor/tools/KeyPairGenerationToolTests.java b/licensor/src/test/java/org/elasticsearch/license/licensor/tools/KeyPairGenerationToolTests.java index 7c4402763b7..3cde35b7014 100644 --- a/licensor/src/test/java/org/elasticsearch/license/licensor/tools/KeyPairGenerationToolTests.java +++ b/licensor/src/test/java/org/elasticsearch/license/licensor/tools/KeyPairGenerationToolTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.license.licensor.tools; import org.elasticsearch.common.cli.CliToolTestCase; import org.elasticsearch.common.cli.commons.MissingOptionException; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.license.licensor.tools.KeyPairGeneratorTool.KeyGenerator; @@ -73,7 +72,7 @@ public class KeyPairGenerationToolTests extends CliToolTestCase { KeyPairGeneratorTool keyPairGeneratorTool = new KeyPairGeneratorTool(); Path publicKeyFilePath = createTempFile().toAbsolutePath(); Path privateKeyFilePath = createTempFile().toAbsolutePath(); - Settings settings = ImmutableSettings.builder().put("path.home", createTempDir()).build(); + Settings settings = Settings.builder().put("path.home", createTempDir()).build(); Files.delete(publicKeyFilePath); Files.delete(privateKeyFilePath); diff --git a/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseGenerationToolTests.java b/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseGenerationToolTests.java index 7e418ad4eb8..b5f2f69cebc 100644 --- a/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseGenerationToolTests.java +++ b/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseGenerationToolTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.license.licensor.tools; import org.elasticsearch.common.cli.CliToolTestCase; import org.elasticsearch.common.cli.commons.MissingOptionException; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.license.core.License; @@ -186,7 +185,7 @@ public class LicenseGenerationToolTests extends CliToolTestCase { private String runLicenseGenerationTool(Path pubKeyPath, Path priKeyPath, Set licenseSpecs, ExitStatus expectedExitStatus) throws Exception { CaptureOutputTerminal outputTerminal = new CaptureOutputTerminal(); - Settings settings = ImmutableSettings.builder().put("path.home", homeDir).build(); + Settings settings = Settings.builder().put("path.home", homeDir).build(); LicenseGenerator licenseGenerator = new LicenseGenerator(outputTerminal, pubKeyPath, priKeyPath, licenseSpecs); assertThat(execute(licenseGenerator, settings), equalTo(expectedExitStatus)); assertThat(outputTerminal.getTerminalOutput().size(), equalTo(1)); diff --git a/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseVerificationToolTests.java b/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseVerificationToolTests.java index 90521d32019..730d6e7c50c 100644 --- a/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseVerificationToolTests.java +++ b/licensor/src/test/java/org/elasticsearch/license/licensor/tools/LicenseVerificationToolTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.license.licensor.tools; import org.elasticsearch.common.cli.CliToolTestCase; import org.elasticsearch.common.cli.commons.MissingOptionException; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.env.Environment; @@ -199,7 +198,7 @@ public class LicenseVerificationToolTests extends CliToolTestCase { private String runLicenseVerificationTool(Set licenses, Path publicKeyPath, ExitStatus expectedExitStatus) throws Exception { CaptureOutputTerminal outputTerminal = new CaptureOutputTerminal(); - Settings settings = ImmutableSettings.builder().put("path.home", homeDir).build(); + Settings settings = Settings.builder().put("path.home", homeDir).build(); LicenseVerifier licenseVerifier = new LicenseVerifier(outputTerminal, licenses, publicKeyPath); assertThat(execute(licenseVerifier, settings), equalTo(expectedExitStatus)); if (expectedExitStatus == ExitStatus.OK) { diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesConsumerPluginIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesConsumerPluginIntegrationTests.java index 1bb04079865..1cf38512d7a 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesConsumerPluginIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesConsumerPluginIntegrationTests.java @@ -6,7 +6,6 @@ package org.elasticsearch.license.plugin; import org.elasticsearch.common.base.Predicate; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.gateway.GatewayService; @@ -40,7 +39,7 @@ public abstract class AbstractLicensesConsumerPluginIntegrationTests extends Abs private final int trialLicenseDurationInSeconds = 10; protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(consumerPlugin.name() + ".trial_license_duration_in_seconds", trialLicenseDurationInSeconds) diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesIntegrationTests.java index 776921a3189..94f90284099 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/AbstractLicensesIntegrationTests.java @@ -15,7 +15,6 @@ import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.joda.DateMathParser; 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.unit.TimeValue; import org.elasticsearch.license.core.License; @@ -66,7 +65,7 @@ public abstract class AbstractLicensesIntegrationTests extends ElasticsearchInte } @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put("plugins.load_classpath_plugins", false) .put("plugin.types", LicensePlugin.class.getName()) .build(); diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesEagerConsumerPluginIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesEagerConsumerPluginIntegrationTests.java index a47ceb6080d..c00a91eea1c 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesEagerConsumerPluginIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesEagerConsumerPluginIntegrationTests.java @@ -5,12 +5,12 @@ */ package org.elasticsearch.license.plugin; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.plugin.consumer.EagerLicenseRegistrationConsumerPlugin; public class LicensesEagerConsumerPluginIntegrationTests extends AbstractLicensesConsumerPluginIntegrationTests { public LicensesEagerConsumerPluginIntegrationTests() { - super(new EagerLicenseRegistrationConsumerPlugin(ImmutableSettings.EMPTY)); + super(new EagerLicenseRegistrationConsumerPlugin(Settings.EMPTY)); } } diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesLazyConsumerPluginIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesLazyConsumerPluginIntegrationTests.java index 8004cdeb440..984763dea0a 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesLazyConsumerPluginIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesLazyConsumerPluginIntegrationTests.java @@ -5,12 +5,12 @@ */ package org.elasticsearch.license.plugin; -import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.plugin.consumer.LazyLicenseRegistrationConsumerPlugin; public class LicensesLazyConsumerPluginIntegrationTests extends AbstractLicensesConsumerPluginIntegrationTests { public LicensesLazyConsumerPluginIntegrationTests() { - super(new LazyLicenseRegistrationConsumerPlugin(ImmutableSettings.EMPTY)); + super(new LazyLicenseRegistrationConsumerPlugin(Settings.EMPTY)); } } diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginIntegrationTests.java index 4cce66fbeb7..5690e5666ea 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginIntegrationTests.java @@ -6,7 +6,6 @@ package org.elasticsearch.license.plugin; import org.elasticsearch.common.base.Predicate; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.gateway.GatewayService; @@ -29,7 +28,7 @@ public class LicensesPluginIntegrationTests extends AbstractLicensesIntegrationT private final int trialLicenseDurationInSeconds = 10; protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(((useEagerLicenseRegistrationPlugin) ? EagerLicenseRegistrationConsumerPlugin.NAME : LazyLicenseRegistrationConsumerPlugin.NAME) + ".trial_license_duration_in_seconds", trialLicenseDurationInSeconds) diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginsIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginsIntegrationTests.java index 2f6d0d15bd3..8a72d56d344 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginsIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesPluginsIntegrationTests.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.license.plugin; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.license.plugin.consumer.EagerLicenseRegistrationConsumerPlugin; @@ -25,14 +24,14 @@ public class LicensesPluginsIntegrationTests extends AbstractLicensesIntegration private final String FEATURE_NAME_2 = LazyLicenseRegistrationPluginService.FEATURE_NAME; protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .putArray("plugin.types", LicensePlugin.class.getName(), EagerLicenseRegistrationConsumerPlugin.class.getName(), LazyLicenseRegistrationConsumerPlugin.class.getName()) .build(); } private Settings nodeSettingsWithConsumerPlugin(int consumer1TrialLicenseDuration, int consumer2TrialLicenseDuration) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(0)) .put(EagerLicenseRegistrationConsumerPlugin.NAME + ".trial_license_duration_in_seconds", consumer1TrialLicenseDuration) .put(LazyLicenseRegistrationConsumerPlugin.NAME + ".trial_license_duration_in_seconds", consumer2TrialLicenseDuration) diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterTest.java b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterTest.java index 5afb2ef4d42..711ec29e255 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterTest.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterTest.java @@ -6,7 +6,6 @@ package org.elasticsearch.license.plugin; import org.elasticsearch.client.ClusterAdminClient; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.license.core.License; @@ -28,7 +27,6 @@ import org.junit.Test; import java.util.ArrayList; import java.util.List; -import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; import static org.elasticsearch.license.plugin.TestUtils.generateSignedLicense; import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.TEST; @@ -49,8 +47,8 @@ public class LicensesServiceClusterTest extends AbstractLicensesIntegrationTests return nodeSettingsBuilder(nodeOrdinal).build(); } - private ImmutableSettings.Builder nodeSettingsBuilder(int nodeOrdinal) { - return settingsBuilder() + private Settings.Builder nodeSettingsBuilder(int nodeOrdinal) { + return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put("gateway.type", "local") .put("plugins.load_classpath_plugins", false) diff --git a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceNodeTests.java b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceNodeTests.java index 485c2237e8d..13c7afa8fcc 100644 --- a/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceNodeTests.java +++ b/plugin/src/test/java/org/elasticsearch/license/plugin/LicensesServiceNodeTests.java @@ -6,7 +6,6 @@ package org.elasticsearch.license.plugin; import org.elasticsearch.common.base.Predicate; -import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.plugin.consumer.EagerLicenseRegistrationConsumerPlugin; import org.elasticsearch.license.plugin.consumer.EagerLicenseRegistrationPluginService; @@ -27,7 +26,7 @@ public class LicensesServiceNodeTests extends AbstractLicensesIntegrationTests { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder() + return Settings.settingsBuilder() .put(super.nodeSettings(nodeOrdinal)) .put(EagerLicenseRegistrationConsumerPlugin.NAME + ".trial_license_duration_in_seconds", 60 * 5) .putArray("plugin.types", LicensePlugin.class.getName(), EagerLicenseRegistrationConsumerPlugin.class.getName())