net.sourceforge.groboutils.autodoc.v1.testserver
Class DefaultMonitor

java.lang.Object
  extended bynet.sourceforge.groboutils.autodoc.v1.testserver.DefaultMonitor
All Implemented Interfaces:
Monitor
Direct Known Subclasses:
ITFMonitor

public class DefaultMonitor
extends java.lang.Object
implements Monitor

This implemenation of Monitor uses a Hashtable to store the test data.

Since:
March 17, 2002
Version:
$Date: 2003/05/27 13:30:16 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Constructor Summary
DefaultMonitor(Server s, TestDataFactory f)
          Constructor for a Monitor requiring a reference to the Server which will receive the completed TestData structures, and a reference to a factory for creating new TestData instances for the particular framework this Monitor belongs to.
 
Method Summary
 void addTestData(TestInfo info)
          Adds a new TestData instance related to the given TestInfo.
protected  void assertNotNull(TestData td)
          Ensures that td is not null.
protected  void assertNotNull(TestInfo info)
          Ensures that info is not null.
protected  TestData createTestData(TestInfo info)
          Creates a new TestData instance for the info object through the factory.
 TestData getTestData(TestInfo info)
          Retrieves the data associated with the given TestInfo, as was created through addTestData( TestInfo ).
protected  TestData retrieveTestData(TestInfo info)
          Retrieves the registered TestData instance for the info.
 void sendTestData(TestInfo info)
          Sends the TestData associated with info to the inner server, and removes the data from the inner cache.
protected  void sendTestDataToServer(TestData td)
          Sends off the test data to the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMonitor

public DefaultMonitor(Server s,
                      TestDataFactory f)
Constructor for a Monitor requiring a reference to the Server which will receive the completed TestData structures, and a reference to a factory for creating new TestData instances for the particular framework this Monitor belongs to.

Parameters:
s - the server to receive completed TestData entities. This cannot be null.
f - the factory in charge of creating new TestData entities. This cannot be null.
Throws:
java.lang.IllegalArgumentException - if s or f is null.
Method Detail

addTestData

public void addTestData(TestInfo info)
Adds a new TestData instance related to the given TestInfo. If there already is a TestData for the given TestInfo, then an exception is thrown.

Specified by:
addTestData in interface Monitor
Parameters:
info - the unique test identifier to create a new TestData instance for.
Throws:
java.lang.IllegalStateException - if info is already been added without having been sent.
java.lang.IllegalArgumentException - if info is null.

getTestData

public TestData getTestData(TestInfo info)
Retrieves the data associated with the given TestInfo, as was created through addTestData( TestInfo ). If the info was never passed to the add method, then an exception is thrown.

Specified by:
getTestData in interface Monitor
Parameters:
info - the unique test identifier
Returns:
the data for the given info.
Throws:
java.lang.IllegalStateException - if info has not been added, or has been removed through the send call.
java.lang.IllegalArgumentException - if info is null.

sendTestData

public void sendTestData(TestInfo info)
Sends the TestData associated with info to the inner server, and removes the data from the inner cache. If the info has not been added, then an exception is thrown.

Specified by:
sendTestData in interface Monitor
Parameters:
info - the unique test identifier
Throws:
java.lang.IllegalStateException - if info has not been added, or has been removed through the send call.
java.lang.IllegalArgumentException - if info is null.

createTestData

protected TestData createTestData(TestInfo info)
Creates a new TestData instance for the info object through the factory. This is guaranteed to never return null.

Parameters:
info - the unique test identifier
Throws:
java.lang.IllegalStateException - if the factory returns null.

retrieveTestData

protected TestData retrieveTestData(TestInfo info)
Retrieves the registered TestData instance for the info. This may return null.

Parameters:
info - the unique test identifier

sendTestDataToServer

protected void sendTestDataToServer(TestData td)
Sends off the test data to the server.


assertNotNull

protected void assertNotNull(TestInfo info)
Ensures that info is not null.


assertNotNull

protected void assertNotNull(TestData td)
Ensures that td is not null.



Copyright © 2001-2003 by The GroboUtils Project