org.apache.sling.commons.testing.jcr
Class MockNode

java.lang.Object
  extended by 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


Field Summary
 
Fields inherited from interface javax.jcr.Node
JCR_CHILD_NODE_DEFINITION, JCR_CONTENT, JCR_FROZEN_NODE, JCR_PROPERTY_DEFINITION, JCR_ROOT_VERSION, JCR_VERSION_LABELS
 
Constructor Summary
MockNode(String path)
           
MockNode(String path, String type)
           
 
Method Summary
 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, BigDecimal value)
           
 javax.jcr.Property setProperty(String name, javax.jcr.Binary value)
           
 javax.jcr.Property setProperty(String name, boolean value)
           
 javax.jcr.Property setProperty(String name, Calendar value)
           
 javax.jcr.Property setProperty(String name, double value)
           
 javax.jcr.Property setProperty(String name, InputStream value)
           
 javax.jcr.Property setProperty(String name, long value)
           
 javax.jcr.Property setProperty(String name, javax.jcr.Node 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, 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)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockNode

public MockNode(String path)

MockNode

public MockNode(String path,
                String type)
Method Detail

getName

public String getName()
Specified by:
getName in interface javax.jcr.Item

getParent

public javax.jcr.Node getParent()
Specified by:
getParent in interface javax.jcr.Item

getPath

public String getPath()
Specified by:
getPath in interface javax.jcr.Item

getPrimaryNodeType

public javax.jcr.nodetype.NodeType getPrimaryNodeType()
Specified by:
getPrimaryNodeType in interface javax.jcr.Node

isSame

public boolean isSame(javax.jcr.Item otherItem)
Specified by:
isSame in interface javax.jcr.Item

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

addMixin

public void addMixin(String mixinName)
Specified by:
addMixin in interface javax.jcr.Node

addNode

public javax.jcr.Node addNode(String relPath)
Specified by:
addNode in interface javax.jcr.Node

addNode

public javax.jcr.Node addNode(String relPath,
                              String primaryNodeTypeName)
Specified by:
addNode in interface javax.jcr.Node

canAddMixin

public boolean canAddMixin(String mixinName)
Specified by:
canAddMixin in interface javax.jcr.Node

cancelMerge

public void cancelMerge(javax.jcr.version.Version version)
Specified by:
cancelMerge in interface javax.jcr.Node

checkin

public javax.jcr.version.Version checkin()
Specified by:
checkin in interface javax.jcr.Node

checkout

public void checkout()
Specified by:
checkout in interface javax.jcr.Node

doneMerge

public void doneMerge(javax.jcr.version.Version version)
Specified by:
doneMerge in interface javax.jcr.Node

getBaseVersion

public javax.jcr.version.Version getBaseVersion()
Specified by:
getBaseVersion in interface javax.jcr.Node

getCorrespondingNodePath

public String getCorrespondingNodePath(String workspaceName)
Specified by:
getCorrespondingNodePath in interface javax.jcr.Node

getDefinition

public javax.jcr.nodetype.NodeDefinition getDefinition()
Specified by:
getDefinition in interface javax.jcr.Node

getIndex

public int getIndex()
Specified by:
getIndex in interface javax.jcr.Node

getLock

public javax.jcr.lock.Lock getLock()
Specified by:
getLock in interface javax.jcr.Node

getMixinNodeTypes

public javax.jcr.nodetype.NodeType[] getMixinNodeTypes()
Specified by:
getMixinNodeTypes in interface javax.jcr.Node

getNode

public javax.jcr.Node getNode(String relPath)
Specified by:
getNode in interface javax.jcr.Node

getNodes

public javax.jcr.NodeIterator getNodes()
Specified by:
getNodes in interface javax.jcr.Node

getNodes

public javax.jcr.NodeIterator getNodes(String namePattern)
Specified by:
getNodes in interface javax.jcr.Node

getPrimaryItem

public javax.jcr.Item getPrimaryItem()
Specified by:
getPrimaryItem in interface javax.jcr.Node

getProperties

public javax.jcr.PropertyIterator getProperties()
Specified by:
getProperties in interface javax.jcr.Node

getProperties

public javax.jcr.PropertyIterator getProperties(String namePattern)
                                         throws javax.jcr.RepositoryException
Specified by:
getProperties in interface javax.jcr.Node
Throws:
javax.jcr.RepositoryException

getProperty

public javax.jcr.Property getProperty(String relPath)
Specified by:
getProperty in interface javax.jcr.Node

getReferences

public javax.jcr.PropertyIterator getReferences()
Specified by:
getReferences in interface javax.jcr.Node

getUUID

public String getUUID()
Specified by:
getUUID in interface javax.jcr.Node

getVersionHistory

public javax.jcr.version.VersionHistory getVersionHistory()
Specified by:
getVersionHistory in interface javax.jcr.Node

hasNode

public boolean hasNode(String relPath)
Specified by:
hasNode in interface javax.jcr.Node

hasNodes

public boolean hasNodes()
Specified by:
hasNodes in interface javax.jcr.Node

hasProperties

public boolean hasProperties()
Specified by:
hasProperties in interface javax.jcr.Node

