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  Writer writer
           
 
Fields inherited from class org.apache.accumulo.core.util.shell.Shell
CHARSET, commandFactory, commandGrouping, configError, execCommand, execFile, exitCode, instance, iteratorProfiles, log, NO_FIXED_ARG_LENGTH_CHECK, reader, scanIteratorOptions, verbose
 
Fields inherited from class org.apache.accumulo.core.util.shell.ShellOptions
helpLongOption, helpOption, tableOption, userOption
 
Constructor Summary
MockShell(InputStream in, Writer writer)
           
 
Method Summary
 boolean config(String... args)
           
static ByteArrayInputStream makeCommands(String... commands)
          Convenience method to create the byte-array to hand to the console
 void setConsoleInputStream(InputStream in)
           
 void setConsoleWriter(Writer writer)
           
protected  void setInstance(org.apache.commons.cli.CommandLine cl)
           
 int start()
           
 
Methods inherited from class org.apache.accumulo.core.util.shell.Shell
checkTableState, execCommand, getConnector, getDefaultPrompt, getExit, getExitCode, getFormatter, getFormatter, getPrincipal, getReader, getTableName, getToken, hasExited, isDebuggingEnabled, isMasking, isVerbose, main, printBinaryRecords, printBinaryRecords, printException, printInfo, printLines, printLines, printRecords, printRecords, printVerboseInfo, readMaskedLine, repeat, resetExitCode, setDebugging, setExit, setLogErrorsToConsole, setTableName, 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

writer

protected Writer writer
Constructor Detail

MockShell

public MockShell(InputStream in,
                 Writer writer)
          throws IOException
Throws:
IOException
Method Detail

config

public boolean config(String... args)
Overrides:
config in class Shell

setInstance

protected void setInstance(org.apache.commons.cli.CommandLine cl)
Overrides:
setInstance in class Shell

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(Writer writer)
Parameters:
writer - the writer to set

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 © 2013 Apache Accumulo Project. All Rights Reserved.