org.apache.jdo.tck.api.instancecallbacks
Class AbstractInstanceLifecycleListener

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.jdo.tck.JDO_Test
              extended byorg.apache.jdo.tck.api.instancecallbacks.AbstractInstanceLifecycleListener
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
InstanceLifecycleListenerAttach, InstanceLifecycleListenerClear, InstanceLifecycleListenerCreate, InstanceLifecycleListenerDelete, InstanceLifecycleListenerDetach, InstanceLifecycleListenerDirty, InstanceLifecycleListenerLoad, InstanceLifecycleListenerStore

public abstract class AbstractInstanceLifecycleListener
extends JDO_Test

Title: Abstract test AbstractInstanceLifecycleListener
Keywords: LifeCycleListener lifecycle listener callback
Assertion IDs: A12.15-1, A12.15-2, A12.15-3, A12.15-4, A12.15-5, A12.15-6, A12.15-7, A12.15-8, A12.15-9, A12.15-10, A12.15-11, A12.15-12, A12.15-13, A12.15-14,
Assertion Description: A12.15-1 void postCreate(InstanceLifecycleEvent event); This method is called whenever a persistent instance is created, during makePersistent. It is called after the instance transitions to persistent-new. A12.15-2 void postLoad(InstanceLifecycleEvent event); This method is called whenever a persistent instance is loaded. It is called after the jdoPostLoad method is invoked on the instance. A12.15-3 void preStore(InstanceLifecycleEvent event); This method is called whenever a persistent instance is stored, for example during flush or commit. It is called before the jdoPreStore method is invoked on the instance. A12.15-4 void postStore(InstanceLifecycleEvent event); This method is called whenever a persistent instance is stored, for example during flush or commit. It is called after the jdoPreStore method is invoked on the instance. An object identity for a per?sistent-new instance must have been assigned to the instance when this callback is invoked. A12.15-5 void preClear(InstanceLifecycleEvent event); This method is called whenever a persistent instance is cleared, for example during afterCompletion. It is called before the jdoPreClear method is invoked on the instance. A12.15-6 void postClear(InstanceLifecycleEvent event); This method is called whenever a persistent instance is cleared, for example during afterCom?pletion. It is called after the jdoPreClear method is invoked on the instance and the fields have been cleared by the JDO implementation. A12.15-7 void preDelete(InstanceLifecycleEvent event); This method is called whenever a persistent instance is deleted, during deletePersistent. It is called before the state transition and before the jdoPreDelete method is invoked on the instance. A12.15-8 void postDelete(InstanceLifecycleEvent event); This method is called whenever a persistent instance is deleted, during deletePersistent. It is called after the jdoPreDelete method is invoked on the instance and after the state transition. A12.15-9 void preDirty(InstanceLifecycleEvent event); This method is called whenever a persistent clean instance is first made dirty, during an operation that modifies the value of a persistent or transactional field. It is called before the field value is changed. A12.15-10 void postDirty(InstanceLifecycleEvent event); This method is called whenever a persistent clean instance is first made dirty, during an operation that modifies the value of a persistent or transactional field. It is called after the field value was changed. A12.15-11 void preDetach(InstanceLifecycleEvent event); This method is called before a persistent instance is copied for detachment. A12.15-12 void postDetach(InstanceLifecycleEvent event); This method is called whenever a persistent instance is copied for detachment. The source instance is the detached copy; the target instance is the persistent instance. A12.15-13 void preAttach(InstanceLifecycleEvent event); This method is called before a detached instance is attached. The source instance is the detached instance]. A12.15-14 void postAttach(InstanceLifecycleEvent event); This method is called after a detached instance is attached. The source instance is the corresponding persistent instance in the cache; the target instance is the detached instance. This is the abstract base class for the lifecycle listener test classes. It contains constants, variables, and methods used by each listener test class. This class implements the setup and teardown methods used by each concrete test class. This class also includes the listener base class that is extended by each specific listener. The strategy of each test case is the same. A specific listener is implemented that responds only to events for that specific test; a specific persistence-capable class is also implemented, that responds only to callbacks for the specific test. A sequence of operations that stimulates the callbacks is executed. During these operations, listener events and callbacks are collected by the listener instance. Finally, the actual events and callbacks that were collected are analyzed and differences are reported.


Nested Class Summary
protected static class AbstractInstanceLifecycleListener.InstanceLifecycleListenerImpl
          The LifeCycleListener to be registered with the PersistenceManager.
 
Field Summary
protected static java.lang.String ASSERTION1_FAILED
           
protected static java.lang.String ASSERTION10_FAILED
           
protected static java.lang.String ASSERTION11_FAILED
           
protected static java.lang.String ASSERTION12_FAILED
           
protected static java.lang.String ASSERTION13_FAILED
           
protected static java.lang.String ASSERTION14_FAILED
           
protected static java.lang.String ASSERTION2_FAILED
           
protected static java.lang.String ASSERTION3_FAILED
           
protected static java.lang.String ASSERTION4_FAILED
           
protected static java.lang.String ASSERTION5_FAILED
           
protected static java.lang.String ASSERTION6_FAILED
           
protected static java.lang.String ASSERTION7_FAILED
           
protected static java.lang.String ASSERTION8_FAILED
           
