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 Object
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutionContext
context
static String
FILE_VARIABLE_PREFIX
protected static org.slf4j.Logger
logger
-
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, Map<String,Object> newVariables)
protected abstract void
createReportSkeleton_(REPORT_NODE parentNode, ARTEFACT testArtefact)
protected <T extends AbstractArtefact>
TcreateWorkArtefact(Class<T> artefactClass, AbstractArtefact parentArtefact, String name)
protected <T extends AbstractArtefact>
TcreateWorkArtefact(Class<T> artefactClass, AbstractArtefact parentArtefact, String name, boolean copyChildren)
protected <T extends AbstractArtefact>
TcreateWorkArtefact(Class<T> artefactClass, AbstractArtefact parentArtefact, String name, boolean copyChildren, boolean persistNode)
protected void
delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode)
protected void
delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode, Map<String,Object> newVariables)
protected ReportNode
delegateExecute(AbstractArtefact artefact, ReportNode parentNode)
protected ReportNode
delegateExecute(AbstractArtefact artefact, ReportNode parentNode, Map<String,Object> newVariables)
static List<AbstractArtefact>
excludePropertyChildren(List<AbstractArtefact> children)
ReportNode
execute(REPORT_NODE parentReportNode, ARTEFACT artefact, Map<String,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, String error)
protected void
failWithException(ReportNode result, String errorMsg, Throwable e, boolean generateAttachment)
protected void
failWithException(ReportNode result, Throwable e)
protected void
failWithException(ReportNode result, Throwable e, boolean generateAttachment)
static List<AbstractArtefact>
filterPropertyChildren(List<AbstractArtefact> children)
protected Map<String,Object>
getBindings()
List<AbstractArtefact>
getChildren(AbstractArtefact artefact)
static 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 String FILE_VARIABLE_PREFIX
-
context
protected ExecutionContext context
-
-
Method Detail
-
init
public void init(ExecutionContext context)
-
createReportSkeleton
public void createReportSkeleton(ReportNode parentReportNode, ARTEFACT artefact, Map<String,Object> newVariables)
-
createReportSkeleton_
protected abstract void createReportSkeleton_(REPORT_NODE parentNode, ARTEFACT testArtefact)
-
execute
public ReportNode execute(REPORT_NODE parentReportNode, ARTEFACT artefact, Map<String,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 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:
Exception
-
delegateCreateReportSkeleton
protected void delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode)
-
delegateCreateReportSkeleton
protected void delegateCreateReportSkeleton(AbstractArtefact artefact, ReportNode parentNode, Map<String,Object> newVariables)
-
delegateExecute
protected ReportNode delegateExecute(AbstractArtefact artefact, ReportNode parentNode)
-
delegateExecute
protected ReportNode delegateExecute(AbstractArtefact artefact, ReportNode parentNode, Map<String,Object> newVariables)
-
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 List<AbstractArtefact> getChildren(AbstractArtefact artefact)
-
getChildren
public static List<AbstractArtefact> getChildren(AbstractArtefact artefact, ExecutionContext context)
-
filterPropertyChildren
public static List<AbstractArtefact> filterPropertyChildren(List<AbstractArtefact> children)
-
excludePropertyChildren
public static List<AbstractArtefact> excludePropertyChildren(List<AbstractArtefact> children)
-
createWorkArtefact
protected <T extends AbstractArtefact> T createWorkArtefact(Class<T> artefactClass, AbstractArtefact parentArtefact, String name)
-
createWorkArtefact
protected <T extends AbstractArtefact> T createWorkArtefact(Class<T> artefactClass, AbstractArtefact parentArtefact, String name, boolean copyChildren, boolean persistNode)
-
createWorkArtefact
protected <T extends AbstractArtefact> T createWorkArtefact(Class<T> artefactClass, AbstractArtefact parentArtefact, String name, boolean copyChildren)
-
fail
protected void fail(ReportNode node, String error)
-
failWithException
protected void failWithException(ReportNode result, Throwable e)
-
failWithException
protected void failWithException(ReportNode result, Throwable e, boolean generateAttachment)
-
failWithException
protected void failWithException(ReportNode result, String errorMsg, Throwable e, boolean generateAttachment)
-
releaseTokens
protected void releaseTokens()
-
isInSession
protected boolean isInSession()
-
-