hasProperty

public boolean hasProperty(String relPath)
Specified by:
hasProperty in interface javax.jcr.Node

holdsLock

public boolean holdsLock()
Specified by:
holdsLock in interface javax.jcr.Node

isCheckedOut

public boolean isCheckedOut()
Specified by:
isCheckedOut in interface javax.jcr.Node

isLocked

public boolean isLocked()
Specified by:
isLocked in interface javax.jcr.Node

isNodeType

public boolean isNodeType(String nodeTypeName)
Specified by:
isNodeType in interface javax.jcr.Node

lock

public javax.jcr.lock.Lock lock(boolean isDeep,
                                boolean isSessionScoped)
Specified by:
lock in interface javax.jcr.Node

merge

public javax.jcr.NodeIterator merge(String srcWorkspace,
                                    boolean bestEffort)
Specified by:
merge in interface javax.jcr.Node

orderBefore

public void orderBefore(String srcChildRelPath,
                        String destChildRelPath)
Specified by:
orderBefore in interface javax.jcr.Node

removeMixin

public void removeMixin(String mixinName)
Specified by:
removeMixin in interface javax.jcr.Node

restore

public void restore(String versionName,
                    boolean removeExisting)
Specified by:
restore in interface javax.jcr.Node

restore

public void restore(javax.jcr.version.Version version,
                    boolean removeExisting)
Specified by:
restore in interface javax.jcr.Node

restore

public void restore(javax.jcr.version.Version version,
                    String relPath,
                    boolean removeExisting)
Specified by:
restore in interface javax.jcr.Node

restoreByLabel

public void restoreByLabel(String versionLabel,
                           boolean removeExisting)
Specified by:
restoreByLabel in interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(String name,
                                      javax.jcr.Value value,
                                      int type)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(String name,
                                      javax.jcr.Value[] values,
                                      int type)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(String name,
                                      String[] values,
                                      int type)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(String name,
                                      String value,
                                      int type)
Specified by:
setProperty in interface javax.jcr.Node

unlock

public void unlock()
Specified by:
unlock in interface javax.jcr.Node

update

public void update(String srcWorkspaceName)
Specified by:
update in interface javax.jcr.Node

accept

public void accept(javax.jcr.ItemVisitor visitor)
Specified by:
accept in interface javax.jcr.Item

getAncestor

public javax.jcr.Item getAncestor(int depth)
Specified by:
getAncestor in interface javax.jcr.Item

getDepth

public int getDepth()
Specified by:
getDepth in interface javax.jcr.Item

getSession

public javax.jcr.Session getSession()
Specified by:
getSession in interface javax.jcr.Item

setSession

public void setSession(javax.jcr.Session session)

isModified

public boolean isModified()
Specified by:
isModified in interface javax.jcr.Item

isNew

public boolean isNew()
Specified by:
isNew in interface javax.jcr.Item

isNode

public boolean isNode()
Specified by:
isNode in interface javax.jcr.Item

refresh

public void refresh(boolean keepChanges)
Specified by:
refresh in interface javax.jcr.Item

remove

public void remove()
Specified by:
remove in interface javax.jcr.Item

save

public void save()
Specified by:
save in interface javax.jcr.Item

followLifecycleTransition

public void followLifecycleTransition(String transition)
                               throws javax.jcr.UnsupportedRepositoryOperationException,
                                      javax.jcr.InvalidLifecycleTransitionException,
                                      javax.jcr.RepositoryException
Specified by:
followLifecycleTransition in interface javax.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 interface javax.jcr.Node
Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException

getIdentifier

public String getIdentifier()
                     throws javax.jcr.RepositoryException
Specified by:
getIdentifier in interface javax.jcr.Node
Throws:
javax.jcr.RepositoryException

getNodes

public javax.jcr.NodeIterator getNodes(String[] nameGlobs)
                                throws javax.jcr.RepositoryException
Specified by:
getNodes in interface javax.jcr.Node
Throws:
javax.jcr.RepositoryException

getProperties

public javax.jcr.PropertyIterator getProperties(String[] nameGlobs)
                                         throws javax.jcr.RepositoryException
Specified by:
getProperties in interface javax.jcr.Node
Throws:
javax.jcr.RepositoryException

getReferences

public javax.jcr.PropertyIterator getReferences(String name)
                                         throws javax.jcr.RepositoryException
Specified by:
getReferences in interface javax.jcr.Node
Throws:
javax.jcr.RepositoryException

getSharedSet

public javax.jcr.NodeIterator getSharedSet()
                                    throws javax.jcr.RepositoryException
Specified by:
getSharedSet in interface javax.jcr.Node
Throws:
javax.jcr.RepositoryException

getWeakReferences

public javax.jcr.PropertyIterator getWeakReferences()
                                             throws javax.jcr.RepositoryException
Specified by:
getWeakReferences in interface javax.jcr.Node
Throws:
javax.jcr.RepositoryException

getWeakReferences

public javax.jcr.PropertyIterator getWeakReferences(String name)
                                             throws javax.jcr.RepositoryException
Specified by:
getWeakReferences in interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.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 interface javax.jcr.Node
Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.