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

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.test.SshdServerMock.CommandLookup
Enclosing class:
SshdServerMock

public static class SshdServerMock.CommandLookup
extends Object

Utility class for looking up and creating commands.

See Also:
SshdServerMock.findAndCreateCommand(String)

Constructor Summary
SshdServerMock.CommandLookup(Class<? extends SshdServerMock.CommandMock> cmdClass, Pattern commandPattern, boolean oneShot, Constructor<? extends SshdServerMock.CommandMock> constructor, Object... arguments)
          Standard constructor.
SshdServerMock.CommandLookup(Class<? extends SshdServerMock.CommandMock> cmdClass, String commandPattern, boolean oneShot, Constructor<? extends SshdServerMock.CommandMock> constructor, Object... arguments)
          Standard constructor.
 
Method Summary
 boolean isCommand(String command)
          If the given command matches the pattern.
 boolean isOneShot()
           
 SshdServerMock.CommandMock newInstance(String command)
          Creates a new instance of the command with all it's parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SshdServerMock.CommandLookup

public SshdServerMock.CommandLookup(Class<? extends SshdServerMock.CommandMock> cmdClass,
                                    Pattern commandPattern,
                                    boolean oneShot,
                                    Constructor<? extends SshdServerMock.CommandMock> constructor,
                                    Object... arguments)
Standard constructor.

Parameters:
cmdClass - the class of the command to create.
commandPattern - a regular expression matching a command the creation should be performed on.
oneShot - if this command should only be returned the first time it is called for.
constructor - the constructor of the command to call.
arguments - the arguments to the constructor except for the first actual command.
See Also:
SshdServerMock.returnCommandFor(String, Class), SshdServerMock.returnCommandFor(String, Class, Object[], Class[])

SshdServerMock.CommandLookup

public SshdServerMock.CommandLookup(Class<? extends SshdServerMock.CommandMock> cmdClass,
                                    String commandPattern,
                                    boolean oneShot,
                                    Constructor<? extends SshdServerMock.CommandMock> constructor,
                                    Object... arguments)
Standard constructor.

Parameters:
cmdClass - the class of the command to create.
commandPattern - a regular expression matching a command the creation should be performed on.
oneShot - if this command should only be returned the first time it is called for.
constructor - the constructor of the command to call.
arguments - the arguments to the constructor except for the first actual command.
See Also:
SshdServerMock.returnCommandFor(String, Class), SshdServerMock.returnCommandFor(String, Class, Object[], Class[])
Method Detail

isCommand

public boolean isCommand(String command)
If the given command matches the pattern.

Parameters:
command - the command
Returns:
true if so.

isOneShot

public boolean isOneShot()

newInstance

public SshdServerMock.CommandMock newInstance(String command)
Creates a new instance of the command with all it's parameters.

Parameters:
command - the first parameter to the constructor.
Returns:
a new instance of the command.


Copyright © 2004-2013. All Rights Reserved.