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
  • Constructor Details

    • MockNode

      public MockNode(String path)
    • MockNode

      public MockNode(String path, String type)
  • Method Details

    • 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