com.philemonworks.selfdiagnose.check
Class CheckXMLContent
java.lang.Object
com.philemonworks.selfdiagnose.DiagnosticTask
com.philemonworks.selfdiagnose.check.CheckXMLContent
- All Implemented Interfaces:
- Serializable
public class CheckXMLContent
- extends DiagnosticTask
CheckXMLContent is a Diagnostic Task that verifies the presence of an element or attribute
(by evaluating an XPath) and optionally test is against a given pattern.
<checkxmlcontent name="resource.xml" xpath="/root/child" pattern="childvalue" />
<checkxmlcontent url="URL string" xpath="/root/child" pattern="childvalue" />
<checkxmlcontent url="${variable with URL value}" xpath="/root/child" pattern="childvalue" />
Stores the String value found into the (optional) specified variable.
- Author:
- E.M.Micklei
- See Also:
- Serialized Form
Methods inherited from class com.philemonworks.selfdiagnose.DiagnosticTask |
createResult, getComment, getDefaultReportTemplate, getRequestor, getTaskName, getVariableName, hasComment, isReportResults, run, run, setComment, setReportResults, setRequestor, setVariableName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CheckXMLContent
public CheckXMLContent()
getDescription
public String getDescription()
- Specified by:
getDescription
in class DiagnosticTask
- Returns:
- String the description
getName
public String getName()
getPattern
public String getPattern()
getUrl
public String getUrl()
getXpath
public String getXpath()
initializeFromAttributes
public void initializeFromAttributes(Attributes attributes)
- Description copied from class:
DiagnosticTask
- This method is sent from the SelfDiagnoseHandler when a configuration is being processed. Use the passed
attributes to initialize the receiver.
If a variable parameter is passed then store it.
- Overrides:
initializeFromAttributes
in class DiagnosticTask
- Parameters:
attributes
- org.xml.sax.Attributes
run
public void run(ExecutionContext ctx,
DiagnosticTaskResult result)
throws DiagnoseException
- Description copied from class:
DiagnosticTask
- Run the task. If an error is detected then raise a DiagnoseException.
Otherwise use the result object to the report any messages when a run is completed.
- Specified by:
run
in class DiagnosticTask
- Parameters:
ctx
- ExecutionContextresult
- DiagnosticTaskResult
- Throws:
DiagnoseException
setName
public void setName(String name)
setPattern
public void setPattern(String pattern)
setUp
public void setUp(ExecutionContext ctx)
throws DiagnoseException
- Description copied from class:
DiagnosticTask
- Override this method to verify that task parameters are initialized/set correctly.
- Overrides:
setUp
in class DiagnosticTask
- Parameters:
ctx
- ExecutionContext
- Throws:
DiagnoseException
setUrl
public void setUrl(String url)
setXpath
public void setXpath(String xpath)
Copyright © 2012. All Rights Reserved.