|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.finra.jtaf.core.model.invocationtarget.InvocationTarget
org.finra.jtaf.core.model.invocationtarget.Command
org.finra.jtaf.core.commands.RandomGenerator
public class RandomGenerator
This class is used to generate a random string, phone number, regex, US state, or US state abbreviation.
Field Summary | |
---|---|
static List<String> |
abbrevUSState
|
static String |
charsForRandomString
|
static List<String> |
USState
|
Fields inherited from class org.finra.jtaf.core.model.invocationtarget.Command |
---|
interpreter, recordResult |
Fields inherited from class org.finra.jtaf.core.model.invocationtarget.InvocationTarget |
---|
globalContext |
Constructor Summary | |
---|---|
RandomGenerator(String name)
This called when instantiating the command before it is executed by the interpreter.The recordResult variable is set to false because details about the RandomGenerator step aren't needed, unlike the commands within the RandomGenerator block. |
Method Summary | |
---|---|
protected void |
execute(IInvocationContext ctx)
This method should be overridden by every Command object. |
static String |
generate(String method,
String length,
String lengthMin,
String lengthMax,
String min,
String max,
String regexp)
Use a regular expression to generate a string or use methods to select US state name or abbreviations and generate phone numbers and strings. |
static String |
generateAbbrevUSState()
Randomly selects a US state abbreviation from the list. |
static String |
generatePhone()
Generates a random phone number. |
static String |
generateRegexp(String regexp)
Generate a string using a specified regular expression. |
static String |
generateString(String chars,
int length)
This randomly generates a string given a set of characters and a desired length. |
static String |
generateUSState()
Randomly selects a US state from the list. |
Methods inherited from class org.finra.jtaf.core.model.invocationtarget.Command |
---|
acceptInvocationTargetVisitor, clearContext, deinitialize, executeInvocation, getBooleanOrDefault, getContext, getFloatOrDefault, getIntegerOrDefault, getOptionalObject, getOptionalString, getRequiredBoolean, getRequiredFloat, getRequiredInteger, getRequiredObject, getRequiredString, getStringOrDefault, initialize, launch, recordResult |
Methods inherited from class org.finra.jtaf.core.model.invocationtarget.InvocationTarget |
---|
addOptionalParameter, addProduction, addRequiredParameter, cleanGlobalContext, getAllParameters, getFromGlobalContext, getGlobalContext, getName, getOptionalParameters, getProductions, getRequiredParameters, getUsage, putToGlobalContext, setGlobalContext, setUsage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final List<String> abbrevUSState
public static final List<String> USState
public static final String charsForRandomString
Constructor Detail |
---|
public RandomGenerator(String name) throws NameFormatException
name
- - name of the command
NameFormatException
Method Detail |
---|
public static String generate(String method, String length, String lengthMin, String lengthMax, String min, String max, String regexp)
method
- - the method to be used. Either abbrevUSState, USState, phone,
number, or stringlength
- - length of number or string to be generated. lengthMin,
lengthMax, min, and max should not be specified when using
this parameter.lengthMin
- - used to specify minimum length of random string generatedlengthMax
- - used to specify maximum length of random string generatedmin
- - used to specify minimum length of random number generatedmax
- - used to specify maximum length of random number generatedregexp
- - regular expression to be used for string generation. This
should not be specified if method parameter is.
public static String generateRegexp(String regexp)
regexp
- - regular expression to be used to generate the string
public static String generatePhone()
public static String generateAbbrevUSState()
public static String generateUSState()
public static String generateString(String chars, int length)
chars
- - The characters to be usedlength
- - The length of the resulting string
protected void execute(IInvocationContext ctx) throws Throwable
Command
execute
in class Command
Exception
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |