com.sonyericsson.hudson.plugins.gerrit.trigger.test
Class SshdServerMock.CommandMock

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.test.SshdServerMock.CommandMock
All Implemented Interfaces:
org.apache.sshd.server.Command
Direct Known Subclasses:
SshdServerMock.EofCommandMock, SshdServerMock.PrintLinesCommand
Enclosing class:
SshdServerMock

public static class SshdServerMock.CommandMock
extends java.lang.Object
implements org.apache.sshd.server.Command

A mocked ssh command.

See Also:
SshdServerMock.createCommand(String)

Field Summary
protected  java.lang.String command
           
protected static int WAIT_FOR_DESTROYED
          The max ms to wait before checking if the command is destroyed.
 
Constructor Summary
SshdServerMock.CommandMock(java.lang.String command)
          Standard constructor.
 
Method Summary
 void destroy()
           
 java.lang.String getCommand()
          The command from the client.
 java.io.OutputStream getErrorStream()
          The error stream from the command.
 java.io.InputStream getInputStream()
          The input stream to the command.
 java.io.OutputStream getOutputStream()
          the output stream from the command.
 boolean isDestroyed()
          Is the command destroyed.
 void setErrorStream(java.io.OutputStream errorStream)
           
 void setExitCallback(org.apache.sshd.server.ExitCallback exitCallback)
           
 void setInputStream(java.io.InputStream inputStream)
           
 void setOutputStream(java.io.OutputStream outputStream)
           
 void start(org.apache.sshd.server.Environment environment)
          Default implementation just waits for the command to be destroyed.
 void stop(int exitCode)
          Stops the command from running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WAIT_FOR_DESTROYED

protected static final int WAIT_FOR_DESTROYED
The max ms to wait before checking if the command is destroyed.

See Also:
Constant Field Values

command

protected java.lang.String command
Constructor Detail

SshdServerMock.CommandMock

public SshdServerMock.CommandMock(java.lang.String command)
Standard constructor.

Parameters:
command - the command to "execute".
Method Detail

setInputStream

public void setInputStream(java.io.InputStream inputStream)
Specified by:
setInputStream in interface org.apache.sshd.server.Command

setOutputStream

public void setOutputStream(java.io.OutputStream outputStream)
Specified by:
setOutputStream in interface org.apache.sshd.server.Command

setErrorStream

public void setErrorStream(java.io.OutputStream errorStream)
Specified by:
setErrorStream in interface org.apache.sshd.server.Command

setExitCallback

public void setExitCallback(org.apache.sshd.server.ExitCallback exitCallback)
Specified by:
setExitCallback in interface org.apache.sshd.server.Command

start

public void start(org.apache.sshd.server.Environment environment)
           throws java.io.IOException
Default implementation just waits for the command to be destroyed.

Specified by:
start in interface org.apache.sshd.server.Command
Parameters:
environment - env.
Throws:
java.io.IOException - if so.

stop

public void stop(int exitCode)
Stops the command from running.

Parameters:
exitCode - the exitCode to return to the client.

destroy

public void destroy()
Specified by:
destroy in interface org.apache.sshd.server.Command

isDestroyed

public boolean isDestroyed()
Is the command destroyed.

Returns:
true if so.

getInputStream

public java.io.InputStream getInputStream()
The input stream to the command.

Returns:
the input stream.

getOutputStream

public java.io.OutputStream getOutputStream()
the output stream from the command.

Returns:
the output stream.

getErrorStream

public java.io.OutputStream getErrorStream()
The error stream from the command.

Returns:
the error stream.

getCommand

public java.lang.String getCommand()
The command from the client.

Returns:
the command.


Copyright © 2004-2013. All Rights Reserved.