cdx.scorebot.net.tests
Class TestEvent

java.lang.Object
  extended by cdx.scorebot.util.Event
      extended by cdx.scorebot.net.tests.TestEvent
All Implemented Interfaces:
java.io.Serializable

public class TestEvent
extends Event
implements java.io.Serializable

contains info about a test and its results for a single run

Author:
David Underhill
See Also:
Serialized Form

Nested Class Summary
 class TestEvent.ResultInfoPair
          stores results from the test and any audits of those results
 
Field Summary
static java.lang.String XML_EXT
          extension for files of this type serialized to XML
 
Constructor Summary
TestEvent(TestItem ti, Configuration config)
          Creates a TestEvent to store the results from the Test in TestItem ti
 
Method Summary
 boolean equals(java.lang.Object o)
           
 Configuration getConfig()
          gets the configuration of the test which generated this event
 long getDuration()
          Gets the amount of time this test took to run
 java.lang.String getExplanation()
          gets an explanation about what happened
 java.util.HashMap<java.lang.String,TestEvent.ResultInfoPair> getResults()
          gets the results (and audits) of this test
 java.util.Vector<TestEvent.ResultInfoPair> getResultsWithNames()
          gets the results (and audits) of this test and sets the name of each result
 TestItem getTestItem()
          gets the TestItem this event is for
 Timestamp getTimeCompleted()
          gets the ending timestamp
 Timestamp getTimeReported()
          gets the time the event was reported
 Timestamp getTimeStarted()
          gets the starting timestamp
 int hashCode()
          this is computed by summing (as a Long) the hashCode of every option name, option current value, result name, result value, test item name, and current time as a long and then finding the hashCode of that Long sum.
 void setExplanation(java.lang.String explanation)
          sets the explanation about what happened
 void setResult(java.lang.String propertyName, java.lang.Object result)
          Adds a result to the TestEvent
 void setResultValues(java.util.Vector<TestEvent.ResultInfoPair> res)
          sets the results (and audits) of this test (the ResultInfoPair's must have their name set)
 void setTimeCompleted()
          sets the end timestamp to the current time
 void setTimeReported(Timestamp time)
          sets the time the event was reported
 java.lang.String toString()
           
 
Methods inherited from class cdx.scorebot.util.Event
getFilename, getTimeGenerated, isReported, setFilename, setTimeGenerated
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_EXT

public static final java.lang.String XML_EXT
extension for files of this type serialized to XML

See Also:
Constant Field Values
Constructor Detail

TestEvent

public TestEvent(TestItem ti,
                 Configuration config)
Creates a TestEvent to store the results from the Test in TestItem ti

Parameters:
ti - the TestItem this event is for
config - the options the test was configured with
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

setResult

public void setResult(java.lang.String propertyName,
                      java.lang.Object result)
Adds a result to the TestEvent

Parameters:
propertyName - name of the property this result is for
result - the result value

getDuration

public long getDuration()
Gets the amount of time this test took to run

Returns:
the duration of the test in milliseconds (or -1 if the test has not yet completed)

setTimeCompleted

public void setTimeCompleted()
sets the end timestamp to the current time


hashCode

public int hashCode()
this is computed by summing (as a Long) the hashCode of every option name, option current value, result name, result value, test item name, and current time as a long and then finding the hashCode of that Long sum.

Overrides:
hashCode in class java.lang.Object

getConfig

public Configuration getConfig()
gets the configuration of the test which generated this event


getExplanation

public java.lang.String getExplanation()
gets an explanation about what happened


setExplanation

public void setExplanation(java.lang.String explanation)
sets the explanation about what happened


getTimeStarted

public Timestamp getTimeStarted()
gets the starting timestamp


getTimeCompleted

public Timestamp getTimeCompleted()
gets the ending timestamp


getTimeReported

public Timestamp getTimeReported()
gets the time the event was reported

Specified by:
getTimeReported in class Event
Returns:
null if this TestEvent has not been reported yet

setTimeReported

public void setTimeReported(Timestamp time)
sets the time the event was reported

Specified by:
setTimeReported in class Event

getTestItem

public TestItem getTestItem()
gets the TestItem this event is for


getResults

public java.util.HashMap<java.lang.String,TestEvent.ResultInfoPair> getResults()
gets the results (and audits) of this test


getResultsWithNames

public java.util.Vector<TestEvent.ResultInfoPair> getResultsWithNames()
gets the results (and audits) of this test and sets the name of each result


setResultValues

public void setResultValues(java.util.Vector<TestEvent.ResultInfoPair> res)
sets the results (and audits) of this test (the ResultInfoPair's must have their name set)


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object