org.globus.gridshib.common.cli
Interface Testable

All Known Implementing Classes:
BaseCLI

public interface Testable

A testing interface for Java command-line applications.

Since:
0.5.0

Field Summary
static int APPLICATION_ERROR
           
static int COMMAND_LINE_ERROR
           
static int CONFIG_FILE_ERROR
           
static int SECURITY_ERROR
           
static int SUCCESS_CODE
           
 
Method Summary
 String[] getArgs()
          Gets the command-line arguments used to invoke the application.
 int getExitCode()
          Gets the exit code.
 int getExitCode(boolean forceRun)
          A convenience method that executes the application and gets the exit code.
 void run()
          Execute the command-line application.
 void setExitCode(int exitCode)
          Sets the exit code of the application.
 

Field Detail

SUCCESS_CODE

static final int SUCCESS_CODE
See Also:
Constant Field Values

SECURITY_ERROR

static final int SECURITY_ERROR
See Also:
Constant Field Values

CONFIG_FILE_ERROR

static final int CONFIG_FILE_ERROR
See Also:
Constant Field Values

COMMAND_LINE_ERROR

static final int COMMAND_LINE_ERROR
See Also:
Constant Field Values

APPLICATION_ERROR

static final int APPLICATION_ERROR
See Also:
Constant Field Values
Method Detail

getArgs

String[] getArgs()
Gets the command-line arguments used to invoke the application.

Returns:
an array of command-line arguments

run

void run()
         throws ApplicationRuntimeException
Execute the command-line application. This method MUST call setExitCode(int) but MUST NOT call System.exit(int).

Throws:
ApplicationRuntimeException - if execution of the application fails

setExitCode

void setExitCode(int exitCode)
Sets the exit code of the application.

Parameters:
exitCode - the exit code

getExitCode

int getExitCode()
Gets the exit code. This method MUST be called before calling the setExitCode(int) method, otherwise this method returns SECURITY_ERROR.

Returns:
the exit code

getExitCode

int getExitCode(boolean forceRun)
A convenience method that executes the application and gets the exit code.

Returns:
the exit code


Copyright © 2007-2008 University of Illinois. All Rights Reserved.