com.newisys.ova
Class OVAAssert

java.lang.Object
  extended by com.newisys.ova.OVAAssert

public final class OVAAssert
extends Object

Class representing an OVA assert. Includes querying the assert for various properties (name, etc) and performing various actions on the the assert.


Method Summary
 void addListener(OVAAssertEventType eventType, OVAAssertCallback handler)
          Adds a handler that will be called when the specified event type occurs for this assert.
 void addListener(Set<OVAAssertEventType> eventTypeSet, OVAAssertCallback handler)
          Adds a handler that will be called when any of the event types in eventTypeSet occur for this assert.
 void disableCount(OVAAssertEventType eventType)
          Disables counting of the specified event for this assert.
 void doAction(OVAAssertAction action, long attemptID)
          Performs the requested action on this assert.
 void enableCount(OVAAssertEventType eventType)
          Enables counting of the specified event for this assert.
 int getCategory()
          Returns the category of this assert.
 long getCount(OVAAssertEventType eventType)
          Returns the number of times the specified event type has occurred for this assert.
 OVAExprType getExprType()
          Returns the expression type of this assert.
 String getName()
          Returns the name of this assert.
 String getScopeName()
          Returns the scope name of this assert.
 int getSeverity()
          Returns the severity of this assert.
 String getUserMessage()
          Returns the user message of this assert.
 int hashCode()
          
 void removeListener(OVAAssertEventType eventType, OVAAssertCallback handler)
          Removes the specified callback handler for the specified event type.
 void setCategory(int category)
          Sets the category of this assert.
 void setSeverity(int severity)
          Sets the severity of this assert.
 void setUserMessage(String msg)
          Sets the user message of this assert.
 String toString()
          
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

addListener

public void addListener(OVAAssertEventType eventType,
                        OVAAssertCallback handler)
Adds a handler that will be called when the specified event type occurs for this assert.

Parameters:
eventType - the OVA event type which will trigger handler to be called
handler - the callback handler to be run when the specified event type occurs for this assert

addListener

public void addListener(Set<OVAAssertEventType> eventTypeSet,
                        OVAAssertCallback handler)
Adds a handler that will be called when any of the event types in eventTypeSet occur for this assert.

Parameters:
eventTypeSet - a Set of OVAAssertEventType objects which will trigger handler to be called
handler - the callback handler to be run when any of the specified event types occur for this assert

removeListener

public void removeListener(OVAAssertEventType eventType,
                           OVAAssertCallback handler)
Removes the specified callback handler for the specified event type. If there are other handlers associated with eventType, they will not be affected. Likewise, if handler is associated with event types other than eventType those callbacks will not be affected.

Parameters:
eventType - the type of event on which to stop receiving callbacks
handler - the callback handler that should be removed

enableCount

public void enableCount(OVAAssertEventType eventType)
Enables counting of the specified event for this assert. The count can be accessed by calling getCount(com.newisys.ova.OVAAssertEventType). This method resets the count to zero before enabling counting.

Only OVAAssertEventType.AttemptSuccess and OVAAssertEventType.AttemptFailure have counting support.

If counting is already enabled on this OVAAssert for the specified event type, the count is reset, but stays enabled.

Parameters:
eventType - the type of event being counted
Throws:
OVAException - if eventType is not AttemptSucces or AttemptFailure

disableCount

public void disableCount(OVAAssertEventType eventType)
Disables counting of the specified event for this assert. The count will be available via getCount(com.newisys.ova.OVAAssertEventType).

Only OVAAssertEventType.AttemptSuccess and OVAAssertEventType.AttemptFailure have counting support.

Parameters:
eventType - the type of event being counted
Throws:
OVAException - if eventType is not AttemptSucces or AttemptFailure

getCount

public long getCount(OVAAssertEventType eventType)
Returns the number of times the specified event type has occurred for this assert. If counting has not been enabled (via enableCount(com.newisys.ova.OVAAssertEventType)), this method will throw an OVAException.

Only OVAAssertEventType.AttemptSuccess and OVAAssertEventType.AttemptFailure have counting support.

Parameters:
eventType - the type of event being counted
Returns:
the number of times an event of type eventType has occurred for this assert since enableCount was called
Throws:
OVAException - if counting has not been enabled or if eventType is not AttemptSucces or AttemptFailure

doAction

public void doAction(OVAAssertAction action,
                     long attemptID)
Performs the requested action on this assert. Some actions require an attempt identifier, in which case attemptID should be the appropriate identifier. For actions that do not require an attempt identifier, attemptID should be zero.

Parameters:
action - the action to be performed on this assert
attemptID - the attempt identifier if action requires one, or zero if it does not

getName

public String getName()
Returns the name of this assert. For example, the assert
main.foo.bar.baz.assert1.cb
has a name of "assert1.cb".

Returns:
the name of this assert

getScopeName

public String getScopeName()
Returns the scope name of this assert. For example, the assert
main.foo.bar.baz.assert1.cb
has a scope name of "main.foo.bar.baz".

Returns:
the scope name of this assert

getExprType

public OVAExprType getExprType()
Returns the expression type of this assert.

Returns:
the expression type of this assert

getSeverity

public int getSeverity()
Returns the severity of this assert. Severity is a value from 0 to 0xFF. If no severity has been specified, 0 is returned.

Returns:
the severity of this assert

getCategory

public int getCategory()
Returns the category of this assert. Category is a value from 0 to 0xFFFFFF. If no category has been specified, 0 is returned.

Returns:
the category of this assert

getUserMessage

public String getUserMessage()
Returns the user message of this assert. If no user message has been specified, the empty string is returned.

Returns:
the user message of this assert

setSeverity

public void setSeverity(int severity)
Sets the severity of this assert. Severity is a value from 0 to 0xFF.

Parameters:
severity - the severity of this assert
Throws:
IllegalArgumentException - if severity is outside of the range 0 to 0xFF

setCategory

public void setCategory(int category)
Sets the category of this assert. Category is a value from 0 to 0xFFFFFF.

Parameters:
category - the category of this assert
Throws:
IllegalArgumentException - if category is outside of the range 0 to 0xFFFFFF

setUserMessage

public void setUserMessage(String msg)
Sets the user message of this assert. null messages are not allowed.

Parameters:
msg - the message to associate with this assert
Throws:
IllegalArgumentException - if msg is null

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object