Package step.core.artefacts.handlers
Class ArtefactHandler<ARTEFACT extends AbstractArtefact,REPORT_NODE extends ReportNode>
- java.lang.Object
-
- step.core.artefacts.handlers.ArtefactHandler<ARTEFACT,REPORT_NODE>
-
- Direct Known Subclasses:
AbstractSessionArtefactHandler
,AssertHandler
,CallFunctionHandler
,CallPlanHandler
,CaseHandler
,CheckArtefactHandler
,CheckHandler
,DataSetHandler
,EchoHandler
,ExportHandler
,FunctionGroupHandler
,IfBlockHandler
,PlaceholderHandler
,RetryIfFailsHandler
,ReturnHandler
,ScriptHandler
,SequenceHandler
,SetHandler
,SleepHandler
,StreamingArtefactHandler
,SwitchHandler
,SynchronizedHandler
,TestScenarioHandler
,TestSetHandler
,ThreadGroupHandler
,WhileHandler
public abstract class ArtefactHandler<ARTEFACT extends AbstractArtefact,REPORT_NODE extends ReportNode> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutionContext
context
static java.lang.String
FILE_VARIABLE_PREFIX
protected static org.slf4j.Logger
logger
static java.lang.String
TEC_EXECUTION_REPORTNODES_PERSISTAFTER
static java.lang.String
TEC_EXECUTION_REPORTNODES_PERSISTBEFORE
static java.lang.String
TEC_EXECUTION_REPORTNODES_PERSISTONLYNONPASSED
-
Constructor Summary
Constructors Constructor Description ArtefactHandler()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract REPORT_NODE
createReportNode_(ReportNode parentReportNode, ARTEFACT artefact)
Creates theReportNode
corresponding to the provided artefactvoid
createReportSkeleton(ReportNode parentReportNode, ARTEFACT artefact, java.util.Map<java.lang.String,java.lang.Object> newVariables)
protected abstract void
createReportSkeleton_(REPORT_NODE parentNode, ARTEFACT testArtefact)
protected <T extends AbstractArtefact>
TcreateWorkArtefact(java.lang.Class<T> artefactClass, AbstractArtefact parentArtefact, java.lang.String name)
protected <T extends AbstractArtefact>
TcreateWorkArtefact(java.lang.Class<T> artefactClass, AbstractArtefact parentArtefact, java.lang.String name, boolean copyChildren)
protected <T extends AbstractArtefact>
TcreateWorkArtefact(java.lang.Class<T> artefactClass, AbstractArtefact parentArtefact, java.lang.String name, boolean copyChildren, boolean persistNode)
protected void
delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode)
protected void
delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode, java.util.Map<java.lang.String,java.lang.Object> newVariables)
protected ReportNode
delegateExecute(AbstractArtefact artefact, ReportNode parentNode)
protected ReportNode
delegateExecute(AbstractArtefact artefact, ReportNode parentNode, java.util.Map<java.lang.String,java.lang.Object> newVariables)
static java.util.List<AbstractArtefact>
excludePropertyChildren(java.util.List<AbstractArtefact> children)
ReportNode
execute(REPORT_NODE parentReportNode, ARTEFACT artefact, java.util.Map<java.lang.String,java.lang.Object> newVariables)
protected abstract void
execute_(REPORT_NODE reportNode, ARTEFACT artefact)
Execute the provided artefact and report the execution to the provided report nodeprotected void
fail(ReportNode node, java.lang.String error)
protected void
failWithException(ReportNode result, java.lang.String errorMsg, java.lang.Throwable e, boolean generateAttachment)
protected void
failWithException(ReportNode result, java.lang.Throwable e)
protected void
failWithException(ReportNode result, java.lang.Throwable e, boolean generateAttachment)
static java.util.List<AbstractArtefact>
filterPropertyChildren(java.util.List<AbstractArtefact> children)
protected java.util.Map<java.lang.String,java.lang.Object>
getBindings()
java.util.List<AbstractArtefact>
getChildren(AbstractArtefact artefact)
static java.util.List<AbstractArtefact>
getChildren(AbstractArtefact artefact, ExecutionContext context)
void
init(ExecutionContext context)
void
initProperties(ReportNode parentReportNode, ARTEFACT artefact)
Before callingexecute_(ReportNode, AbstractArtefact)
for an artefact node N this method is called for each child of N which returns true onAbstractArtefact.isPropertyArefact()
.protected boolean
isInSession()
protected void
releaseTokens()
protected void
removeReportNode(ReportNode node)
-
-
-
Field Detail
-
logger
protected static org.slf4j.Logger logger
-
FILE_VARIABLE_PREFIX
public static final java.lang.String FILE_VARIABLE_PREFIX
- See Also:
- Constant Field Values
-
TEC_EXECUTION_REPORTNODES_PERSISTAFTER
public static final java.lang.String TEC_EXECUTION_REPORTNODES_PERSISTAFTER
- See Also:
- Constant Field Values
-
TEC_EXECUTION_REPORTNODES_PERSISTBEFORE
public static final java.lang.String TEC_EXECUTION_REPORTNODES_PERSISTBEFORE
- See Also:
- Constant Field Values
-
TEC_EXECUTION_REPORTNODES_PERSISTONLYNONPASSED
public static final java.lang.String TEC_EXECUTION_REPORTNODES_PERSISTONLYNONPASSED
- See Also:
- Constant Field Values
-
context
protected ExecutionContext context
-
-
Method Detail
-
init
public void init(ExecutionContext context)
-
createReportSkeleton
public void createReportSkeleton(ReportNode parentReportNode, ARTEFACT artefact, java.util.Map<java.lang.String,java.lang.Object> newVariables)
-
createReportSkeleton_
protected abstract void createReportSkeleton_(REPORT_NODE parentNode, ARTEFACT testArtefact)
-
execute
public ReportNode execute(REPORT_NODE parentReportNode, ARTEFACT artefact, java.util.Map<java.lang.String,java.lang.Object> newVariables)
-
initProperties
public void initProperties(ReportNode parentReportNode, ARTEFACT artefact)
Before callingexecute_(ReportNode, AbstractArtefact)
for an artefact node N this method is called for each child of N which returns true onAbstractArtefact.isPropertyArefact()
. This allow initialization of variables or properties before execution- Parameters:
parentReportNode
- the parentReportNode
artefact
- theAbstractArtefact
-
execute_
protected abstract void execute_(REPORT_NODE reportNode, ARTEFACT artefact) throws java.lang.Exception
Execute the provided artefact and report the execution to the provided report node- Parameters:
reportNode
- theReportNode
corresponding to the artefactartefact
- theAbstractArtefact
to be executed- Throws:
java.lang.Exception
-
delegateCreateReportSkeleton
protected void delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode)
-
delegateCreateReportSkeleton
protected void delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode, java.util.Map<java.lang.String,java.lang.Object> newVariables)
-
delegateExecute
protected ReportNode delegateExecute(AbstractArtefact artefact, ReportNode parentNode)
-
delegateExecute
protected ReportNode delegateExecute(AbstractArtefact artefact, ReportNode parentNode, java.util.Map<java.lang.String,java.lang.Object> newVariables)
-
getBindings
protected java.util.Map<java.lang.String,java.lang.Object> getBindings()
-
removeReportNode
protected void removeReportNode(ReportNode node)
-
createReportNode_
protected abstract REPORT_NODE createReportNode_(ReportNode parentReportNode, ARTEFACT artefact)
Creates theReportNode
corresponding to the provided artefact- Parameters:
parentReportNode
- the parentReportNode
artefact
- the artefact to create the node for- Returns:
-
getChildren
public java.util.List<AbstractArtefact> getChildren(AbstractArtefact artefact)
-
getChildren
public static java.util.List<AbstractArtefact> getChildren(AbstractArtefact artefact, ExecutionContext context)
-
filterPropertyChildren
public static java.util.List<AbstractArtefact> filterPropertyChildren(java.util.List<AbstractArtefact> children)
-
excludePropertyChildren
public static java.util.List<AbstractArtefact> excludePropertyChildren(java.util.List<AbstractArtefact> children)
-
createWorkArtefact
protected <T extends AbstractArtefact> T createWorkArtefact(java.lang.Class<T> artefactClass, AbstractArtefact parentArtefact, java.lang.String name)
-
createWorkArtefact
protected <T extends AbstractArtefact> T createWorkArtefact(java.lang.Class<T> artefactClass, AbstractArtefact parentArtefact, java.lang.String name, boolean copyChildren, boolean persistNode)
-
createWorkArtefact
protected <T extends AbstractArtefact> T createWorkArtefact(java.lang.Class<T> artefactClass, AbstractArtefact parentArtefact, java.lang.String name, boolean copyChildren)
-
fail
protected void fail(ReportNode node, java.lang.String error)
-
failWithException
protected void failWithException(ReportNode result, java.lang.Throwable e)
-
failWithException
protected void failWithException(ReportNode result, java.lang.Throwable e, boolean generateAttachment)
-
failWithException
protected void failWithException(ReportNode result, java.lang.String errorMsg, java.lang.Throwable e, boolean generateAttachment)
-
releaseTokens
protected void releaseTokens()
-
isInSession
protected boolean isInSession()
-
-