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 java.lang.Object
implements javax.jcr.Node


Constructor Summary
MockNode(java.lang.String path)
           
MockNode(java.lang.String path, java.lang.String type)
           
 
Method Summary
 void accept(javax.jcr.ItemVisitor visitor)
           
 void addMixin(java.lang.String mixinName)
           
 javax.jcr.Node addNode(java.lang.String relPath)
           
 javax.jcr.Node addNode(java.lang.String relPath, java.lang.String primaryNodeTypeName)
           
 boolean canAddMixin(java.lang.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(java.lang.Object obj)
           
 javax.jcr.Item getAncestor(int depth)
           
 javax.jcr.version.Version getBaseVersion()
           
 java.lang.String getCorrespondingNodePath(java.lang.String workspaceName)
           
 javax.jcr.nodetype.NodeDefinition getDefinition()
           
 int getDepth()
           
 int getIndex()
           
 javax.jcr.lock.Lock getLock()
           
 javax.jcr.nodetype.NodeType[] getMixinNodeTypes()
           
 java.lang.String getName()
           
 javax.jcr.Node getNode(java.lang.String relPath)
           
 javax.jcr.NodeIterator getNodes()
           
 javax.jcr.NodeIterator getNodes(java.lang.String namePattern)
           
 javax.jcr.Node getParent()
           
 java.lang.String getPath()
           
 javax.jcr.Item getPrimaryItem()
           
 javax.jcr.nodetype.NodeType getPrimaryNodeType()
           
 javax.jcr.PropertyIterator getProperties()
           
 javax.jcr.PropertyIterator getProperties(java.lang.String namePattern)
           
 javax.jcr.Property getProperty(java.lang.String relPath)
           
 javax.jcr.PropertyIterator getReferences()
           
 javax.jcr.Session getSession()
           
 java.lang.String getUUID()
           
 javax.jcr.version.VersionHistory getVersionHistory()
           
 int hashCode()
           
 boolean hasNode(java.lang.String relPath)
           
 boolean hasNodes()
           
 boolean hasProperties()
           
 boolean hasProperty(java.lang.String relPath)
           
 boolean holdsLock()
           
 boolean isCheckedOut()
           
 boolean isLocked()
           
 boolean isModified()
           
 boolean isNew()
           
 boolean isNode()
           
 boolean isNodeType(java.lang.String nodeTypeName)
           
 boolean isSame(javax.jcr.Item otherItem)
           
 javax.jcr.lock.Lock lock(boolean isDeep, boolean isSessionScoped)
           
 javax.jcr.NodeIterator merge(java.lang.String srcWorkspace, boolean bestEffort)
           
 void orderBefore(java.lang.String srcChildRelPath, java.lang.String destChildRelPath)
           
 void refresh(boolean keepChanges)
           
 void remove()
           
 void removeMixin(java.lang.String mixinName)
           
 void restore(java.lang.String versionName, boolean removeExisting)
           
 void restore(javax.jcr.version.Version version, boolean removeExisting)
           
 void restore(javax.jcr.version.Version version, java.lang.String relPath, boolean removeExisting)
           
 void restoreByLabel(java.lang.String versionLabel, boolean removeExisting)
           
 void save()
           
 javax.jcr.Property setProperty(java.lang.String name, boolean value)
           
 javax.jcr.Property setProperty(java.lang.String name, java.util.Calendar value)
           
 javax.jcr.Property setProperty(java.lang.String name, double value)
           
 javax.jcr.Property setProperty(java.lang.String name, java.io.InputStream value)
           
 javax.jcr.Property setProperty(java.lang.String name, long value)
           
 javax.jcr.Property setProperty(java.lang.String name, javax.jcr.Node value)
           
 javax.jcr.Property setProperty(java.lang.String name, java.lang.String value)
           
 javax.jcr.Property setProperty(java.lang.String name, java.lang.String[] values)
           
 javax.jcr.Property setProperty(java.lang.String name, java.lang.String[] values, int type)
           
 javax.jcr.Property setProperty(java.lang.String name, java.lang.String value, int type)
           
 javax.jcr.Property setProperty(java.lang.String name, javax.jcr.Value value)
           
 javax.jcr.Property setProperty(java.lang.String name, javax.jcr.Value[] values)
           
 javax.jcr.Property setProperty(java.lang.String name, javax.jcr.Value[] values, int type)
           
 javax.jcr.Property setProperty(java.lang.String name, javax.jcr.Value value, int type)
           
 java.lang.String toString()
           
 void unlock()
           
 void update(java.lang.String srcWorkspaceName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockNode

public MockNode(java.lang.String path)

MockNode

public MockNode(java.lang.String path,
                java.lang.String type)
Method Detail

getName

public java.lang.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 java.lang.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(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addMixin

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

addNode

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

addNode

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

canAddMixin

public boolean canAddMixin(java.lang.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 java.lang.String getCorrespondingNodePath(java.lang.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(java.lang.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(java.lang.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(java.lang.String namePattern)
Specified by:
getProperties in interface javax.jcr.Node

getProperty

public javax.jcr.Property getProperty(java.lang.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 java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String srcWorkspace,
                                    boolean bestEffort)
Specified by:
merge in interface javax.jcr.Node

orderBefore

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

removeMixin

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

restore

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

restoreByLabel

public void restoreByLabel(java.lang.String versionLabel,
                           boolean removeExisting)
Specified by:
restoreByLabel in interface javax.jcr.Node

setProperty

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

setProperty

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

setProperty

public javax.jcr.Property setProperty(java.lang.String name,
                                      java.lang.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(java.lang.String name,
                                      java.lang.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(java.lang.String name,
                                      java.io.InputStream value)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(java.lang.String name,
                                      boolean value)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(java.lang.String name,
                                      double value)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(java.lang.String name,
                                      long value)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

public javax.jcr.Property setProperty(java.lang.String name,
                                      java.util.Calendar value)
Specified by:
setProperty in interface javax.jcr.Node

setProperty

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

setProperty

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

setProperty

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

setProperty

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

setProperty

public javax.jcr.Property setProperty(java.lang.String name,
                                      java.lang.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(java.lang.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

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


Copyright © 2007-2009. All Rights Reserved.