From 7cb7f85709812bb7cd6b0c1b26d5622ef382ea7d Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 15 Jun 2016 17:11:34 -0700 Subject: [PATCH] Remove name() and description() from plugin api This is the xplugins side of elastic/elasticsearchelastic/elasticsearch#18906 Original commit: elastic/x-pack-elasticsearch@b47422fe91b0a260a3dba9e429c3ba559e273bf3 --- .../org/elasticsearch/xpack/graph/Graph.java | 10 ---------- .../xpack/graph/test/GraphTests.java | 9 --------- ...EagerLicenseRegistrationConsumerPlugin.java | 5 ----- .../LazyLicenseRegistrationConsumerPlugin.java | 7 ------- .../consumer/TestConsumerPluginBase.java | 13 ------------- .../marvel/MarvelPluginTests.java | 2 +- .../shield/transport/TransportFilterTests.java | 18 ------------------ .../test/ShieldIntegTestCase.java | 3 ++- .../org/elasticsearch/xpack/XPackPlugin.java | 8 -------- .../script/MockMustacheScriptEngine.java | 5 ----- .../script/SleepScriptEngine.java | 13 ------------- .../actions/ActionErrorIntegrationTests.java | 13 ------------- .../WatcherIndexTemplateRegistryTests.java | 8 -------- 13 files changed, 3 insertions(+), 111 deletions(-) diff --git a/elasticsearch/x-pack/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java b/elasticsearch/x-pack/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java index 9c435dba74f..33f2e6851d6 100644 --- a/elasticsearch/x-pack/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java +++ b/elasticsearch/x-pack/graph/src/main/java/org/elasticsearch/xpack/graph/Graph.java @@ -31,16 +31,6 @@ public class Graph extends Plugin { public Graph(Settings settings) { this.transportClientMode = XPackPlugin.transportClientMode(settings); enabled = enabled(settings); - } - - @Override - public String name() { - return NAME; - } - - @Override - public String description() { - return "Elasticsearch Graph Plugin"; } public static boolean enabled(Settings settings) { diff --git a/elasticsearch/x-pack/graph/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java b/elasticsearch/x-pack/graph/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java index 9fe576c8dc5..847784d4e4f 100644 --- a/elasticsearch/x-pack/graph/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java +++ b/elasticsearch/x-pack/graph/src/test/java/org/elasticsearch/xpack/graph/test/GraphTests.java @@ -347,15 +347,6 @@ public class GraphTests extends ESSingleNodeTestCase { } public static class ScriptedTimeoutPlugin extends Plugin { - @Override - public String name() { - return "test-scripted-graph-timeout"; - } - - @Override - public String description() { - return "Test for scripted timeouts on graph searches"; - } public void onModule(ScriptModule module) { module.registerScript(NativeTestScriptedTimeout.TEST_NATIVE_SCRIPT_TIMEOUT, NativeTestScriptedTimeout.Factory.class); diff --git a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/EagerLicenseRegistrationConsumerPlugin.java b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/EagerLicenseRegistrationConsumerPlugin.java index bd003f279bf..ed07814b408 100644 --- a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/EagerLicenseRegistrationConsumerPlugin.java +++ b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/EagerLicenseRegistrationConsumerPlugin.java @@ -28,11 +28,6 @@ public class EagerLicenseRegistrationConsumerPlugin extends TestConsumerPluginBa return EagerLicenseRegistrationPluginService.class; } - @Override - protected String pluginName() { - return NAME; - } - @Override public String id() { return EagerLicenseRegistrationPluginService.ID; diff --git a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/LazyLicenseRegistrationConsumerPlugin.java b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/LazyLicenseRegistrationConsumerPlugin.java index f8902f0da40..78bc7fb4ad7 100644 --- a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/LazyLicenseRegistrationConsumerPlugin.java +++ b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/LazyLicenseRegistrationConsumerPlugin.java @@ -16,8 +16,6 @@ import org.elasticsearch.common.settings.Settings; */ public class LazyLicenseRegistrationConsumerPlugin extends TestConsumerPluginBase { - public static String NAME = "test_consumer_plugin_2"; - @Inject public LazyLicenseRegistrationConsumerPlugin(Settings settings) { super(settings); @@ -28,11 +26,6 @@ public class LazyLicenseRegistrationConsumerPlugin extends TestConsumerPluginBas return LazyLicenseRegistrationPluginService.class; } - @Override - protected String pluginName() { - return NAME; - } - @Override public String id() { return LazyLicenseRegistrationPluginService.ID; diff --git a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/TestConsumerPluginBase.java b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/TestConsumerPluginBase.java index 46c50b0375c..7403c63dc45 100644 --- a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/TestConsumerPluginBase.java +++ b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/consumer/TestConsumerPluginBase.java @@ -24,17 +24,6 @@ public abstract class TestConsumerPluginBase extends Plugin { this.isEnabled = TransportClient.CLIENT_TYPE.equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey())) == false; } - @Override - public String name() { - return pluginName(); - } - - @Override - public String description() { - return "test licensing consumer plugin"; - } - - @Override public Collection> nodeServices() { Collection> services = new ArrayList<>(); @@ -55,7 +44,5 @@ public abstract class TestConsumerPluginBase extends Plugin { public abstract Class service(); - protected abstract String pluginName(); - public abstract String id(); } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java index 9e7d39fd542..1353e703af5 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/MarvelPluginTests.java @@ -79,7 +79,7 @@ public class MarvelPluginTests extends MarvelIntegTestCase { for (PluginInfo plugin : nodeInfo.getPlugins().getPluginInfos()) { assertNotNull(plugin); - if (XPackPlugin.NAME.equals(plugin.getName())) { + if (XPackPlugin.class.getName().equals(plugin.getName())) { found = true; break; } diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java index f46f7ab8c41..06f6912c6d7 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java @@ -116,16 +116,6 @@ public class TransportFilterTests extends ESIntegTestCase { } public static class InternalPlugin extends Plugin { - @Override - public String name() { - return "test-transport-filter"; - } - - @Override - public String description() { - return ""; - } - @Override public Collection nodeModules() { return Collections.singletonList(new TestTransportFilterModule()); @@ -289,14 +279,6 @@ public class TransportFilterTests extends ESIntegTestCase { // Sub class the Shield transport to always inject a mock for testing public static class InternalPluginServerTransportService extends ShieldServerTransportService { public static class TestPlugin extends Plugin { - @Override - public String name() { - return "mock-transport-service"; - } - @Override - public String description() { - return "a mock transport service for testing"; - } public void onModule(NetworkModule module) { module.registerTransportService("filter-mock", InternalPluginServerTransportService.class); } diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldIntegTestCase.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldIntegTestCase.java index c1a09ae3833..97dac80defc 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldIntegTestCase.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/test/ShieldIntegTestCase.java @@ -151,7 +151,8 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase { // assertThat(nodeInfo.getPlugins().getInfos(), hasSize(2)); Collection pluginNames = nodeInfo.getPlugins().getPluginInfos().stream().map(p -> p.getName()).collect(Collectors.toList()); - assertThat("plugin [" + XPackPlugin.NAME + "] not found in [" + pluginNames + "]", pluginNames, hasItem(XPackPlugin.NAME)); + assertThat("plugin [" + xpackPluginClass().getName() + "] not found in [" + pluginNames + "]", pluginNames, + hasItem(xpackPluginClass().getName())); } } diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java index 456f8db3598..64cb55fdd7f 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java @@ -124,14 +124,6 @@ public class XPackPlugin extends Plugin { } } - @Override public String name() { - return NAME; - } - - @Override public String description() { - return "Elastic X-Pack"; - } - // For tests only public Collection> getExtensions() { return Collections.emptyList(); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java index 6430fde4a16..a56e0168fd9 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java @@ -22,11 +22,6 @@ public class MockMustacheScriptEngine extends MockScriptEngine { public static class TestPlugin extends MockScriptEngine.TestPlugin { - @Override - public String name() { - return NAME; - } - public void onModule(ScriptModule module) { module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(MockMustacheScriptEngine.class, NAME, true)); } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java index c0cf787d7e8..415c655fa09 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/SleepScriptEngine.java @@ -23,19 +23,6 @@ public class SleepScriptEngine implements ScriptEngineService { public static class TestPlugin extends Plugin { - public TestPlugin() { - } - - @Override - public String name() { - return NAME; - } - - @Override - public String description() { - return "Mock script engine for integration tests"; - } - public void onModule(ScriptModule module) { module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(SleepScriptEngine.class, SleepScriptEngine.NAME, true)); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java index d62df74f188..920a717801a 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java @@ -112,19 +112,6 @@ public class ActionErrorIntegrationTests extends AbstractWatcherIntegrationTestC public static class ErrorActionPlugin extends Plugin { - public ErrorActionPlugin() { - } - - @Override - public String name() { - return "error-action"; - } - - @Override - public String description() { - return name(); - } - public void onModule(WatcherActionModule module) { module.registerAction(ErrorAction.TYPE, ErrorAction.Factory.class); } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java index 41d7cbc29ff..47d7301015a 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java @@ -74,14 +74,6 @@ public class WatcherIndexTemplateRegistryTests extends AbstractWatcherIntegratio } public static class SettingTestPlugin extends Plugin { - public String name() { - return "watcher-index-template-registry-settings-plugin"; - } - - @Override - public String description() { - return "installs a setting this test needs"; - } public static final Setting KEY_1 = new Setting<>("index.key1", "", Function.identity(), Setting.Property.IndexScope);