Remove name() and description() from plugin api

This is the xplugins side of elastic/elasticsearchelastic/elasticsearch#18906

Original commit: elastic/x-pack-elasticsearch@b47422fe91
This commit is contained in:
Ryan Ernst 2016-06-15 17:11:34 -07:00
parent f92314ba00
commit 7cb7f85709
13 changed files with 3 additions and 111 deletions

View File

@ -33,16 +33,6 @@ public class Graph extends Plugin {
enabled = enabled(settings);
}
@Override
public String name() {
return NAME;
}
@Override
public String description() {
return "Elasticsearch Graph Plugin";
}
public static boolean enabled(Settings settings) {
return XPackPlugin.featureEnabled(settings, NAME, true);
}

View File

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

View File

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

View File

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

View File

@ -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<Class<? extends LifecycleComponent>> nodeServices() {
Collection<Class<? extends LifecycleComponent>> services = new ArrayList<>();
@ -55,7 +44,5 @@ public abstract class TestConsumerPluginBase extends Plugin {
public abstract Class<? extends TestPluginServiceBase> service();
protected abstract String pluginName();
public abstract String id();
}

View File

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

View File

@ -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<Module> nodeModules() {
return Collections.<Module>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);
}

View File

@ -151,7 +151,8 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase {
// assertThat(nodeInfo.getPlugins().getInfos(), hasSize(2));
Collection<String> 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()));
}
}

View File

@ -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<Class<? extends XPackExtension>> getExtensions() {
return Collections.emptyList();

View File

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

View File

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

View File

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

View File

@ -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<String> KEY_1 = new Setting<>("index.key1", "", Function.identity(), Setting.Property.IndexScope);