From 869221d663899a97dc63efcb62e842339f9a3489 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 7 Oct 2016 14:31:56 -0400 Subject: [PATCH] Revert "Display plugins versions" This reverts commit 9411f18f27a023b28f28aaa6af904bc519cca8fa. --- .../plugins/ListPluginsCommand.java | 2 +- .../plugins/ListPluginsCommandTests.java | 54 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/plugins/ListPluginsCommand.java b/core/src/main/java/org/elasticsearch/plugins/ListPluginsCommand.java index ee81261c08013..bd2f853bac022 100644 --- a/core/src/main/java/org/elasticsearch/plugins/ListPluginsCommand.java +++ b/core/src/main/java/org/elasticsearch/plugins/ListPluginsCommand.java @@ -60,8 +60,8 @@ protected void execute(Terminal terminal, OptionSet options, Map } Collections.sort(plugins); for (final Path plugin : plugins) { + terminal.println(plugin.getFileName().toString()); PluginInfo info = PluginInfo.readFromProperties(env.pluginsFile().resolve(plugin.toAbsolutePath())); - terminal.println(plugin.getFileName().toString() + "@" + info.getVersion()); terminal.println(Terminal.Verbosity.VERBOSE, info.toString()); } } diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/plugins/ListPluginsCommandTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/plugins/ListPluginsCommandTests.java index ddac8f66209da..1422280165cc7 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/plugins/ListPluginsCommandTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/plugins/ListPluginsCommandTests.java @@ -59,7 +59,7 @@ public void setUp() throws Exception { static MockTerminal listPlugins(Path home) throws Exception { return listPlugins(home, new String[0]); } - + static MockTerminal listPlugins(Path home, String[] args) throws Exception { String[] argsAndHome = new String[args.length + 1]; System.arraycopy(args, 0, argsAndHome, 0, args.length); @@ -69,16 +69,16 @@ static MockTerminal listPlugins(Path home, String[] args) throws Exception { assertEquals(ExitCodes.OK, status); return terminal; } - + static String buildMultiline(String... args){ return Arrays.asList(args).stream().collect(Collectors.joining("\n", "", "\n")); } - - static void buildFakePlugin(Environment env, String description, String name, String classname, String version) throws IOException { + + static void buildFakePlugin(Environment env, String description, String name, String classname) throws IOException { PluginTestUtil.writeProperties(env.pluginsFile().resolve(name), "description", description, "name", name, - "version", version, + "version", "1.0", "elasticsearch.version", Version.CURRENT.toString(), "java.version", System.getProperty("java.specification.version"), "classname", classname); @@ -97,51 +97,51 @@ public void testNoPlugins() throws Exception { } public void testOnePlugin() throws Exception { - buildFakePlugin(env, "fake desc", "fake", "org.fake", "1.0.0"); + buildFakePlugin(env, "fake desc", "fake", "org.fake"); MockTerminal terminal = listPlugins(home); - assertEquals(terminal.getOutput(), buildMultiline("fake@1.0.0")); + assertEquals(terminal.getOutput(), buildMultiline("fake")); } public void testTwoPlugins() throws Exception { - buildFakePlugin(env, "fake desc", "fake1", "org.fake", "1.2.3"); - buildFakePlugin(env, "fake desc 2", "fake2", "org.fake", "6.5.4"); + buildFakePlugin(env, "fake desc", "fake1", "org.fake"); + buildFakePlugin(env, "fake desc 2", "fake2", "org.fake"); MockTerminal terminal = listPlugins(home); - assertEquals(terminal.getOutput(), buildMultiline("fake1@1.2.3", "fake2@6.5.4")); + assertEquals(terminal.getOutput(), buildMultiline("fake1", "fake2")); } - + public void testPluginWithVerbose() throws Exception { - buildFakePlugin(env, "fake desc", "fake_plugin", "org.fake", "1.0.0"); + buildFakePlugin(env, "fake desc", "fake_plugin", "org.fake"); String[] params = { "-v" }; MockTerminal terminal = listPlugins(home, params); - assertEquals(terminal.getOutput(), buildMultiline("Plugins directory: " + env.pluginsFile(), "fake_plugin@1.0.0", - "- Plugin information:", "Name: fake_plugin", "Description: fake desc", "Version: 1.0.0", " * Classname: org.fake")); + assertEquals(terminal.getOutput(), buildMultiline("Plugins directory: " + env.pluginsFile(), "fake_plugin", + "- Plugin information:", "Name: fake_plugin", "Description: fake desc", "Version: 1.0", " * Classname: org.fake")); } - + public void testPluginWithVerboseMultiplePlugins() throws Exception { - buildFakePlugin(env, "fake desc 1", "fake_plugin1", "org.fake", "1.2.3"); - buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2", "6.5.4"); + buildFakePlugin(env, "fake desc 1", "fake_plugin1", "org.fake"); + buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2"); String[] params = { "-v" }; MockTerminal terminal = listPlugins(home, params); assertEquals(terminal.getOutput(), buildMultiline("Plugins directory: " + env.pluginsFile(), - "fake_plugin1@1.2.3", "- Plugin information:", "Name: fake_plugin1", "Description: fake desc 1", "Version: 1.2.3", - " * Classname: org.fake", "fake_plugin2@6.5.4", "- Plugin information:", "Name: fake_plugin2", - "Description: fake desc 2", "Version: 6.5.4", " * Classname: org.fake2")); + "fake_plugin1", "- Plugin information:", "Name: fake_plugin1", "Description: fake desc 1", "Version: 1.0", + " * Classname: org.fake", "fake_plugin2", "- Plugin information:", "Name: fake_plugin2", + "Description: fake desc 2", "Version: 1.0", " * Classname: org.fake2")); } - + public void testPluginWithoutVerboseMultiplePlugins() throws Exception { - buildFakePlugin(env, "fake desc 1", "fake_plugin1", "org.fake", "1.0.0"); - buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2", "1.0.0"); + buildFakePlugin(env, "fake desc 1", "fake_plugin1", "org.fake"); + buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2"); MockTerminal terminal = listPlugins(home, new String[0]); String output = terminal.getOutput(); - assertEquals(output, buildMultiline("fake_plugin1@1.0.0", "fake_plugin2@1.0.0")); + assertEquals(output, buildMultiline("fake_plugin1", "fake_plugin2")); } - + public void testPluginWithoutDescriptorFile() throws Exception{ Files.createDirectories(env.pluginsFile().resolve("fake1")); NoSuchFileException e = expectThrows(NoSuchFileException.class, () -> listPlugins(home)); assertEquals(e.getFile(), env.pluginsFile().resolve("fake1").resolve(PluginInfo.ES_PLUGIN_PROPERTIES).toString()); } - + public void testPluginWithWrongDescriptorFile() throws Exception{ PluginTestUtil.writeProperties(env.pluginsFile().resolve("fake1"), "description", "fake desc"); @@ -149,5 +149,5 @@ public void testPluginWithWrongDescriptorFile() throws Exception{ assertEquals(e.getMessage(), "Property [name] is missing in [" + env.pluginsFile().resolve("fake1").resolve(PluginInfo.ES_PLUGIN_PROPERTIES).toString() + "]"); } - + }