From 7b7411f78d9b18ec3be7e75f2d2a423531db7fea Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 5 Aug 2016 14:58:50 -0400 Subject: [PATCH] Remove mock Netty plugins These mock Netty plugins were needed to assist in setting sun.nio.ch.bugLevel. Yet, settings this property should no longer be needed on JDK 8 and the missing privileged block when writing this property can be fixed upstream. Relates elastic/elasticsearch#3047 Original commit: elastic/x-pack-elasticsearch@e2aa4f6fb521061198d954da80956f0cb6619daa --- .../license/LicenseServiceClusterTests.java | 6 +++--- .../settings/MonitoringSettingsTests.java | 8 ++++---- .../MonitoringSettingsFilterTests.java | 8 ++++---- .../integration/IndexPrivilegeTests.java | 8 ++++---- .../elasticsearch/license/LicensingTests.java | 8 ++++---- .../test/SecuritySettingsSource.java | 6 +++--- .../elasticsearch/xpack/MockNetty3Plugin.java | 17 ---------------- .../elasticsearch/xpack/MockNetty4Plugin.java | 20 ------------------- .../watcher/WatcherPluginDisableTests.java | 6 +++--- .../input/chain/ChainIntegrationTests.java | 8 ++++---- .../input/http/HttpInputIntegrationTests.java | 8 ++++---- .../WatcherSettingsFilterTests.java | 8 ++++---- 12 files changed, 37 insertions(+), 74 deletions(-) delete mode 100644 elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty3Plugin.java delete mode 100644 elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty4Plugin.java diff --git a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java index cce2f827b91..3352ca4b04f 100644 --- a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java +++ b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.env.Environment; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.XPackPlugin; import java.nio.charset.StandardCharsets; @@ -49,7 +49,7 @@ public class LicenseServiceClusterTests extends AbstractLicensesIntegrationTestC @Override protected Collection> nodePlugins() { - return Arrays.asList(XPackPlugin.class, MockNetty3Plugin.class, MockNetty4Plugin.class); + return Arrays.asList(XPackPlugin.class, Netty3Plugin.class, Netty4Plugin.class); } @Override diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/settings/MonitoringSettingsTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/settings/MonitoringSettingsTests.java index f0b390e3405..f2cbfe448be 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/settings/MonitoringSettingsTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/agent/settings/MonitoringSettingsTests.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.monitoring.MonitoringSettings; import org.elasticsearch.xpack.monitoring.agent.AgentService; import org.elasticsearch.xpack.monitoring.test.MonitoringIntegTestCase; @@ -52,8 +52,8 @@ public class MonitoringSettingsTests extends MonitoringIntegTestCase { @Override protected Collection> nodePlugins() { ArrayList> plugins = new ArrayList<>(super.nodePlugins()); - plugins.add(MockNetty3Plugin.class); // for http - plugins.add(MockNetty4Plugin.class); // for http + plugins.add(Netty3Plugin.class); // for http + plugins.add(Netty4Plugin.class); // for http return plugins; } diff --git a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java index d9189c887d1..fdf55898081 100644 --- a/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java +++ b/elasticsearch/x-pack/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/security/MonitoringSettingsFilterTests.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.monitoring.MonitoringSettings; import org.elasticsearch.xpack.monitoring.test.MonitoringIntegTestCase; import org.elasticsearch.xpack.security.authc.support.SecuredString; @@ -49,8 +49,8 @@ public class MonitoringSettingsFilterTests extends MonitoringIntegTestCase { @Override protected Collection> nodePlugins() { ArrayList> plugins = new ArrayList<>(super.nodePlugins()); - plugins.add(MockNetty3Plugin.class); // for http - plugins.add(MockNetty4Plugin.class); // for http + plugins.add(Netty3Plugin.class); // for http + plugins.add(Netty4Plugin.class); // for http return plugins; } diff --git a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java index fe58ed6e7a7..ffd1aa21e20 100644 --- a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java +++ b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.security.authc.support.SecuredString; import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken; import org.junit.Before; @@ -138,8 +138,8 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { @Override protected Collection> nodePlugins() { ArrayList> plugins = new ArrayList<>(super.nodePlugins()); - plugins.add(MockNetty3Plugin.class); // for http - plugins.add(MockNetty4Plugin.class); // for http + plugins.add(Netty3Plugin.class); // for http + plugins.add(Netty4Plugin.class); // for http return plugins; } diff --git a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/license/LicensingTests.java b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/license/LicensingTests.java index d5705142378..87e40475415 100644 --- a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/license/LicensingTests.java +++ b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/license/LicensingTests.java @@ -28,9 +28,9 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.test.SecuritySettingsSource; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Transport; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; import org.elasticsearch.xpack.XPackTransportClient; import org.elasticsearch.xpack.security.Security; import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken; @@ -102,8 +102,8 @@ public class LicensingTests extends SecurityIntegTestCase { @Override protected Collection> nodePlugins() { ArrayList> plugins = new ArrayList<>(super.nodePlugins()); - plugins.add(MockNetty3Plugin.class); // for http - plugins.add(MockNetty4Plugin.class); // for http + plugins.add(Netty3Plugin.class); // for http + plugins.add(Netty4Plugin.class); // for http return plugins; } diff --git a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java index dd2e14056ec..aacfd692d72 100644 --- a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java +++ b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.discovery.DiscoveryModule; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.monitoring.Monitoring; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase.Scope; @@ -162,7 +162,7 @@ public class SecuritySettingsSource extends ClusterDiscoveryConfiguration.Unicas @Override public Collection> nodePlugins() { - return Arrays.asList(xpackPluginClass(), MockNetty3Plugin.class, MockNetty4Plugin.class); + return Arrays.asList(xpackPluginClass(), Netty3Plugin.class, Netty4Plugin.class); } @Override diff --git a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty3Plugin.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty3Plugin.java deleted file mode 100644 index 7c8400e61a3..00000000000 --- a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty3Plugin.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.xpack; - -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.transport.Netty3Plugin; - -public final class MockNetty3Plugin extends Netty3Plugin { - // se Netty3Plugin.... this runs without the permission from the netty3 module so it will fail since reindex can't set the property - // to make it still work we disable that check for pseudo integ tests - public MockNetty3Plugin(Settings settings) { - super(Settings.builder().put(settings).put("netty.assert.buglevel", false).build()); - } -} diff --git a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty4Plugin.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty4Plugin.java deleted file mode 100644 index a1d205dbeb1..00000000000 --- a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/MockNetty4Plugin.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.xpack; - -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.transport.Netty3Plugin; -import org.elasticsearch.transport.Netty4Plugin; - -public final class MockNetty4Plugin extends Netty4Plugin { - - // see Netty4Plugin.... this runs without the permission from the netty4 module so it will fail since reindex can't set the property - // to make it still work we disable that check for pseudo integ tests - public MockNetty4Plugin(Settings settings) { - super(Settings.builder().put(settings).put("netty.assert.buglevel", false).build()); - } - -} diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java index 99373007a6c..818348e7869 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java @@ -11,8 +11,8 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.client.ResponseException; import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.monitoring.Monitoring; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.xpack.security.Security; @@ -52,7 +52,7 @@ public class WatcherPluginDisableTests extends ESIntegTestCase { @Override protected Collection> nodePlugins() { - return Arrays.asList(XPackPlugin.class, MockNetty3Plugin.class, MockNetty4Plugin.class); + return Arrays.asList(XPackPlugin.class, Netty3Plugin.class, Netty4Plugin.class); } @Override diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java index 8cb5a489317..c16d30c3ddf 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.watcher.input.http.HttpInput; import org.elasticsearch.xpack.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; @@ -48,8 +48,8 @@ public class ChainIntegrationTests extends AbstractWatcherIntegrationTestCase { @Override protected Collection> nodePlugins() { ArrayList> plugins = new ArrayList<>(super.nodePlugins()); - plugins.add(MockNetty3Plugin.class); // for http - plugins.add(MockNetty4Plugin.class); // for http + plugins.add(Netty3Plugin.class); // for http + plugins.add(Netty4Plugin.class); // for http return plugins; } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java index 5cf59a96d6c..1200c88c235 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java @@ -12,8 +12,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.junit.annotations.TestLogging; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.watcher.client.WatcherClient; import org.elasticsearch.xpack.watcher.condition.compare.CompareCondition; import org.elasticsearch.xpack.watcher.history.HistoryStore; @@ -55,8 +55,8 @@ public class HttpInputIntegrationTests extends AbstractWatcherIntegrationTestCas @Override protected Collection> nodePlugins() { ArrayList> plugins = new ArrayList<>(super.nodePlugins()); - plugins.add(MockNetty3Plugin.class); // for http - plugins.add(MockNetty4Plugin.class); // for http + plugins.add(Netty3Plugin.class); // for http + plugins.add(Netty4Plugin.class); // for http return plugins; } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatcherSettingsFilterTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatcherSettingsFilterTests.java index d1872b5096d..e6e8927bbb0 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatcherSettingsFilterTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatcherSettingsFilterTests.java @@ -15,8 +15,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.xpack.MockNetty3Plugin; -import org.elasticsearch.xpack.MockNetty4Plugin; +import org.elasticsearch.transport.Netty3Plugin; +import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.monitoring.test.MonitoringIntegTestCase; import org.elasticsearch.xpack.security.authc.support.SecuredString; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; @@ -55,8 +55,8 @@ public class WatcherSettingsFilterTests extends AbstractWatcherIntegrationTestCa @Override protected Collection> nodePlugins() { ArrayList> plugins = new ArrayList<>(super.nodePlugins()); - plugins.add(MockNetty3Plugin.class); // for http - plugins.add(MockNetty4Plugin.class); // for http + plugins.add(Netty3Plugin.class); // for http + plugins.add(Netty4Plugin.class); // for http return plugins; }