public abstract class TestNode extends com.itko.util.test.TestNode implements com.itko.lisa.model.IWriteXML, NamedType, CloneImplemented, com.itko.lisa.test.NameGenerator
Modifier and Type | Class and Description |
---|---|
static class |
TestNode.ASSERT_FILTER_TYPE |
static class |
TestNode.FILTER_RUN_TYPE |
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
cat |
static java.lang.String |
copyrightNotice |
static java.lang.String |
DEF_SYS_THINK_SPEC
default think spec for system steps (continue, fail, end, subprocess)
|
static java.lang.String |
DEF_THINK_SPEC
default think spec for most steps
|
static java.lang.String |
DOC_TAG |
protected java.lang.String |
docs |
protected java.lang.String |
elseNode |
static java.lang.String |
EXTRAS_TAG |
static java.lang.String |
GRAPH_X_TAG |
static java.lang.String |
GRAPH_Y_TAG |
protected java.lang.String |
log |
protected java.lang.String |
name |
static int |
NUM_ASSERTS_WARNING_THRESHOLD |
static int |
NUM_FILTERS_WARNING_THRESHOLD |
protected int |
ordinal |
protected boolean |
quiet |
static java.lang.String |
REMOTE_SERVER_TAG |
protected java.lang.String |
remoteServer |
protected static org.apache.commons.logging.Log |
stepLogger |
protected TestCase |
test |
protected java.lang.String |
thinkSpec |
protected java.lang.String |
type |
protected boolean |
useFilters |
protected int |
version |
Constructor and Description |
---|
TestNode() |
Modifier and Type | Method and Description |
---|---|
long |
calcThinkTimeFromSpec(TestExec ts,
java.lang.String thinkSpec) |
boolean |
canDeployToCS()
This method returns whether or not this test step can be deployed to a coordinator
server.
|
boolean |
canDeployToVSE()
This method returns whether or not this test step can be deployed to a virtual
environment.
|
java.lang.Object |
clone() |
long |
compensateForLastResponseTime(TestExec ts,
long candidateMillis)
Shorten the think based on the time we took since the last step
response was received (unless we are VSE)
At least one subclass of TestNode - the VSE BaseRespondStep - overrides this method...
|
void |
destroy(TestExec ts)
This method gives the test node the ability to do final cleanup of
resources when the test has ended and will no longer be calling the node.
|
long |
determineThinkTimeDelay(TestExec ts,
java.lang.String thinkSpec)
This method provides the means for determining how much to actually delay by converting
the given think time spec into a think time, adjusting it by the staging doc's think
time percentage and the starting time of the current step.
|
protected abstract void |
execute(TestExec ts)
This is the method called by TestNode when all pre-processing related
to node execution is complete and LISA is prepared for the custom
node logic to be performed.
|
void |
executeNode(TestExec ts)
public void executeNode( TestExec ts )
Method that is called internally by LISA to execute a node.
|
void |
exportAssets(com.itko.lisa.asset.AssetContext assetContext,
TestExec testExec) |
protected java.lang.String |
generateDeterministicURL(com.itko.lisa.asset.AssetContext context,
com.itko.lisa.asset.Asset asset) |
java.lang.String |
generateName()
This is the default implementation of generating a name for step from step elements.
|
java.util.List<com.itko.lisa.test.Assertion> |
getAssertions()
Assertion objects are stored with each TestNode in a List.
|
java.util.Vector<com.itko.lisa.test.Assertion> |
getCheckResults()
Deprecated.
use getAssertions instead
|
java.util.Vector<java.lang.String> |
getDataSets()
Data Sets are only defined at the global level, i.e., as children of the
Test Case, not a particular Node.
|
java.lang.String |
getDocumentation()
Simple text field for providing extended documentation of the node.
|
java.lang.String |
getElseNode()
The else node is the node name that is executed if the CheckResult mechanism
doesn't set the workflow.
|
ParameterList |
getExtraInfo()
This method is used to return any extra information for public consumption from a VSE
for this step.
|
java.util.Vector<FilterInterface> |
getFilters()
Every TestNode has a collection of Filters that are defined only to be executed
for that Node.
|
java.util.List<FilterInterface> |
getFiltersAsList()
Similar to getFilters but returns an unmodifiable copy of the getFilters() vector in a typesafe
and unsynchronized List.
|
int |
getGraphX() |
int |
getGraphY() |
java.lang.String |
getLog()
The log entry given by the Test Case document
|
java.lang.String |
getName()
The name of this TestNode is the one provided in the Test Case document
|
int |
getOrdinal()
Every TestNode is stored in a Hashtable, but at times, we need an ordered
view of the nodes.
|
java.lang.String |
getPK()
Frequently we need to make sure we have a way to uniquely key a particular node.
|
java.util.Vector<java.lang.String> |
getRandLists()
Random Lists are only defined at the global level.
|
java.lang.String |
getRemoteServer()
Where are we going to run this node?
|
protected java.lang.String |
getStepTypeForXML()
This method allows a subclass to override what is reported as the step type
in generated XML.
|
TestCase |
getTest() |
java.lang.String |
getTestCaseName() |
java.lang.String |
getThink()
Returns a string representation of the think parameters.
|
java.lang.String |
getType()
The classname of this TestNode
|
java.lang.String |
getUid() |
int |
getVersion()
Returns the version number of the node definition
|
abstract void |
initialize(TestCase test,
org.w3c.dom.Element e)
This method is called during the construction of a TestNode.
|
boolean |
isEndNode()
Seldom will extensions need this, but node types that are in fact used to stop running the
model need to identify themselves.
|
boolean |
isGeneratedName(java.lang.String name) |
boolean |
isNodeEndType() |
boolean |
isNodeFailType() |
boolean |
isQuiet()
A quiet node does not report any events as it executes that would be considered for something like
total nodes executed, execution time, and etc.
|
boolean |
isQuietTheDefault()
For backward compatibility, we need to have nodes tell us if they should be quiet or not as a
default.
|
boolean |
isRestrictedForCreateAndCopyPasteInLISA() |
boolean |
isUsingFilters()
TestCases can have filters set at the Test Case level (global).
|
static java.util.List<TestNode> |
loadNodes(org.w3c.dom.Element testCaseNode,
TestCase test)
Called during TestCase object initialization to load all nodes in the
XML test case document into a Hashtable
|
static TestNode |
makeTestNode(java.lang.String name,
java.lang.String type)
Method called during TestCase construction.
|
static TestNode |
nodeFactory(TestCase test,
org.w3c.dom.Element node)
Used to construct a specific TestNode object
|
void |
prepare(TestCase test)
This method gives the test node the ability to do one-time initialization of
its logic just before the TestExec(s) are created and the testing commences.
|
protected boolean |
processHit(TestExec ts,
boolean hit,
com.itko.lisa.test.Assertion assertion) |
protected void |
processThinkTime(TestExec ts,
java.lang.String thinkSpec,
java.lang.String logShort,
java.lang.String logLong,
boolean quiet) |
static void |
raiseNodeFailedEvent(TestExec ts,
java.lang.String nextNode,
java.lang.String shortDesc,
java.lang.String longDesc,
java.lang.Throwable throwable)
This method is to be used by all steps to raise nodeFailed events.
|
static void |
raiseNodeFailedEvent(TestExec ts,
java.lang.String nextNode,
java.lang.String shortDesc,
java.lang.String longDesc,
java.lang.Throwable throwable,
boolean parseProps)
This method is to be used by all steps to raise nodeFailed events.
|
protected void |
reconstituteResponse(TestExec ts)
This method should be overridden by respective test node to perform some operation after executing
node on remote simulator.
|
protected boolean |
savePortableAsset(com.itko.lisa.asset.AssetContext assetContext,
com.itko.lisa.asset.Asset<?> asset) |
void |
setDocumentation(java.lang.String doc)
Simple text field for providing extended documentation of the node.
|
void |
setElseNode(java.lang.String n)
Sets the next node.
|
void |
setElseNode(TestNode node) |
void |
setExtraInfo(ParameterList extras)
This method is used to set any extra information for public consumption from a VSE for
this step.
|
void |
setGraphX(int graphx) |
void |
setGraphY(int graphy) |
void |
setLog(java.lang.String log)
Allows us to set the log message for this TestNode
|
void |
setName(java.lang.String name)
Sets the name of this TestNode
|
void |
setQuiet(boolean state)
A quiet node does not report any events as it executes that would be considered for something like
total nodes executed, execution time, and etc.
|
void |
setRemoteServer(java.lang.String server)
Used to tell the test case execution framework to remotely stage and execute this
particular node.
|
void |
setTest(TestCase test) |
void |
setThink(java.lang.String t)
This method takes a string in the form "from-to" or just "thislong", and will
parse it to set the TestNode's think from and think to attributes appropriately.
|
void |
setUid(java.lang.String uid) |
void |
setUsingFilters(boolean onOff)
A way to turn off or on the execution of global filters.
|
protected void |
setVersion(java.lang.String v)
Sets the version number of the node
|
java.lang.String |
toString()
Generates a String that can be used to give you an idea about this Node.
|
protected void |
updateAssetURL(com.itko.lisa.asset.AssetContext assetContext,
com.itko.lisa.asset.Asset asset,
com.itko.lisa.asset.AssetVisitor visitor) |
static boolean |
writeBaseXML(java.io.PrintWriter ps,
java.lang.String name,
java.lang.String log,
java.lang.String type,
int version,
java.lang.String uid,
java.lang.String thinkSpec,
boolean useFilters,
boolean quiet,
java.lang.String nextNode,
java.lang.String docs,
java.lang.String remoteServer,
java.util.List<com.itko.lisa.model.IWriteXML> filters,
java.util.List<java.lang.String> dataSets,
java.util.List<com.itko.lisa.model.IWriteXML> assertList,
ParameterList extras) |
static void |
writeFinalXML(java.io.PrintWriter ps) |
void |
writeSubXML(java.io.PrintWriter pw)
Most models will want to override this method so that you can provide programmatic model
creation support.
|
void |
writeXML(java.io.PrintWriter pw) |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getTypeName
public static final java.lang.String copyrightNotice
protected static org.apache.commons.logging.Log cat
protected static org.apache.commons.logging.Log stepLogger
public static final java.lang.String DOC_TAG
public static final java.lang.String GRAPH_X_TAG
public static final java.lang.String GRAPH_Y_TAG
public static final java.lang.String REMOTE_SERVER_TAG
public static final java.lang.String EXTRAS_TAG
protected int ordinal
protected java.lang.String name
protected java.lang.String log
protected boolean quiet
protected java.lang.String docs
protected java.lang.String type
protected java.lang.String elseNode
protected boolean useFilters
protected int version
public static java.lang.String DEF_THINK_SPEC
public static java.lang.String DEF_SYS_THINK_SPEC
protected java.lang.String thinkSpec
protected java.lang.String remoteServer
protected TestCase test
public static final int NUM_FILTERS_WARNING_THRESHOLD
public static final int NUM_ASSERTS_WARNING_THRESHOLD
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface CloneImplemented
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String getName()
getName
in class com.itko.util.test.TestNode
public java.lang.String getTestCaseName()
getTestCaseName
in class com.itko.util.test.TestNode
public void setName(java.lang.String name)
name
- - the new name of the TestNodepublic java.lang.String getPK()
public int getOrdinal()
public java.lang.String getLog()
public void setLog(java.lang.String log)
log
- - the new log messagepublic java.lang.String getType()
public boolean isEndNode()
public TestCase getTest()
public void setTest(TestCase test)
public boolean isQuiet()
public void setQuiet(boolean state)
public boolean isQuietTheDefault()
public java.lang.String getElseNode()
public void setElseNode(java.lang.String n)
n
- - the new next node namepublic void setElseNode(TestNode node)
public boolean isUsingFilters()
public void setUsingFilters(boolean onOff)
onOff
- to set whether global filters will execute with this Node@Deprecated public java.util.Vector<com.itko.lisa.test.Assertion> getCheckResults()
public java.util.List<com.itko.lisa.test.Assertion> getAssertions()
public java.lang.String getThink()
public int getVersion()
protected void setVersion(java.lang.String v)
v
- public java.lang.String getUid()
public void setUid(java.lang.String uid)
public boolean canDeployToCS()
true
if this test node can be deployed to a coordinator server
or false
if not.public boolean canDeployToVSE()
true
if this test node can be deployed to a virtual
environment or false
if not.public ParameterList getExtraInfo()
null
.public void setExtraInfo(ParameterList extras)
extras
- the new collection of interesting information or null
.public static void raiseNodeFailedEvent(TestExec ts, java.lang.String nextNode, java.lang.String shortDesc, java.lang.String longDesc, java.lang.Throwable throwable)
ts
- - The current TestExecnextNode
- - The next node to fire. usually from the onExNext() method.shortDesc
- - The short dec in LISA eventslongDesc
- - The longer Description in LISA eventsthrowable
- - Can be null if you do not have an exception/Throwable to pass here.public static void raiseNodeFailedEvent(TestExec ts, java.lang.String nextNode, java.lang.String shortDesc, java.lang.String longDesc, java.lang.Throwable throwable, boolean parseProps)
ts
- - The current TestExecnextNode
- - The next node to fire. usually from the onExNext() method.shortDesc
- - The short dec in LISA eventslongDesc
- - The longer Description in LISA eventsthrowable
- - Can be null if you do not have an exception/Throwable to pass here.parseProps
- - Do we parse props? The default is true.public void setThink(java.lang.String t)
t
- - the string to parsepublic int getGraphX()
public void setGraphX(int graphx)
public int getGraphY()
public void setGraphY(int graphy)
public void setRemoteServer(java.lang.String server)
server
- is the RMI server name of the SimulatorServer that should run this guySimulatorServer
public java.lang.String getRemoteServer()
SimulatorServer
public java.util.Vector<FilterInterface> getFilters()
FilterInterface
public java.util.List<FilterInterface> getFiltersAsList()
public java.util.Vector<java.lang.String> getRandLists()
RandSet
public java.util.Vector<java.lang.String> getDataSets()
DataSet
public java.lang.String getDocumentation()
public void setDocumentation(java.lang.String doc)
public abstract void initialize(TestCase test, org.w3c.dom.Element e) throws TestDefException
TestDefException
prepare(TestCase)
public void writeSubXML(java.io.PrintWriter pw)
pw
- the stream we are writing tojava.lang.IllegalArgumentException
- if the node does not support serialization to XMLprotected abstract void execute(TestExec ts) throws TestRunException
State Management
State is a big thing -- that's the dynamic data part of the test. You get access to all of LISA's properties in this test via calls in TestExec, like TestExec.getStateValue(). You can also save state as a side affect of execution with TestExec.setStateValue(). When you need your TestNode to convert strings with {{ notation into their current value, use TestExec.parseInState(). Are you seeing how important TestExec is?TestRunException
- -Only use the TestRunException as a way to report
testcase or LISA type errors, NOT errors in the system under test.
For that report the errors into the log and set the next node as a the
Abend node. The reason is that TestRunExceptions will halt the test and
stop everything in its tracks. So if you are that off in the weeds, great.
If not, then resist the urge.TestExec
,
TestExec.raiseEvent(int, String, String)
,
TestExec.setLastResponse(Object)
public void prepare(TestCase test) throws LisaException
TestRunException
LisaException
public void destroy(TestExec ts)
ts
- the TestExec that we're ending (why we're being destroyed)public void executeNode(TestExec ts) throws TestRunException
ts
- - the test execution environment object for this testTestRunException
protected boolean processHit(TestExec ts, boolean hit, com.itko.lisa.test.Assertion assertion)
protected void processThinkTime(TestExec ts, java.lang.String thinkSpec, java.lang.String logShort, java.lang.String logLong, boolean quiet) throws java.lang.InterruptedException
java.lang.InterruptedException
public long determineThinkTimeDelay(TestExec ts, java.lang.String thinkSpec)
ts
- the current test exec.thinkSpec
- the think time spec to use.public long compensateForLastResponseTime(TestExec ts, long candidateMillis)
candidateMillis
- public long calcThinkTimeFromSpec(TestExec ts, java.lang.String thinkSpec)
public java.lang.String toString()
toString
in class java.lang.Object
public static TestNode makeTestNode(java.lang.String name, java.lang.String type) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
name
- type
- java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
public static java.util.List<TestNode> loadNodes(org.w3c.dom.Element testCaseNode, TestCase test) throws TestDefException
testCaseNode
- XML Element
containing Node objects.test
- The test case object.Map
(name -> test node) of test nodes loaded from XML.TestDefException
- If a test node object can't be constructed from XML.public static TestNode nodeFactory(TestCase test, org.w3c.dom.Element node) throws TestDefException
TestDefException
protected void reconstituteResponse(TestExec ts) throws java.lang.Exception
ts
- - the test execution environment object for this testjava.lang.Exception
protected java.lang.String getStepTypeForXML()
public final void writeXML(java.io.PrintWriter pw)
writeXML
in interface com.itko.lisa.model.IWriteXML
public static boolean writeBaseXML(java.io.PrintWriter ps, java.lang.String name, java.lang.String log, java.lang.String type, int version, java.lang.String uid, java.lang.String thinkSpec, boolean useFilters, boolean quiet, java.lang.String nextNode, java.lang.String docs, java.lang.String remoteServer, java.util.List<com.itko.lisa.model.IWriteXML> filters, java.util.List<java.lang.String> dataSets, java.util.List<com.itko.lisa.model.IWriteXML> assertList, ParameterList extras)
public static void writeFinalXML(java.io.PrintWriter ps)
public boolean isRestrictedForCreateAndCopyPasteInLISA()
public boolean isNodeFailType()
public boolean isNodeEndType()
public java.lang.String generateName()
generateName
in interface com.itko.lisa.test.NameGenerator
public boolean isGeneratedName(java.lang.String name)
isGeneratedName
in interface com.itko.lisa.test.NameGenerator
public void exportAssets(com.itko.lisa.asset.AssetContext assetContext, TestExec testExec)
protected java.lang.String generateDeterministicURL(com.itko.lisa.asset.AssetContext context, com.itko.lisa.asset.Asset asset)
protected void updateAssetURL(com.itko.lisa.asset.AssetContext assetContext, com.itko.lisa.asset.Asset asset, com.itko.lisa.asset.AssetVisitor visitor)
protected boolean savePortableAsset(com.itko.lisa.asset.AssetContext assetContext, com.itko.lisa.asset.Asset<?> asset)
Copyright © 1998-2014 CA, Inc. All Rights Reserved.