use of org.opensearch.cli.MockTerminal in project OpenSearch by opensearch-project.
the class ListPluginsCommandTests method testPluginWithoutVerboseMultiplePlugins.
public void testPluginWithoutVerboseMultiplePlugins() throws Exception {
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(buildMultiline("fake_plugin1", "fake_plugin2"), output);
}
use of org.opensearch.cli.MockTerminal in project OpenSearch by opensearch-project.
the class ListPluginsCommandTests method testOnePlugin.
public void testOnePlugin() throws Exception {
buildFakePlugin(env, "fake desc", "fake", "org.fake");
MockTerminal terminal = listPlugins(home);
assertEquals(buildMultiline("fake"), terminal.getOutput());
}
use of org.opensearch.cli.MockTerminal in project OpenSearch by opensearch-project.
the class ListPluginsCommandTests method testPluginWithVerbose.
public void testPluginWithVerbose() throws Exception {
buildFakePlugin(env, "fake desc", "fake_plugin", "org.fake");
String[] params = { "-v" };
MockTerminal terminal = listPlugins(home, params);
assertEquals(buildMultiline("Plugins directory: " + env.pluginsDir(), "fake_plugin", "- Plugin information:", "Name: fake_plugin", "Description: fake desc", "Version: 1.0", "OpenSearch Version: " + Version.CURRENT.toString(), "Java Version: 1.8", "Native Controller: false", "Extended Plugins: []", " * Classname: org.fake", "Folder name: custom-folder"), terminal.getOutput());
}
use of org.opensearch.cli.MockTerminal in project OpenSearch by opensearch-project.
the class RemovePluginCommandTests method testPurgeOnlyMarkerFileExists.
public void testPurgeOnlyMarkerFileExists() throws Exception {
final Path configDir = env.configDir().resolve("fake");
final Path removing = env.pluginsDir().resolve(".removing-fake");
Files.createFile(removing);
final MockTerminal terminal = removePlugin("fake", home, randomBoolean());
assertFalse(Files.exists(removing));
assertThat(terminal.getOutput(), not(containsString(expectedConfigDirPreservedMessage(configDir))));
}
use of org.opensearch.cli.MockTerminal in project OpenSearch by opensearch-project.
the class RemovePluginCommandTests method removePlugin.
static MockTerminal removePlugin(String name, Path home, boolean purge) throws Exception {
Environment env = TestEnvironment.newEnvironment(Settings.builder().put("path.home", home).build());
MockTerminal terminal = new MockTerminal();
new MockRemovePluginCommand(env).execute(terminal, env, name, purge);
return terminal;
}
Aggregations