org.apache.accumulo.core.client.mock
Class MockShell

java.lang.Object
  extended by org.apache.accumulo.core.util.shell.ShellOptions
      extended by org.apache.accumulo.core.util.shell.Shell
          extended by org.apache.accumulo.core.client.mock.MockShell

public class MockShell
extends Shell

An Accumulo Shell implementation that allows a developer to attach an InputStream and Writer to the Shell for testing purposes.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.accumulo.core.util.shell.Shell
Shell.Command, Shell.PrintFile, Shell.PrintLine, Shell.PrintShell
 
Field Summary
protected  InputStream in
           
protected  OutputStream out
           
protected  Writer writer
          Deprecated. since 1.6.0; use out
 
Fields inherited from class org.apache.accumulo.core.util.shell.Shell
CHARSET, commandFactory, commandGrouping, COMMENT_PREFIX, execCommand, execFile, exitCode, HISTORY_DIR_NAME, HISTORY_FILE_NAME, instance, iteratorProfiles, log, NO_FIXED_ARG_LENGTH_CHECK, reader, scanIteratorOptions, verbose
 
Fields inherited from class org.apache.accumulo.core.util.shell.ShellOptions
helpLongOption, helpOption, namespaceOption, tableOption, userOption
 
Constructor Summary
MockShell(InputStream in, OutputStream out)
           
MockShell(InputStream in, Writer out)
          Deprecated. since 1.6.0; use OutputStream version
 
Method Summary
 boolean config(String... args)
          Configures the shell using the provided options.
static ByteArrayInputStream makeCommands(String... commands)
          Convenience method to create the byte-array to hand to the console
 void setConsoleInputStream(InputStream in)
           
 void setConsoleWriter(OutputStream out)
           
 void setConsoleWriter(Writer out)
          Deprecated. since 1.6.0; use the OutputStream version
protected  void setInstance(org.apache.commons.cli.CommandLine cl)
          Deprecated. since 1.6.0; use ShellOptionsJC version
protected  void setInstance(ShellOptionsJC options)
          Sets the instance used by the shell based on the given options.
 int start()
           
 
Methods inherited from class org.apache.accumulo.core.util.shell.Shell
checkTableState, execCommand, getClassLoader, getConnector, getDefaultPrompt, getExit, getExitCode, getFormatter, getFormatter, getInstance, getPrincipal, getReader, getTableName, getToken, hasExited, isDebuggingEnabled, isMasking, isTabCompletion, isVerbose, main, printBinaryRecords, printBinaryRecords, printException, printInfo, printLines, printLines, printRecords, printRecords, printVerboseInfo, readMaskedLine, repeat, resetExitCode, setDebugging, setExit, setLogErrorsToConsole, setTableName, shutdown, updateUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

protected InputStream in

out

protected OutputStream out

writer

@Deprecated
protected Writer writer
Deprecated. since 1.6.0; use out
Will only be set if you use either the Writer constructor or the setWriter(Writer) method

Constructor Detail

MockShell

public MockShell(InputStream in,
                 OutputStream out)
          throws IOException
Throws:
IOException

MockShell

@Deprecated
public MockShell(InputStream in,
                            Writer out)
          throws IOException
Deprecated. since 1.6.0; use OutputStream version

Throws:
IOException
Method Detail

config

public boolean config(String... args)
Description copied from class: Shell
Configures the shell using the provided options. Not for client use.

Overrides:
config in class Shell
Returns:
true if the shell was successfully configured, false otherwise.

setInstance

protected void setInstance(ShellOptionsJC options)
Description copied from class: Shell
Sets the instance used by the shell based on the given options.

Overrides:
setInstance in class Shell
Parameters:
options - shell options

setInstance

@Deprecated
protected void setInstance(org.apache.commons.cli.CommandLine cl)
Deprecated. since 1.6.0; use ShellOptionsJC version


start

public int start()
          throws IOException
Overrides:
start in class Shell
Throws:
IOException

setConsoleInputStream

public void setConsoleInputStream(InputStream in)
Parameters:
in - the in to set

setConsoleWriter

public void setConsoleWriter(OutputStream out)
Parameters:
out - the output stream to set

setConsoleWriter

@Deprecated
public void setConsoleWriter(Writer out)
Deprecated. since 1.6.0; use the OutputStream version


makeCommands

public static ByteArrayInputStream makeCommands(String... commands)
Convenience method to create the byte-array to hand to the console

Parameters:
commands - An array of commands to run
Returns:
A byte[] input stream which can be handed to the console.


Copyright © 2015 Apache Accumulo Project. All rights reserved.