From 98d776edaf77fca627cd8ae22e583dc2a2a8e551 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 18 Apr 2018 17:36:09 -0700 Subject: [PATCH] Networking: Deprecate http.enabled setting (#29591) This commit deprecates the http.enabled, in preparation for removing the feature in 7.0. relates #12792 --- .../java/org/elasticsearch/common/network/NetworkModule.java | 3 ++- .../org/elasticsearch/common/network/NetworkModuleTests.java | 5 ++++- server/src/test/java/org/elasticsearch/node/NodeTests.java | 4 ++++ .../src/test/java/org/elasticsearch/node/MockNodeTests.java | 3 +++ .../elasticsearch/test/test/InternalTestClusterTests.java | 5 +++++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/common/network/NetworkModule.java b/server/src/main/java/org/elasticsearch/common/network/NetworkModule.java index 2b9cde65d64cc..15332d4317f34 100644 --- a/server/src/main/java/org/elasticsearch/common/network/NetworkModule.java +++ b/server/src/main/java/org/elasticsearch/common/network/NetworkModule.java @@ -71,7 +71,8 @@ public final class NetworkModule { Property.NodeScope); public static final Setting HTTP_DEFAULT_TYPE_SETTING = Setting.simpleString(HTTP_TYPE_DEFAULT_KEY, Property.NodeScope); public static final Setting HTTP_TYPE_SETTING = Setting.simpleString(HTTP_TYPE_KEY, Property.NodeScope); - public static final Setting HTTP_ENABLED = Setting.boolSetting("http.enabled", true, Property.NodeScope); + public static final Setting HTTP_ENABLED = Setting.boolSetting("http.enabled", true, + Property.NodeScope, Property.Deprecated); public static final Setting TRANSPORT_TYPE_SETTING = Setting.simpleString(TRANSPORT_TYPE_KEY, Property.NodeScope); private final Settings settings; diff --git a/server/src/test/java/org/elasticsearch/common/network/NetworkModuleTests.java b/server/src/test/java/org/elasticsearch/common/network/NetworkModuleTests.java index 70deb8a4ba88e..09dc8607bc484 100644 --- a/server/src/test/java/org/elasticsearch/common/network/NetworkModuleTests.java +++ b/server/src/test/java/org/elasticsearch/common/network/NetworkModuleTests.java @@ -24,6 +24,7 @@ import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.ModuleTestCase; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.util.BigArrays; @@ -151,6 +152,7 @@ public Map> getTransports(Settings settings, ThreadP assertSame(custom, module.getTransportSupplier()); assertTrue(module.isTransportClient()); assertFalse(module.isHttpEnabled()); + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } public void testRegisterHttpTransport() { @@ -181,6 +183,7 @@ public Map> getHttpTransports(Settings set assertFalse(newModule.isTransportClient()); assertFalse(newModule.isHttpEnabled()); expectThrows(IllegalStateException.class, () -> newModule.getHttpServerTransportSupplier()); + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } public void testOverrideDefault() { @@ -306,7 +309,7 @@ public List getTransportInterceptors(NamedWriteableRegistr }); }); assertEquals("interceptor must not be null", nullPointerException.getMessage()); - + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } private NetworkModule newNetworkModule(Settings settings, boolean transportClient, NetworkPlugin... plugins) { diff --git a/server/src/test/java/org/elasticsearch/node/NodeTests.java b/server/src/test/java/org/elasticsearch/node/NodeTests.java index f1c8177b5a61c..254823791d5cd 100644 --- a/server/src/test/java/org/elasticsearch/node/NodeTests.java +++ b/server/src/test/java/org/elasticsearch/node/NodeTests.java @@ -25,6 +25,7 @@ import org.elasticsearch.bootstrap.BootstrapContext; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.common.network.NetworkModule; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.env.Environment; @@ -62,6 +63,7 @@ public void testNodeName() throws IOException { assertThat(Node.NODE_NAME_SETTING.get(nodeSettings), equalTo(name)); } } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } public static class CheckPlugin extends Plugin { @@ -93,6 +95,7 @@ protected void validateNodeBeforeAcceptingRequests(BootstrapContext context, Bou expectThrows(NodeValidationException.class, () -> node.start()); assertTrue(executed.get()); } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } public void testWarnIfPreRelease() { @@ -144,6 +147,7 @@ public void testNodeAttributes() throws IOException { } catch (IllegalArgumentException e) { assertEquals("node.attr.test_attr cannot have leading or trailing whitespace [trailing ]", e.getMessage()); } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } private static Settings.Builder baseSettings() { diff --git a/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java b/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java index a217540b89fca..a0cdb8c3168f4 100644 --- a/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java +++ b/test/framework/src/test/java/org/elasticsearch/node/MockNodeTests.java @@ -19,6 +19,8 @@ package org.elasticsearch.node; +import org.elasticsearch.common.network.NetworkModule; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.MockBigArrays; @@ -67,5 +69,6 @@ public void testComponentsMockedByMarkerPlugins() throws IOException { assertSame(searchService.getClass(), SearchService.class); } } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } } diff --git a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java index 05fdfac541a2e..77a66d462795f 100644 --- a/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java +++ b/test/framework/src/test/java/org/elasticsearch/test/test/InternalTestClusterTests.java @@ -19,6 +19,7 @@ */ package org.elasticsearch.test.test; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.core.internal.io.IOUtils; import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.client.Client; @@ -242,6 +243,7 @@ public Settings transportClientSettings() { } finally { IOUtils.close(cluster0, cluster1); } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } public void testDataFolderAssignmentAndCleaning() throws IOException, InterruptedException { @@ -346,6 +348,7 @@ public Settings transportClientSettings() { } finally { cluster.close(); } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } private Path[] getNodePaths(InternalTestCluster cluster, String name) { @@ -446,6 +449,7 @@ public Settings transportClientSettings() { } finally { cluster.close(); } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } public void testTwoNodeCluster() throws Exception { @@ -505,5 +509,6 @@ public Settings onNodeStopped(String nodeName) throws Exception { } finally { cluster.close(); } + assertSettingDeprecationsAndWarnings(new Setting[] { NetworkModule.HTTP_ENABLED }); } }