org.apache.jackrabbit.test.api.observation
Class AbstractObservationTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.jackrabbit.test.JUnitTest
              extended byorg.apache.jackrabbit.test.AbstractJCRTest
                  extended byorg.apache.jackrabbit.test.api.observation.AbstractObservationTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AddEventListenerTest, EventIteratorTest, EventTest, GetRegisteredEventListenersTest, LockingTest, NodeAddedTest, NodeMovedTest, NodeRemovedTest, NodeReorderTest, PropertyAddedTest, PropertyChangedTest, PropertyRemovedTest, WorkspaceOperationTest

public abstract class AbstractObservationTest
extends AbstractJCRTest

This class implements the basic setUp() and AbstractJCRTest.tearDown() methods for the observation test cases.


Field Summary
protected static long DEFAULT_WAIT_TIMEOUT
          Default wait timeout for events: 5000 ms
protected  javax.jcr.observation.ObservationManager obsMgr
          The ObservationManager
 
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
helper, isReadOnly, jcrBaseVersion, jcrCreated, jcrFrozenNode, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testPath, testRoot, testRootNode, workspaceName
 
Fields inherited from class org.apache.jackrabbit.test.JUnitTest
log
 
Constructor Summary
AbstractObservationTest()
           
 
Method Summary
protected  void addEventListener(javax.jcr.observation.EventListener listener)
          Registers an EventListener for all events.
protected  void addEventListener(javax.jcr.observation.EventListener listener, int eventType)
          Registers an EventListener for events of the specified type(s).
protected  void checkNodeAdded(javax.jcr.observation.Event[] events, java.lang.String[] relPaths)
          Checks Events for paths.
protected  void checkNodeRemoved(javax.jcr.observation.Event[] events, java.lang.String[] relPaths)
          Checks Events for paths.
protected  void checkPropertyAdded(javax.jcr.observation.Event[] events, java.lang.String[] relPaths)
          Checks Events for paths.
protected  void checkPropertyChanged(javax.jcr.observation.Event[] events, java.lang.String[] relPaths)
          Checks Events for paths.
protected  void checkPropertyRemoved(javax.jcr.observation.Event[] events, java.lang.String[] relPaths)
          Checks Events for paths.
protected  void removeEventListener(javax.jcr.observation.EventListener listener)
          Removes the EventListener from the ObservationManager.
protected  void setUp()
           
protected  javax.jcr.observation.EventListener[] toArray(javax.jcr.observation.EventListenerIterator it)
          Consumes the EventListenerIterator and returns the EventListener as an array.
 
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
createRandomString, getNonExistingWorkspaceName, getProperty, getSize, run, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runBare, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_WAIT_TIMEOUT

protected static final long DEFAULT_WAIT_TIMEOUT
Default wait timeout for events: 5000 ms

See Also:
Constant Field Values

obsMgr

protected javax.jcr.observation.ObservationManager obsMgr
The ObservationManager

Constructor Detail

AbstractObservationTest

public AbstractObservationTest()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class AbstractJCRTest
Throws:
java.lang.Exception

addEventListener

protected void addEventListener(javax.jcr.observation.EventListener listener)
                         throws javax.jcr.RepositoryException
Registers an EventListener for all events.

Parameters:
listener - the EventListener.
Throws:
javax.jcr.RepositoryException - if registration fails.

addEventListener

protected void addEventListener(javax.jcr.observation.EventListener listener,
                                int eventType)
                         throws javax.jcr.RepositoryException
Registers an EventListener for events of the specified type(s).

Parameters:
listener - the EventListener.
eventType - the event types
Throws:
javax.jcr.RepositoryException - if registration fails.

removeEventListener

protected void removeEventListener(javax.jcr.observation.EventListener listener)
                            throws javax.jcr.RepositoryException
Removes the EventListener from the ObservationManager.

Parameters:
listener - the EventListener to unregister.
Throws:
javax.jcr.RepositoryException - if unregister fails.

toArray

protected javax.jcr.observation.EventListener[] toArray(javax.jcr.observation.EventListenerIterator it)
Consumes the EventListenerIterator and returns the EventListener as an array.

Parameters:
it - the iterator.
Returns:
array of EventListeners.

checkNodeAdded

protected void checkNodeAdded(javax.jcr.observation.Event[] events,
                              java.lang.String[] relPaths)
                       throws javax.jcr.RepositoryException
Checks Events for paths. All relPaths are relative to AbstractJCRTest.testRoot.

Parameters:
events - the Events.
relPaths - paths to child nodes added relative to AbstractJCRTest.testRoot.
Throws:
javax.jcr.RepositoryException - if an error occurs while retrieving the nodes from event instances.

checkNodeRemoved

protected void checkNodeRemoved(javax.jcr.observation.Event[] events,
                                java.lang.String[] relPaths)
                         throws javax.jcr.RepositoryException
Checks Events for paths. All relPaths are relative to AbstractJCRTest.testRoot.

Parameters:
events - the Events.
relPaths - paths to child nodes added relative to AbstractJCRTest.testRoot.
Throws:
javax.jcr.RepositoryException - if an error occurs while retrieving the nodes from event instances.

checkPropertyAdded

protected void checkPropertyAdded(javax.jcr.observation.Event[] events,
                                  java.lang.String[] relPaths)
                           throws javax.jcr.RepositoryException
Checks Events for paths. All relPaths are relative to AbstractJCRTest.testRoot.

Parameters:
events - the Events.
relPaths - paths to added properties relative to AbstractJCRTest.testRoot.
Throws:
javax.jcr.RepositoryException - if an error occurs while retrieving the nodes from event instances.

checkPropertyChanged

protected void checkPropertyChanged(javax.jcr.observation.Event[] events,
                                    java.lang.String[] relPaths)
                             throws javax.jcr.RepositoryException
Checks Events for paths. All relPaths are relative to AbstractJCRTest.testRoot.

Parameters:
events - the Events.
relPaths - paths to changed properties relative to AbstractJCRTest.testRoot.
Throws:
javax.jcr.RepositoryException - if an error occurs while retrieving the nodes from event instances.

checkPropertyRemoved

protected void checkPropertyRemoved(javax.jcr.observation.Event[] events,
                                    java.lang.String[] relPaths)
                             throws javax.jcr.RepositoryException
Checks Events for paths. All relPaths are relative to AbstractJCRTest.testRoot.

Parameters:
events - the Events.
relPaths - paths to removed properties relative to AbstractJCRTest.testRoot.
Throws:
javax.jcr.RepositoryException - if an error occurs while retrieving the nodes from event instances.


Copyright © -2005 . All Rights Reserved.