Class MockNode
- java.lang.Object
-
- org.apache.sling.commons.testing.jcr.MockNode
-
- All Implemented Interfaces:
javax.jcr.Item
,javax.jcr.Node
public class MockNode extends Object implements javax.jcr.Node
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(javax.jcr.ItemVisitor visitor)
void
addMixin(String mixinName)
javax.jcr.Node
addNode(String relPath)
javax.jcr.Node
addNode(String relPath, String primaryNodeTypeName)
boolean
canAddMixin(String mixinName)
void
cancelMerge(javax.jcr.version.Version version)
javax.jcr.version.Version
checkin()
void
checkout()
void
doneMerge(javax.jcr.version.Version version)
boolean
equals(Object obj)
void
followLifecycleTransition(String transition)
String[]
getAllowedLifecycleTransistions()
javax.jcr.Item
getAncestor(int depth)
javax.jcr.version.Version
getBaseVersion()
String
getCorrespondingNodePath(String workspaceName)
javax.jcr.nodetype.NodeDefinition
getDefinition()
int
getDepth()
String
getIdentifier()
int
getIndex()
javax.jcr.lock.Lock
getLock()
javax.jcr.nodetype.NodeType[]
getMixinNodeTypes()
String
getName()
javax.jcr.Node
getNode(String relPath)
javax.jcr.NodeIterator
getNodes()
javax.jcr.NodeIterator
getNodes(String namePattern)
javax.jcr.NodeIterator
getNodes(String[] nameGlobs)
javax.jcr.Node
getParent()
String
getPath()
javax.jcr.Item
getPrimaryItem()
javax.jcr.nodetype.NodeType
getPrimaryNodeType()
javax.jcr.PropertyIterator
getProperties()
javax.jcr.PropertyIterator
getProperties(String namePattern)
javax.jcr.PropertyIterator
getProperties(String[] nameGlobs)
javax.jcr.Property
getProperty(String relPath)
javax.jcr.PropertyIterator
getReferences()
javax.jcr.PropertyIterator
getReferences(String name)
javax.jcr.Session
getSession()
javax.jcr.NodeIterator
getSharedSet()
String
getUUID()
javax.jcr.version.VersionHistory
getVersionHistory()
javax.jcr.PropertyIterator
getWeakReferences()
javax.jcr.PropertyIterator
getWeakReferences(String name)
int
hashCode()
boolean
hasNode(String relPath)
boolean
hasNodes()
boolean
hasProperties()
boolean
hasProperty(String relPath)
boolean
holdsLock()
boolean
isCheckedOut()
boolean
isLocked()
boolean
isModified()
boolean
isNew()
boolean
isNode()
boolean
isNodeType(String nodeTypeName)
boolean
isSame(javax.jcr.Item otherItem)
javax.jcr.lock.Lock
lock(boolean isDeep, boolean isSessionScoped)
javax.jcr.NodeIterator
merge(String srcWorkspace, boolean bestEffort)
void
orderBefore(String srcChildRelPath, String destChildRelPath)
void
refresh(boolean keepChanges)
void
remove()
void
removeMixin(String mixinName)
void
removeShare()
void
removeSharedSet()
void
restore(String versionName, boolean removeExisting)
void
restore(javax.jcr.version.Version version, boolean removeExisting)
void
restore(javax.jcr.version.Version version, String relPath, boolean removeExisting)
void
restoreByLabel(String versionLabel, boolean removeExisting)
void
save()
void
setPrimaryType(String nodeTypeName)
javax.jcr.Property
setProperty(String name, boolean value)
javax.jcr.Property
setProperty(String name, double value)
javax.jcr.Property
setProperty(String name, long value)
javax.jcr.Property
setProperty(String name, InputStream value)
javax.jcr.Property
setProperty(String name, String value)
javax.jcr.Property
setProperty(String name, String[] values)
javax.jcr.Property
setProperty(String name, String[] values, int type)
javax.jcr.Property
setProperty(String name, String value, int type)
javax.jcr.Property
setProperty(String name, BigDecimal value)
javax.jcr.Property
setProperty(String name, Calendar value)
javax.jcr.Property
setProperty(String name, javax.jcr.Binary value)
javax.jcr.Property
setProperty(String name, javax.jcr.Node value)
javax.jcr.Property
setProperty(String name, javax.jcr.Value value)
javax.jcr.Property
setProperty(String name, javax.jcr.Value[] values)
javax.jcr.Property
setProperty(String name, javax.jcr.Value[] values, int type)
javax.jcr.Property
setProperty(String name, javax.jcr.Value value, int type)
void
setSession(javax.jcr.Session session)
String
toString()
void
unlock()
void
update(String srcWorkspaceName)
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in interfacejavax.jcr.Item
-
getParent
public javax.jcr.Node getParent()
- Specified by:
getParent
in interfacejavax.jcr.Item
-
getPath
public String getPath()
- Specified by:
getPath
in interfacejavax.jcr.Item
-
getPrimaryNodeType
public javax.jcr.nodetype.NodeType getPrimaryNodeType()
- Specified by:
getPrimaryNodeType
in interfacejavax.jcr.Node
-
isSame
public boolean isSame(javax.jcr.Item otherItem)
- Specified by:
isSame
in interfacejavax.jcr.Item
-
addMixin
public void addMixin(String mixinName)
- Specified by:
addMixin
in interfacejavax.jcr.Node
-
addNode
public javax.jcr.Node addNode(String relPath)
- Specified by:
addNode
in interfacejavax.jcr.Node
-
addNode
public javax.jcr.Node addNode(String relPath, String primaryNodeTypeName)
- Specified by:
addNode
in interfacejavax.jcr.Node
-
canAddMixin
public boolean canAddMixin(String mixinName)
- Specified by:
canAddMixin
in interfacejavax.jcr.Node
-
cancelMerge
public void cancelMerge(javax.jcr.version.Version version)
- Specified by:
cancelMerge
in interfacejavax.jcr.Node
-
checkin
public javax.jcr.version.Version checkin()
- Specified by:
checkin
in interfacejavax.jcr.Node
-
checkout
public void checkout()
- Specified by:
checkout
in interfacejavax.jcr.Node
-
doneMerge
public void doneMerge(javax.jcr.version.Version version)
- Specified by:
doneMerge
in interfacejavax.jcr.Node
-
getBaseVersion
public javax.jcr.version.Version getBaseVersion()
- Specified by:
getBaseVersion
in interfacejavax.jcr.Node
-
getCorrespondingNodePath
public String getCorrespondingNodePath(String workspaceName)
- Specified by:
getCorrespondingNodePath
in interfacejavax.jcr.Node
-
getDefinition
public javax.jcr.nodetype.NodeDefinition getDefinition()
- Specified by:
getDefinition
in interfacejavax.jcr.Node
-
getIndex
public int getIndex()
- Specified by:
getIndex
in interfacejavax.jcr.Node
-
getLock
public javax.jcr.lock.Lock getLock()
- Specified by:
getLock
in interfacejavax.jcr.Node
-
getMixinNodeTypes
public javax.jcr.nodetype.NodeType[] getMixinNodeTypes()
- Specified by:
getMixinNodeTypes
in interfacejavax.jcr.Node
-
getNode
public javax.jcr.Node getNode(String relPath)
- Specified by:
getNode
in interfacejavax.jcr.Node
-
getNodes
public javax.jcr.NodeIterator getNodes()
- Specified by:
getNodes
in interfacejavax.jcr.Node
-
getNodes
public javax.jcr.NodeIterator getNodes(String namePattern)
- Specified by:
getNodes
in interfacejavax.jcr.Node
-
getPrimaryItem
public javax.jcr.Item getPrimaryItem()
- Specified by:
getPrimaryItem
in interfacejavax.jcr.Node
-
getProperties
public javax.jcr.PropertyIterator getProperties()
- Specified by:
getProperties
in interfacejavax.jcr.Node
-
getProperties
public javax.jcr.PropertyIterator getProperties(String namePattern) throws javax.jcr.RepositoryException
- Specified by:
getProperties
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
getProperty
public javax.jcr.Property getProperty(String relPath)
- Specified by:
getProperty
in interfacejavax.jcr.Node
-
getReferences
public javax.jcr.PropertyIterator getReferences()
- Specified by:
getReferences
in interfacejavax.jcr.Node
-
getUUID
public String getUUID()
- Specified by:
getUUID
in interfacejavax.jcr.Node
-
getVersionHistory
public javax.jcr.version.VersionHistory getVersionHistory()
- Specified by:
getVersionHistory
in interfacejavax.jcr.Node
-
hasNode
public boolean hasNode(String relPath)
- Specified by:
hasNode
in interfacejavax.jcr.Node
-
hasNodes
public boolean hasNodes()
- Specified by:
hasNodes
in interfacejavax.jcr.Node
-
hasProperties
public boolean hasProperties()
- Specified by:
hasProperties
in interfacejavax.jcr.Node
-
hasProperty
public boolean hasProperty(String relPath)
- Specified by:
hasProperty
in interfacejavax.jcr.Node
-
holdsLock
public boolean holdsLock()
- Specified by:
holdsLock
in interfacejavax.jcr.Node
-
isCheckedOut
public boolean isCheckedOut()
- Specified by:
isCheckedOut
in interfacejavax.jcr.Node
-
isLocked
public boolean isLocked()
- Specified by:
isLocked
in interfacejavax.jcr.Node
-
isNodeType
public boolean isNodeType(String nodeTypeName)
- Specified by:
isNodeType
in interfacejavax.jcr.Node
-
lock
public javax.jcr.lock.Lock lock(boolean isDeep, boolean isSessionScoped)
- Specified by:
lock
in interfacejavax.jcr.Node
-
merge
public javax.jcr.NodeIterator merge(String srcWorkspace, boolean bestEffort)
- Specified by:
merge
in interfacejavax.jcr.Node
-
orderBefore
public void orderBefore(String srcChildRelPath, String destChildRelPath)
- Specified by:
orderBefore
in interfacejavax.jcr.Node
-
removeMixin
public void removeMixin(String mixinName)
- Specified by:
removeMixin
in interfacejavax.jcr.Node
-
restore
public void restore(String versionName, boolean removeExisting)
- Specified by:
restore
in interfacejavax.jcr.Node
-
restore
public void restore(javax.jcr.version.Version version, boolean removeExisting)
- Specified by:
restore
in interfacejavax.jcr.Node
-
restore
public void restore(javax.jcr.version.Version version, String relPath, boolean removeExisting)
- Specified by:
restore
in interfacejavax.jcr.Node
-
restoreByLabel
public void restoreByLabel(String versionLabel, boolean removeExisting)
- Specified by:
restoreByLabel
in interfacejavax.jcr.Node
-
setProperty
public javax.jcr.Property setProperty(String name, javax.jcr.Value value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, javax.jcr.Value[] values) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, String[] values) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, String value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, InputStream value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, boolean value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, double value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, long value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, Calendar value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, javax.jcr.Node value)
- Specified by:
setProperty
in interfacejavax.jcr.Node
-
setProperty
public javax.jcr.Property setProperty(String name, javax.jcr.Value value, int type)
- Specified by:
setProperty
in interfacejavax.jcr.Node
-
setProperty
public javax.jcr.Property setProperty(String name, javax.jcr.Value[] values, int type)
- Specified by:
setProperty
in interfacejavax.jcr.Node
-
setProperty
public javax.jcr.Property setProperty(String name, String[] values, int type)
- Specified by:
setProperty
in interfacejavax.jcr.Node
-
setProperty
public javax.jcr.Property setProperty(String name, String value, int type)
- Specified by:
setProperty
in interfacejavax.jcr.Node
-
unlock
public void unlock()
- Specified by:
unlock
in interfacejavax.jcr.Node
-
update
public void update(String srcWorkspaceName)
- Specified by:
update
in interfacejavax.jcr.Node
-
accept
public void accept(javax.jcr.ItemVisitor visitor)
- Specified by:
accept
in interfacejavax.jcr.Item
-
getAncestor
public javax.jcr.Item getAncestor(int depth)
- Specified by:
getAncestor
in interfacejavax.jcr.Item
-
getDepth
public int getDepth()
- Specified by:
getDepth
in interfacejavax.jcr.Item
-
getSession
public javax.jcr.Session getSession()
- Specified by:
getSession
in interfacejavax.jcr.Item
-
setSession
public void setSession(javax.jcr.Session session)
-
isModified
public boolean isModified()
- Specified by:
isModified
in interfacejavax.jcr.Item
-
isNew
public boolean isNew()
- Specified by:
isNew
in interfacejavax.jcr.Item
-
isNode
public boolean isNode()
- Specified by:
isNode
in interfacejavax.jcr.Item
-
refresh
public void refresh(boolean keepChanges)
- Specified by:
refresh
in interfacejavax.jcr.Item
-
remove
public void remove()
- Specified by:
remove
in interfacejavax.jcr.Item
-
save
public void save()
- Specified by:
save
in interfacejavax.jcr.Item
-
followLifecycleTransition
public void followLifecycleTransition(String transition) throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.InvalidLifecycleTransitionException, javax.jcr.RepositoryException
- Specified by:
followLifecycleTransition
in interfacejavax.jcr.Node
- Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.InvalidLifecycleTransitionException
javax.jcr.RepositoryException
-
getAllowedLifecycleTransistions
public String[] getAllowedLifecycleTransistions() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
- Specified by:
getAllowedLifecycleTransistions
in interfacejavax.jcr.Node
- Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
-
getIdentifier
public String getIdentifier() throws javax.jcr.RepositoryException
- Specified by:
getIdentifier
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
getNodes
public javax.jcr.NodeIterator getNodes(String[] nameGlobs) throws javax.jcr.RepositoryException
- Specified by:
getNodes
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
getProperties
public javax.jcr.PropertyIterator getProperties(String[] nameGlobs) throws javax.jcr.RepositoryException
- Specified by:
getProperties
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
getReferences
public javax.jcr.PropertyIterator getReferences(String name) throws javax.jcr.RepositoryException
- Specified by:
getReferences
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
getSharedSet
public javax.jcr.NodeIterator getSharedSet() throws javax.jcr.RepositoryException
- Specified by:
getSharedSet
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
getWeakReferences
public javax.jcr.PropertyIterator getWeakReferences() throws javax.jcr.RepositoryException
- Specified by:
getWeakReferences
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
getWeakReferences
public javax.jcr.PropertyIterator getWeakReferences(String name) throws javax.jcr.RepositoryException
- Specified by:
getWeakReferences
in interfacejavax.jcr.Node
- Throws:
javax.jcr.RepositoryException
-
removeShare
public void removeShare() throws javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
removeShare
in interfacejavax.jcr.Node
- Throws:
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
removeSharedSet
public void removeSharedSet() throws javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
removeSharedSet
in interfacejavax.jcr.Node
- Throws:
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setPrimaryType
public void setPrimaryType(String nodeTypeName) throws javax.jcr.nodetype.NoSuchNodeTypeException, javax.jcr.version.VersionException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.lock.LockException, javax.jcr.RepositoryException
- Specified by:
setPrimaryType
in interfacejavax.jcr.Node
- Throws:
javax.jcr.nodetype.NoSuchNodeTypeException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.lock.LockException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, BigDecimal value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
setProperty
public javax.jcr.Property setProperty(String name, javax.jcr.Binary value) throws javax.jcr.ValueFormatException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
- Specified by:
setProperty
in interfacejavax.jcr.Node
- Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
-
-