FIX: Absorb ImmutableSettings into Settings

Original commit: elastic/x-pack-elasticsearch@f0f70f39f1
This commit is contained in:
Areek Zillur 2015-05-26 00:36:20 -04:00
parent 6e557b82da
commit b21494d95d
11 changed files with 15 additions and 25 deletions

View File

@ -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);

View File

@ -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<License> 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));

View File

@ -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<License> 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) {

View File

@ -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)

View File

@ -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();

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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())