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

Quick Search    Search Deep

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

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

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

Checks if the results of a Sample matches a particular size.

Version:
$Revision: 1.16 $, $Date: 2005/07/12 20:50:28 $

Field Summary
private  java.lang.String comparatorErrorMessage
           
static int EQUAL
           
static int GREATERTHAN
           
static int GREATERTHANEQUAL
           
static int LESSTHAN
           
static int LESSTHANEQUAL
           
static int NOTEQUAL
           
private static java.lang.String OPERATOR_KEY
           
(package private)  byte[] resultData
           
private static java.lang.String SIZE_KEY
          Key for storing assertion-informations in the jmx-file.
 
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
SizeAssertion()
           
 
Method Summary
private  boolean compareSize(long resultSize)
          Compares the the size of a return result to the set allowed size using a logical comparator set in setLogicalComparator().
 long getAllowedSize()
          Returns the size in bytes to be asserted.
 int getCompOper()
          Returns the operator to be asserted.
 AssertionResult getResult(org.apache.jmeter.samplers.SampleResult response)
          Returns the result of the Assertion.
 void setAllowedSize(long size)
          Set the size that shall be asserted.
 void setCompOper(int operator)
          set the Operator
 
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

comparatorErrorMessage

private java.lang.String comparatorErrorMessage

EQUAL

public static final int EQUAL
See Also:
Constant Field Values

NOTEQUAL

public static final int NOTEQUAL
See Also:
Constant Field Values

GREATERTHAN

public static final int GREATERTHAN
See Also:
Constant Field Values

LESSTHAN

public static final int LESSTHAN
See Also:
Constant Field Values

GREATERTHANEQUAL

public static final int GREATERTHANEQUAL
See Also:
Constant Field Values

LESSTHANEQUAL

public static final int LESSTHANEQUAL
See Also:
Constant Field Values

SIZE_KEY

private static final java.lang.String SIZE_KEY
Key for storing assertion-informations in the jmx-file.

See Also:
Constant Field Values

OPERATOR_KEY

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

resultData

byte[] resultData
Constructor Detail

SizeAssertion

public SizeAssertion()
Method Detail

getResult

public AssertionResult getResult(org.apache.jmeter.samplers.SampleResult response)
Returns the result of the Assertion. Here it checks wether the Sample took to long to be considered successful. If so an AssertionResult containing a FailureMessage will be returned. Otherwise the returned AssertionResult will reflect the success of the Sample.

Specified by:
getResult in interface Assertion

getAllowedSize

public long getAllowedSize()
Returns the size in bytes to be asserted. A duration of 0 indicates this assertion is to be ignored.


setCompOper

public void setCompOper(int operator)
set the Operator


getCompOper

public int getCompOper()
Returns the operator to be asserted. EQUAL = 1, NOTEQUAL = 2 GREATERTHAN = 3,LESSTHAN = 4,GREATERTHANEQUAL = 5,LESSTHANEQUAL = 6


setAllowedSize

public void setAllowedSize(long size)
                    throws java.lang.IllegalArgumentException
Set the size that shall be asserted.


compareSize

private boolean compareSize(long resultSize)
Compares the the size of a return result to the set allowed size using a logical comparator set in setLogicalComparator(). Possible values are: equal, not equal, greater than, less than, greater than eqaul, less than equal, .