Merge pull request elastic/elasticsearch#2536 from rjernst/plugin_name_api

Remove name() and description() from plugin api

Original commit: elastic/x-pack-elasticsearch@717f3cfd0f
This commit is contained in:
Ryan Ernst 2016-06-16 14:35:32 -07:00 committed by GitHub
commit cae76cc16c
13 changed files with 3 additions and 114 deletions

View File

@ -32,16 +32,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) {

View File

@ -350,16 +350,6 @@ public class GraphTests extends ESSingleNodeTestCase {
}
public static class ScriptedTimeoutPlugin extends Plugin implements ScriptPlugin {
@Override
public String name() {
return "test-scripted-graph-timeout";
}
@Override
public String description() {
return "Test for scripted timeouts on graph searches";
}
@Override
public List<NativeScriptFactory> getNativeScripts() {
return Collections.singletonList(new NativeTestScriptedTimeout.Factory());

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

@ -26,17 +26,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

@ -127,14 +127,6 @@ public class XPackPlugin extends Plugin implements ScriptPlugin {
}
}
@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

@ -20,12 +20,6 @@ public class MockMustacheScriptEngine extends MockScriptEngine {
public static final String NAME = "mustache";
public static class TestPlugin extends MockScriptEngine.TestPlugin {
@Override
public String name() {
return NAME;
}
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new MockMustacheScriptEngine();

View File

@ -23,20 +23,6 @@ public class SleepScriptEngine implements ScriptEngineService {
public static final String NAME = "sleep";
public static class TestPlugin extends Plugin implements ScriptPlugin {
public TestPlugin() {
}
@Override
public String name() {
return NAME;
}
@Override
public String description() {
return "Mock script engine for integration tests";
}
@Override
public ScriptEngineService getScriptEngineService(Settings settings) {
return new SleepScriptEngine();

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

@ -76,14 +76,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);