public abstract class AbstractObservationTest extends AbstractJCRTest
setUp()
and tearDown()
methods for the observation test cases.Modifier and Type | Class and Description |
---|---|
protected static interface |
AbstractObservationTest.Callable
Helper interface.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
ALL_TYPES |
protected static long |
DEFAULT_WAIT_TIMEOUT
Default wait timeout for events: 5000 ms
|
protected javax.jcr.observation.ObservationManager |
obsMgr
The
ObservationManager |
isReadOnly, jcrBaseVersion, jcrCopiedFrom, jcrCreated, jcrFrozenNode, jcrFrozenUuid, jcrIsCheckedOut, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixShareable, mixSimpleVersionable, mixTitle, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntUnstructured, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testNodeTypeTestRoot, testPath, testRoot, testRootNode, vf, workspaceName
Constructor and Description |
---|
AbstractObservationTest() |
Modifier and Type | Method and Description |
---|---|
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,
String[] requiredRelPaths,
String[] optionalRelPaths)
Checks
Events for paths. |
protected void |
checkNodeRemoved(javax.jcr.observation.Event[] events,
String[] requiredRelPaths,
String[] optionalRelPaths)
Checks
Events for paths. |
protected void |
checkNodes(javax.jcr.observation.Event[] events,
String[] requiredRelPaths,
String[] optionalRelPaths,
long eventType)
Checks
Events for paths. |
protected void |
checkPropertyAdded(javax.jcr.observation.Event[] events,
String[] relPaths)
Checks
Events for paths. |
protected void |
checkPropertyChanged(javax.jcr.observation.Event[] events,
String[] relPaths)
Checks
Events for paths. |
protected void |
checkPropertyRemoved(javax.jcr.observation.Event[] events,
String[] relPaths)
Checks
Events for paths. |
protected javax.jcr.observation.Event |
getEventByPath(javax.jcr.observation.Event[] events,
String path)
Returns the first event with the given
path . |
protected javax.jcr.observation.Event[] |
getEvents(AbstractObservationTest.Callable call,
int eventTypes)
Registers an event listener for the passed
eventTypes and
calls the callable. |
protected void |
removeEventListener(javax.jcr.observation.EventListener listener)
Removes the
EventListener from the ObservationManager. |
protected void |
setUp() |
protected void |
tearDown() |
protected javax.jcr.observation.EventListener[] |
toArray(javax.jcr.observation.EventListenerIterator it)
Consumes the
EventListenerIterator and returns the
EventListener as an array. |
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureLockingSupported, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getPrefix, getProperty, getProperty, getQualifiedName, getSize, isSupported, needsMixin, run
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, runBare, runTest, setName, toString
protected static final long DEFAULT_WAIT_TIMEOUT
protected static final int ALL_TYPES
protected javax.jcr.observation.ObservationManager obsMgr
ObservationManager
protected void setUp() throws Exception
setUp
in class AbstractJCRTest
Exception
protected void tearDown() throws Exception
tearDown
in class AbstractJCRTest
Exception
protected void addEventListener(javax.jcr.observation.EventListener listener) throws javax.jcr.RepositoryException
EventListener
for all events.listener
- the EventListener
.javax.jcr.RepositoryException
- if registration fails.protected void addEventListener(javax.jcr.observation.EventListener listener, int eventType) throws javax.jcr.RepositoryException
EventListener
for events of the specified
type(s).listener
- the EventListener
.eventType
- the event typesjavax.jcr.RepositoryException
- if registration fails.protected void removeEventListener(javax.jcr.observation.EventListener listener) throws javax.jcr.RepositoryException
EventListener
from the ObservationManager.listener
- the EventListener
to unregister.javax.jcr.RepositoryException
- if unregister fails.protected javax.jcr.observation.EventListener[] toArray(javax.jcr.observation.EventListenerIterator it)
EventListenerIterator
and returns the
EventListener
as an array.it
- the iterator.EventListeners
.protected void checkNodeAdded(javax.jcr.observation.Event[] events, String[] requiredRelPaths, String[] optionalRelPaths) throws javax.jcr.RepositoryException
events
- the Event
s.requiredRelPaths
- paths to child nodes added relative to AbstractJCRTest.testRoot
(required events).optionalRelPaths
- paths to child nodes added relative to AbstractJCRTest.testRoot
(optional events).javax.jcr.RepositoryException
- if an error occurs while retrieving the nodes
from event instances.protected void checkNodeRemoved(javax.jcr.observation.Event[] events, String[] requiredRelPaths, String[] optionalRelPaths) throws javax.jcr.RepositoryException
events
- the Event
s.requiredRelPaths
- paths to child nodes added relative to AbstractJCRTest.testRoot
(required events).optionalRelPaths
- paths to child nodes added relative to AbstractJCRTest.testRoot
(optional events).javax.jcr.RepositoryException
- if an error occurs while retrieving the nodes
from event instances.protected void checkPropertyAdded(javax.jcr.observation.Event[] events, String[] relPaths) throws javax.jcr.RepositoryException
events
- the Event
s.relPaths
- paths to added properties relative to AbstractJCRTest.testRoot
.javax.jcr.RepositoryException
- if an error occurs while retrieving the nodes
from event instances.protected void checkPropertyChanged(javax.jcr.observation.Event[] events, String[] relPaths) throws javax.jcr.RepositoryException
events
- the Event
s.relPaths
- paths to changed properties relative to AbstractJCRTest.testRoot
.javax.jcr.RepositoryException
- if an error occurs while retrieving the nodes
from event instances.protected void checkPropertyRemoved(javax.jcr.observation.Event[] events, String[] relPaths) throws javax.jcr.RepositoryException
events
- the Event
s.relPaths
- paths to removed properties relative to AbstractJCRTest.testRoot
.javax.jcr.RepositoryException
- if an error occurs while retrieving the nodes
from event instances.protected void checkNodes(javax.jcr.observation.Event[] events, String[] requiredRelPaths, String[] optionalRelPaths, long eventType) throws javax.jcr.RepositoryException
events
- the Event
s.requiredRelPaths
- paths to required item events relative to AbstractJCRTest.testRoot
.optionalRelPaths
- paths to optional item events relative to AbstractJCRTest.testRoot
.eventType
- the type of event to check.javax.jcr.RepositoryException
- if an error occurs while retrieving the nodes
from event instances.protected javax.jcr.observation.Event[] getEvents(AbstractObservationTest.Callable call, int eventTypes) throws javax.jcr.RepositoryException
eventTypes
and
calls the callable.call
- the callable.eventTypes
- the types of the events to listen for.javax.jcr.RepositoryException
- if an error occurs.protected javax.jcr.observation.Event getEventByPath(javax.jcr.observation.Event[] events, String path) throws javax.jcr.RepositoryException
path
.events
- the events.path
- the path.path
or TestCase.fail()
s if
no such event exists.javax.jcr.RepositoryException
- if an error occurs while reading from the
repository.Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.