Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.jmeter.assertions
Class XPathAssertion  view XPathAssertion download XPathAssertion.java

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.assertions.XPathAssertion
All Implemented Interfaces:
Assertion, java.lang.Cloneable, java.io.Serializable, org.apache.jmeter.testelement.TestElement

public class XPathAssertion
extends org.apache.jmeter.testelement.AbstractTestElement
implements java.io.Serializable, Assertion

Checks if the result is a well-formed XML content and whether it matches an XPath author Justin Spears


Nested Class Summary
static class XPathAssertion.XPathAssertionTest
           
 
Field Summary
static java.lang.String DEFAULT_XPATH
           
private static Logger log
           
private static java.lang.String NAMESPACE_KEY
           
private static java.lang.String NEGATE_KEY
           
private static java.lang.String TOLERANT_KEY
           
private static java.lang.String VALIDATE_KEY
           
private static java.lang.String WHITESPACE_KEY
           
private static java.lang.String XPATH_KEY
           
 
Fields inherited from class org.apache.jmeter.testelement.AbstractTestElement
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
XPathAssertion()
           
 
Method Summary
private  java.lang.String getPropertyAsString(java.lang.String key, java.lang.String defaultValue)
          Get a Property or return the default string
 AssertionResult getResult(org.apache.jmeter.samplers.SampleResult response)
          Returns the result of the Assertion.
 java.lang.String getXPathString()
          Get The XPath String that will be used in matching the document
 boolean isNamespace()
          Is this namespace aware?
 boolean isNegated()
          Negate the XPath test, that is return true if something is not found.
 boolean isTolerant()
          Is this using tolerant mode?
 boolean isValidating()
          Is this validating
 boolean isWhitespace()
          Is this whitepsace ignored.
 void setNamespace(boolean namespace)
          Set whether this is namespace aware
 void setNegated(boolean negate)
           
 void setTolerant(boolean tolerant)
          Set tolerant mode if required
 void setValidating(boolean validate)
          Set use validation
 void setWhitespace(boolean whitespace)
          Set whether to ignore element whitespace
 void setXPathString(java.lang.String xpath)
          Set the XPath String this will be used as an xpath
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, nextIsNull, propertyIterator, recoverRunningVersion, removeProperty, setName, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Logger log

XPATH_KEY

private static final java.lang.String XPATH_KEY
See Also:
Constant Field Values

WHITESPACE_KEY

private static final java.lang.String WHITESPACE_KEY
See Also:
Constant Field Values

VALIDATE_KEY

private static final java.lang.String VALIDATE_KEY
See Also:
Constant Field Values

TOLERANT_KEY

private static final java.lang.String TOLERANT_KEY
See Also:
Constant Field Values

NEGATE_KEY

private static final java.lang.String NEGATE_KEY
See Also:
Constant Field Values

NAMESPACE_KEY

private static final java.lang.String NAMESPACE_KEY
See Also:
Constant Field Values

DEFAULT_XPATH

public static final java.lang.String DEFAULT_XPATH
See Also:
Constant Field Values
Constructor Detail

XPathAssertion

public XPathAssertion()
Method Detail

getResult

public AssertionResult getResult(org.apache.jmeter.samplers.SampleResult response)
Returns the result of the Assertion. Checks if the result is well-formed XML, and that the XPath expression is matched (or not, as the case may be)

Specified by:
getResult in interface Assertion

getXPathString

public java.lang.String getXPathString()
Get The XPath String that will be used in matching the document


getPropertyAsString

private java.lang.String getPropertyAsString(java.lang.String key,
                                             java.lang.String defaultValue)
Get a Property or return the default string


setXPathString

public void setXPathString(java.lang.String xpath)
Set the XPath String this will be used as an xpath


setWhitespace

public void setWhitespace(boolean whitespace)
Set whether to ignore element whitespace


setValidating

public void setValidating(boolean validate)
Set use validation


setNamespace

public void setNamespace(boolean namespace)
Set whether this is namespace aware


setTolerant

public void setTolerant(boolean tolerant)
Set tolerant mode if required


setNegated

public void setNegated(boolean negate)

isWhitespace

public boolean isWhitespace()
Is this whitepsace ignored.


isValidating

public boolean isValidating()
Is this validating


isNamespace

public boolean isNamespace()
Is this namespace aware?


isTolerant

public boolean isTolerant()
Is this using tolerant mode?


isNegated

public boolean isNegated()
Negate the XPath test, that is return true if something is not found.