Search in sources :

Example 1 with MockTerminal

use of org.elasticsearch.cli.MockTerminal in project elasticsearch by elastic.

the class InstallPluginCommandTests method testQuietFlagDisabled.

public void testQuietFlagDisabled() throws Exception {
    MockTerminal terminal = new MockTerminal();
    terminal.setVerbosity(randomFrom(Terminal.Verbosity.NORMAL, Terminal.Verbosity.VERBOSE));
    installPlugin(terminal, false);
    assertThat(terminal.getOutput(), containsString("100%"));
}
Also used : MockTerminal(org.elasticsearch.cli.MockTerminal)

Example 2 with MockTerminal

use of org.elasticsearch.cli.MockTerminal in project elasticsearch by elastic.

the class ListPluginsCommandTests method testOnePlugin.

public void testOnePlugin() throws Exception {
    buildFakePlugin(env, "fake desc", "fake", "org.fake");
    MockTerminal terminal = listPlugins(home);
    assertEquals(terminal.getOutput(), buildMultiline("fake"));
}
Also used : MockTerminal(org.elasticsearch.cli.MockTerminal)

Example 3 with MockTerminal

use of org.elasticsearch.cli.MockTerminal in project elasticsearch by elastic.

the class ListPluginsCommandTests method testTwoPlugins.

public void testTwoPlugins() throws Exception {
    buildFakePlugin(env, "fake desc", "fake1", "org.fake");
    buildFakePlugin(env, "fake desc 2", "fake2", "org.fake");
    MockTerminal terminal = listPlugins(home);
    assertEquals(terminal.getOutput(), buildMultiline("fake1", "fake2"));
}
Also used : MockTerminal(org.elasticsearch.cli.MockTerminal)

Example 4 with MockTerminal

use of org.elasticsearch.cli.MockTerminal in project elasticsearch by elastic.

the class ListPluginsCommandTests method testPluginWithVerboseMultiplePlugins.

public void testPluginWithVerboseMultiplePlugins() throws Exception {
    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", "- 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"));
}
Also used : MockTerminal(org.elasticsearch.cli.MockTerminal)

Example 5 with MockTerminal

use of org.elasticsearch.cli.MockTerminal in project elasticsearch by elastic.

the class RemovePluginCommandTests method testNoConfigDirPreserved.

public void testNoConfigDirPreserved() throws Exception {
    Files.createDirectories(env.pluginsFile().resolve("fake"));
    final Path configDir = env.configFile().resolve("fake");
    final MockTerminal terminal = removePlugin("fake", home);
    assertThat(terminal.getOutput(), not(containsString(expectedConfigDirPreservedMessage(configDir))));
}
Also used : Path(java.nio.file.Path) MockTerminal(org.elasticsearch.cli.MockTerminal)

Aggregations

MockTerminal (org.elasticsearch.cli.MockTerminal)20 Path (java.nio.file.Path)5 Environment (org.elasticsearch.env.Environment)3 BufferedReader (java.io.BufferedReader)2 IOException (java.io.IOException)2 StringReader (java.io.StringReader)2 UserException (org.elasticsearch.cli.UserException)2 Settings (org.elasticsearch.common.settings.Settings)2 MalformedURLException (java.net.MalformedURLException)1 FileAlreadyExistsException (java.nio.file.FileAlreadyExistsException)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 OptionParser (joptsimple.OptionParser)1 OptionSet (joptsimple.OptionSet)1 Directory (org.apache.lucene.store.Directory)1 FSDirectory (org.apache.lucene.store.FSDirectory)1 Lock (org.apache.lucene.store.Lock)1 LockObtainFailedException (org.apache.lucene.store.LockObtainFailedException)1 IndexRequestBuilder (org.elasticsearch.action.index.IndexRequestBuilder)1 SearchPhaseExecutionException (org.elasticsearch.action.search.SearchPhaseExecutionException)1