diff --git a/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java b/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java index 7149184f2e1..8847f0759e1 100644 --- a/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java +++ b/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java @@ -27,6 +27,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.env.FailedToResolveConfigException; +import java.util.Map; + import static org.elasticsearch.common.Strings.cleanPath; import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder; @@ -97,6 +99,16 @@ public class InternalSettingsPreparer { } settingsBuilder.replacePropertyPlaceholders(); + // allow to force set properties based on configuration of the settings provided + for (Map.Entry entry : pSettings.getAsMap().entrySet()) { + String setting = entry.getKey(); + if (setting.startsWith("force.")) { + settingsBuilder.remove(setting); + settingsBuilder.put(setting.substring(".force".length()), entry.getValue()); + } + } + settingsBuilder.replacePropertyPlaceholders(); + // generate the name if (settingsBuilder.get("name") == null) { String name = System.getProperty("name"); diff --git a/src/test/java/org/elasticsearch/plugin/PluginManagerTests.java b/src/test/java/org/elasticsearch/plugin/PluginManagerTests.java index 8a525918ba2..e8969119a53 100644 --- a/src/test/java/org/elasticsearch/plugin/PluginManagerTests.java +++ b/src/test/java/org/elasticsearch/plugin/PluginManagerTests.java @@ -45,10 +45,12 @@ import java.net.URL; import static org.hamcrest.CoreMatchers.*; -@ClusterScope(scope=Scope.TEST, numNodes=0) +@ClusterScope(scope = Scope.TEST, numNodes = 0) public class PluginManagerTests extends AbstractIntegrationTest { private static final Settings SETTINGS = ImmutableSettings.settingsBuilder() - .put("discovery.zen.ping.multicast.enabled", false).build(); + .put("discovery.zen.ping.multicast.enabled", false) + .put("force.http.enabled", true) + .build(); private static final String PLUGIN_DIR = "plugins"; @After @@ -211,7 +213,8 @@ public class PluginManagerTests extends AbstractIntegrationTest { * We are ignoring by default these tests as they require to have an internet access * To activate the test, use -Dtests.network=true */ - @Test @Network + @Test + @Network public void testInstallPluginWithInternet() throws IOException { // We test regular form: username/reponame/version // It should find it in download.elasticsearch.org service diff --git a/src/test/java/org/elasticsearch/plugin/ResponseHeaderPluginTests.java b/src/test/java/org/elasticsearch/plugin/ResponseHeaderPluginTests.java index 565426266dd..89f77f944a4 100644 --- a/src/test/java/org/elasticsearch/plugin/ResponseHeaderPluginTests.java +++ b/src/test/java/org/elasticsearch/plugin/ResponseHeaderPluginTests.java @@ -39,12 +39,16 @@ import static org.hamcrest.Matchers.equalTo; /** * Test a rest action that sets special response headers */ -@ClusterScope(scope=Scope.SUITE, numNodes=1) +@ClusterScope(scope = Scope.SUITE, numNodes = 1) public class ResponseHeaderPluginTests extends AbstractIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { - return ImmutableSettings.settingsBuilder().put("plugin.types", TestResponseHeaderPlugin.class.getName()).put(super.nodeSettings(nodeOrdinal)).build(); + return ImmutableSettings.settingsBuilder() + .put("plugin.types", TestResponseHeaderPlugin.class.getName()) + .put("force.http.enabled", true) + .put(super.nodeSettings(nodeOrdinal)) + .build(); } @Test diff --git a/src/test/java/org/elasticsearch/plugin/SitePluginTests.java b/src/test/java/org/elasticsearch/plugin/SitePluginTests.java index 0f4b0162c31..d7f02841039 100644 --- a/src/test/java/org/elasticsearch/plugin/SitePluginTests.java +++ b/src/test/java/org/elasticsearch/plugin/SitePluginTests.java @@ -39,18 +39,19 @@ import static org.hamcrest.Matchers.equalTo; /** * We want to test site plugins */ -@ClusterScope(scope=Scope.SUITE, numNodes=1) +@ClusterScope(scope = Scope.SUITE, numNodes = 1) public class SitePluginTests extends AbstractIntegrationTest { @Override protected Settings nodeSettings(int nodeOrdinal) { try { - File pluginDir = new File(SitePluginTests.class.getResource("/org/elasticsearch/plugin").toURI()); - return settingsBuilder() - .put(super.nodeSettings(nodeOrdinal)) - .put("path.plugins", pluginDir.getAbsolutePath()) - .build(); + File pluginDir = new File(SitePluginTests.class.getResource("/org/elasticsearch/plugin").toURI()); + return settingsBuilder() + .put(super.nodeSettings(nodeOrdinal)) + .put("path.plugins", pluginDir.getAbsolutePath()) + .put("force.http.enabled", true) + .build(); } catch (URISyntaxException ex) { throw new RuntimeException(ex); }