org.sourceforge.jemm.client
Class TrackingDatabaseTest

java.lang.Object
  extended by org.sourceforge.jemm.client.TrackingDatabaseTest

public class TrackingDatabaseTest
extends java.lang.Object

Test cases for the TrackingDatabase.

Based on the original work in the refactored ReferenceCleaner.

Author:
Paul Keeble, Rory Graves

Constructor Summary
TrackingDatabaseTest()
           
 
Method Summary
 void acquireReleaseLock()
          Check that acquire/release lock correctly encode the id values.
 void addRemoveListener()
          Test that the add/remove of listeners is correctly passed through.
 void doubleAddListener()
          Test that if a listener is added twice an error is generated.
 void getObjectTest()
           
 void idClearCalled()
          Check that if a reference is cleared by the client, the gc event is captured and the database passes on a refereceCleared event to the lower levels.
 void idStillTrackedNoClearCalled()
          Check that if the returned reference is held by the caller, it is not removed from the active pool.
 void illegalClientSideID()
          Test to ensure that passing in normal ids into the TrackingDatabase by higher levels generates an error.
 void illegalReferenceCleared()
          Test to ensure an exception is thrown if a higher up class calls referenceCleared(), all reference tracking is managed by the TrackingDatabase.
 void illegalTypeReturn()
          Ensure that the underlying database cannot accidently return tracked ids.
 void listenerTest()
          Test that the listener notications are passed through and translated.
 void nullRootGet()
          Check that a getRoot that contains null works correctly.
 void nullRootSet()
          Test that a setRoot(X,null) works correctly.
 void setRootIfNull()
          Check that setRootIfNull correctly encodes and decodes fields
 void setUp()
          Pre-test setup.
 void syncObject()
          Check the synchronizeObject correctly encodes and decodes the request fields.
 void tearDown()
          Post test cleanup
 void typeRequestTest()
          Test that type request/responses are correctly encoded and decoded.
 void validSetRootTest()
          Test that the setRoot call correctly encodes/decodes ids.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackingDatabaseTest

public TrackingDatabaseTest()
Method Detail

setUp

public void setUp()
Pre-test setup.


tearDown

public void tearDown()
Post test cleanup


idClearCalled

public void idClearCalled()
                   throws java.lang.InterruptedException
Check that if a reference is cleared by the client, the gc event is captured and the database passes on a refereceCleared event to the lower levels.

Throws:
java.lang.InterruptedException - On wait error.

illegalClientSideID

public void illegalClientSideID()
Test to ensure that passing in normal ids into the TrackingDatabase by higher levels generates an error.


nullRootGet

public void nullRootGet()
Check that a getRoot that contains null works correctly.


nullRootSet

public void nullRootSet()
Test that a setRoot(X,null) works correctly.


illegalReferenceCleared

public void illegalReferenceCleared()
Test to ensure an exception is thrown if a higher up class calls referenceCleared(), all reference tracking is managed by the TrackingDatabase.


validSetRootTest

public void validSetRootTest()
Test that the setRoot call correctly encodes/decodes ids.


typeRequestTest

public void typeRequestTest()
Test that type request/responses are correctly encoded and decoded.


listenerTest

public void listenerTest()
Test that the listener notications are passed through and translated.


illegalTypeReturn

public void illegalTypeReturn()
Ensure that the underlying database cannot accidently return tracked ids.


getObjectTest

public void getObjectTest()

idStillTrackedNoClearCalled

public void idStillTrackedNoClearCalled()
                                 throws java.lang.InterruptedException
Check that if the returned reference is held by the caller, it is not removed from the active pool.

Throws:
java.lang.InterruptedException - On wait error.

acquireReleaseLock

public void acquireReleaseLock()
                        throws java.lang.InterruptedException
Check that acquire/release lock correctly encode the id values.

Throws:
java.lang.InterruptedException

setRootIfNull

public void setRootIfNull()
Check that setRootIfNull correctly encodes and decodes fields


syncObject

public void syncObject()
Check the synchronizeObject correctly encodes and decodes the request fields.


doubleAddListener

public void doubleAddListener()
Test that if a listener is added twice an error is generated. A Database only supports one listener for a given client at a time.


addRemoveListener

public void addRemoveListener()
Test that the add/remove of listeners is correctly passed through.



Copyright © 2009. All Rights Reserved.