Search in sources :

Example 1 with MockTerminal

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);
}
Also used : MockTerminal(org.opensearch.cli.MockTerminal)

Example 2 with MockTerminal

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());
}
Also used : MockTerminal(org.opensearch.cli.MockTerminal)

Example 3 with MockTerminal

use of org.opensearch.cli.MockTerminal in project OpenSearch by opensearch-project.

the class ListPluginsCommandTests method testPluginWithNativeController.

public void testPluginWithNativeController() throws Exception {
    buildFakePlugin(env, "fake desc 1", "fake_plugin1", "org.fake", true);
    String[] params = { "-v" };
    MockTerminal terminal = listPlugins(home, params);
    assertEquals(buildMultiline("Plugins directory: " + env.pluginsFile(), "fake_plugin1", "- Plugin information:", "Name: fake_plugin1", "Description: fake desc 1", "Version: 1.0", "OpenSearch Version: " + Version.CURRENT.toString(), "Java Version: 1.8", "Native Controller: true", "Extended Plugins: []", " * Classname: org.fake", "Folder name: custom-folder"), terminal.getOutput());
}
Also used : MockTerminal(org.opensearch.cli.MockTerminal)

Example 4 with MockTerminal

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.pluginsFile(), "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());
}
Also used : MockTerminal(org.opensearch.cli.MockTerminal)

Example 5 with MockTerminal

use of org.opensearch.cli.MockTerminal in project OpenSearch by opensearch-project.

the class InstallPluginCommandTests method testQuietFlagEnabled.

public void testQuietFlagEnabled() throws Exception {
    MockTerminal terminal = new MockTerminal();
    terminal.setVerbosity(Terminal.Verbosity.SILENT);
    installPlugin(terminal, false);
    assertThat(terminal.getOutput(), not(containsString("100%")));
}
Also used : MockTerminal(org.opensearch.cli.MockTerminal)

Aggregations

MockTerminal (org.opensearch.cli.MockTerminal)50 Environment (org.opensearch.env.Environment)16 Path (java.nio.file.Path)15 Matchers.containsString (org.hamcrest.Matchers.containsString)15 Settings (org.opensearch.common.settings.Settings)15 TestEnvironment (org.opensearch.env.TestEnvironment)15 OptionSet (joptsimple.OptionSet)13 OpenSearchException (org.opensearch.OpenSearchException)12 IOException (java.io.IOException)10 OptionParser (joptsimple.OptionParser)10 Version (org.opensearch.Version)10 ClusterState (org.opensearch.cluster.ClusterState)9 NodeEnvironment (org.opensearch.env.NodeEnvironment)9 TranslogCorruptedException (org.opensearch.index.translog.TranslogCorruptedException)8 IndexMetadata (org.opensearch.cluster.metadata.IndexMetadata)7 IndexSettings (org.opensearch.index.IndexSettings)7 Files (java.nio.file.Files)6 Arrays (java.util.Arrays)6 Matcher (java.util.regex.Matcher)6 Pattern (java.util.regex.Pattern)6