protected static java.lang.String ASSERTION9_FAILED
           
 
Fields inherited from class org.apache.jdo.tck.JDO_Test
APPLICATION_IDENTITY, cleanupData, closePMFAfterEachTest, DATASTORE_IDENTITY, debug, DETACHED_CLEAN, DETACHED_DIRTY, HOLLOW, identitytype, ILLEGAL_STATE, logger, messages, NL, NUM_STATES, PERSISTENT_CLEAN, PERSISTENT_DELETED, PERSISTENT_DIRTY, PERSISTENT_NEW, PERSISTENT_NEW_DELETED, PERSISTENT_NONTRANSACTIONAL, PERSISTENT_NONTRANSACTIONAL_DIRTY, pm, pmf, PMFProperties, PMFPropertiesObject, states, testSucceeded, TRANSIENT, TRANSIENT_CLEAN, TRANSIENT_DIRTY
 
Constructor Summary
AbstractInstanceLifecycleListener()
           
 
Method Summary
protected  void addListener()
          Register a new InstanceLifecycleListenerImpl with the PersistenceManager.
protected abstract  AbstractInstanceLifecycleListener.InstanceLifecycleListenerImpl getListener()
          The listener to be used for the test.
protected abstract  java.lang.Class[] getPersistentClasses()
          The classes to be used for the test.
protected  void localSetUp()
          Set up for lifecycle tests: Register the LifecycleListener; add PCPoint to tearDownClasses.
protected  void localTearDown()
          Clean up after lifecycle tests: Unregister the LifecycleListener.
protected  void removeListener()
          Unregister the InstanceLifecycleListenerImpl with the PersistenceManager.
 
Methods inherited from class org.apache.jdo.tck.JDO_Test
addTearDownClass, addTearDownClass, addTearDownInstance, addTearDownObjectId, appendMessage, cleanupPM, cleanupPM, closePMF, compareStates, currentState, deleteTearDownClasses, deleteTearDownInstances, dumpSupportedOptions, fail, failOnError, getAllObjects, getFailedPersistenceManagers, getModifiableFields, getPM, getPMF, getPMFProperty, getStateOfInstance, isApplicationIdentitySupported, isArrayListSupported, isArraySupported, isBinaryCompatibilitySupported, isChangeApplicationIdentitySupported, isClassLoadable, isDataStoreConnectionSupported, isDatastoreIdentitySupported, isHashMapSupported, isHashtableSupported, isJRE14orBetter, isLinkedListSupported, isListSupported, isMapSupported, isNonDurableIdentitySupported, isNontransactionalReadSupported, isNontransactionalWriteSupported, isNullCollectionSupported, isOptimisticSupported, isRetainValuesSupported, isSQLSupported, isTestToBePerformed, isTransientTransactionalSupported, isTreeMapSupported, isTreeSetSupported, isUnconstrainedVariablesSupported, isVectorSupported, loadProperties, mangleObject, printNonApplicableIdentityType, printUnsupportedOptionalFeatureNotTested, retrieveMessages, runBare, runsWithApplicationIdentity, setUp, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ASSERTION1_FAILED

protected static final java.lang.String ASSERTION1_FAILED
See Also:
Constant Field Values

ASSERTION2_FAILED

protected static final java.lang.String ASSERTION2_FAILED
See Also:
Constant Field Values

ASSERTION3_FAILED

protected static final java.lang.String ASSERTION3_FAILED
See Also:
Constant Field Values

ASSERTION4_FAILED

protected static final java.lang.String ASSERTION4_FAILED
See Also:
Constant Field Values

ASSERTION5_FAILED

protected static final java.lang.String ASSERTION5_FAILED
See Also:
Constant Field Values

ASSERTION6_FAILED

protected static final java.lang.String ASSERTION6_FAILED
See Also:
Constant Field Values

ASSERTION7_FAILED

protected static final java.lang.String ASSERTION7_FAILED
See Also:
Constant Field Values

ASSERTION8_FAILED

protected static final java.lang.String ASSERTION8_FAILED
See Also:
Constant Field Values

ASSERTION9_FAILED

protected static final java.lang.String ASSERTION9_FAILED
See Also:
Constant Field Values

ASSERTION10_FAILED

protected static final java.lang.String ASSERTION10_FAILED
See Also:
Constant Field Values

ASSERTION11_FAILED

protected static final java.lang.String ASSERTION11_FAILED
See Also:
Constant Field Values

ASSERTION12_FAILED

protected static final java.lang.String ASSERTION12_FAILED
See Also:
Constant Field Values

ASSERTION13_FAILED

protected static final java.lang.String ASSERTION13_FAILED
See Also:
Constant Field Values

ASSERTION14_FAILED

protected static final java.lang.String ASSERTION14_FAILED
See Also:
Constant Field Values
Constructor Detail

AbstractInstanceLifecycleListener

public AbstractInstanceLifecycleListener()
Method Detail

getListener

protected abstract AbstractInstanceLifecycleListener.InstanceLifecycleListenerImpl getListener()
The listener to be used for the test. This method is implemented by the subclasses to use the proper listener.


getPersistentClasses

protected abstract java.lang.Class[] getPersistentClasses()
The classes to be used for the test. This method is implemented by the subclasses to use the proper classes. The classes returned by this method are used for two purposes: they are used to register listeners; and they are used as the teardown classes whose instances are removed from the datastore at the end of the test.


addListener

protected void addListener()
Register a new InstanceLifecycleListenerImpl with the PersistenceManager.


removeListener

protected void removeListener()
Unregister the InstanceLifecycleListenerImpl with the PersistenceManager.


localSetUp

protected void localSetUp()
Set up for lifecycle tests: Register the LifecycleListener; add PCPoint to tearDownClasses.

Overrides:
localSetUp in class JDO_Test

localTearDown

protected void localTearDown()
Clean up after lifecycle tests: Unregister the LifecycleListener.

Overrides:
localTearDown in class JDO_Test


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.