org.testtoolinterfaces.cmdline.CmdLineParser Maven / Gradle / Ivy
package org.testtoolinterfaces.cmdline;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Locale;
import org.testtoolinterfaces.utils.RunTimeData;
import joptsimple.OptionSpecBuilder;
public interface CmdLineParser
{
public enum COMMANDS
{
/** Execute one or more tests, including preparation and restoration */ EXECUTE,
/** Validate a Test File, a Test Group or a Test Case */ VALIDATE,
/** Do all preparational steps for a Test Group or Case */ PREPARE,
/** Do all restorational steps for a Test Group or Case */ RESTORE,
/** Prints a list of supported interfaces */ INTERFACES,
/** Prints a list of supported keywords */ KEYWORDS,
/** Prints details of a keyword, such as description and parameters */ KEYWORD_DETAILS;
/** Prints a help message on screen */ //HELP;
public String toString()
{
return super.toString().toLowerCase();
}
};
public final static String EXECUTE = COMMANDS.EXECUTE.toString();
public final static String VALIDATE = COMMANDS.VALIDATE.toString();
public final static String PREPARE = COMMANDS.PREPARE.toString();
public final static String RESTORE = COMMANDS.RESTORE.toString();
public final static String INTERFACES = COMMANDS.INTERFACES.toString();
public final static String KEYWORDS = COMMANDS.KEYWORDS.toString();
public final static String KEYWORD_DETAILS = COMMANDS.KEYWORD_DETAILS.toString();
// public final static String HELP = COMMANDS.HELP.toString();
public enum OPTION
{
/** Help option */ HELP,
/** Command to execute */ COMMAND,
/** Test Group Filename */ FILE,
/** Test Group Filename */ TESTFILE,
/** Individual Configuration Filename */ CONFIGFILE,
/** Global Configuration Filename */ GLOBALCONFIGFILE,
/** Test Group ID */ GROUP,
/** Test Group ID */ TESTGROUP,
/** Test Case ID */ CASE,
/** Test Case ID */ TESTCASE;
public String toString()
{
return super.toString().toLowerCase( Locale.ENGLISH );
}
};
// These must be set in RunTimeData before invoking the parse-command
public static final String BASEDIR = "basedir"; // As java.io.File
public static final String USERHOME = "userhome"; // As java.io.File
// These are set when the parse-command is finished
public static final String HELP = OPTION.HELP.toString(); // As String
public static final String COMMAND = OPTION.COMMAND.toString(); // As OPTION
public static final String FILE = OPTION.FILE.toString(); // As java.io.File
public static final String TESTFILE = OPTION.TESTFILE.toString(); // As java.io.File
public static final String CONFIGFILE = OPTION.CONFIGFILE.toString(); // As java.io.File
public static final String GLOBALCONFIGFILE = OPTION.GLOBALCONFIGFILE.toString(); // As java.io.File
public static final String GROUP = OPTION.GROUP.toString(); // As String
public static final String TESTGROUP = OPTION.TESTGROUP.toString(); // As String
public static final String CASE = OPTION.CASE.toString(); // As String
public static final String TESTCASE = OPTION.TESTCASE.toString(); // As String
public static final String CONFIGDIR = "configdir"; // As java.io.File
public static final String TESTSUITEDIR = "testsuitedir"; // As java.io.File
public void parse ( RunTimeData aRtData, String... anArgs ) throws ParameterException;
public void acceptCommand(String aCommand);
public void acceptCommand(String aCommand, String aDescription);
public void setDefaultCommand( String aCommand );
public void setDefaultCommand( String aCommand, String aDescription );
public OptionSpecBuilder acceptOption( String anOption );
public OptionSpecBuilder acceptOption(String anOption, String aDescription);
public OptionSpecBuilder acceptOptions(ArrayList anOptions);
public OptionSpecBuilder acceptOptions(ArrayList anOptions, String aDescription);
public void printHelpOn( PrintStream aStream );
public OptionSpecBuilder acceptFlag(String aFlag);
public OptionSpecBuilder acceptFlag(String aFlag, String aDescription);
}