|
25 | 25 | import java.nio.file.NoSuchFileException; |
26 | 26 | import java.nio.file.Path; |
27 | 27 | import java.util.Arrays; |
28 | | -import java.util.HashMap; |
29 | | -import java.util.Map; |
30 | 28 | import java.util.stream.Collectors; |
31 | 29 |
|
32 | 30 | import org.apache.lucene.util.LuceneTestCase; |
| 31 | +import org.elasticsearch.Version; |
33 | 32 | import org.elasticsearch.cli.ExitCodes; |
34 | 33 | import org.elasticsearch.cli.MockTerminal; |
35 | | -import org.elasticsearch.common.inject.spi.HasDependencies; |
36 | 34 | import org.elasticsearch.common.settings.Settings; |
37 | 35 | import org.elasticsearch.env.Environment; |
38 | 36 | import org.elasticsearch.test.ESTestCase; |
39 | | -import org.elasticsearch.Version; |
40 | 37 | import org.junit.Before; |
41 | 38 |
|
42 | 39 | @LuceneTestCase.SuppressFileSystems("*") |
@@ -155,4 +152,26 @@ public void testPluginWithWrongDescriptorFile() throws Exception{ |
155 | 152 | env.pluginsFile().resolve("fake1").resolve(PluginInfo.ES_PLUGIN_PROPERTIES).toString() + "]"); |
156 | 153 | } |
157 | 154 |
|
| 155 | + public void testExistingIncompatiblePlugin() throws Exception { |
| 156 | + PluginTestUtil.writeProperties(env.pluginsFile().resolve("fake_plugin1"), |
| 157 | + "description", "fake desc 1", |
| 158 | + "name", "fake_plugin1", |
| 159 | + "version", "1.0", |
| 160 | + "elasticsearch.version", Version.fromString("1.0.0").toString(), |
| 161 | + "java.version", System.getProperty("java.specification.version"), |
| 162 | + "classname", "org.fake1"); |
| 163 | + buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2"); |
| 164 | + |
| 165 | + MockTerminal terminal = listPlugins(home); |
| 166 | + assertEquals("fake_plugin1\n" + |
| 167 | + "WARNING: Plugin [fake_plugin1] is incompatible with Elasticsearch [" + |
| 168 | + Version.CURRENT.toString() + "]. Was designed for version [1.0.0]\n" + |
| 169 | + "fake_plugin2\n", |
| 170 | + terminal.getOutput()); |
| 171 | + |
| 172 | + String[] params = {"-s"}; |
| 173 | + terminal = listPlugins(home, params); |
| 174 | + assertEquals("fake_plugin1\nfake_plugin2\n", terminal.getOutput()); |
| 175 | + } |
| 176 | + |
158 | 177 | } |
0 commit comments