org.apache.jackrabbit.test.api
Class NodeReadMethodsTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.jackrabbit.test.JUnitTest
              extended by org.apache.jackrabbit.test.AbstractJCRTest
                  extended by org.apache.jackrabbit.test.api.NodeReadMethodsTest
All Implemented Interfaces:
junit.framework.Test

public class NodeReadMethodsTest
extends AbstractJCRTest

Tests the 'read' methods specified in the Node interface on a level 1 repository.

Most tests require at least one child node under the root node, otherwise a NotExecutableException is thrown.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
helper, isReadOnly, jcrBaseVersion, jcrCreated, jcrFrozenNode, jcrFrozenUuid, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testPath, testRoot, testRootNode, workspaceName
 
Fields inherited from class org.apache.jackrabbit.test.JUnitTest
log
 
Constructor Summary
NodeReadMethodsTest()
           
 
Method Summary
protected  void setUp()
          Sets up the fixture for this test.
protected  void tearDown()
          Releases the session aquired in setUp().
 void testAccept()
           
 void testGetAncestorOfGreaterDepth()
          Test if getting the ancestor of depth = n, where n is greater than depth of this Node, throws an ItemNotFoundException.
 void testGetAncestorOfNegativeDepth()
          Test if getting the ancestor of negative depth throws an ItemNotFoundException.
 void testGetAncestorOfNodeDepth()
          Test if the ancestor at depth = n, where n is the depth of this Item, returns this Node itself.
 void testGetDepth()
          Tests if depth of root is 0 and depth of a sub node of root is 1
 void testGetIndex()
          Test if getIndex() returns the correct index.
 void testGetName()
          Tests if getName() returns same as last name returned by getPath()
 void testGetNode()
          Test if getNode(String relPath) returns the correct node and if a PathNotFoundException is thrown when Node at relPath does not exist
 void testGetNodes()
          Test if all returned items are of type node.
 void testGetNodesNamePattern()
          Test getNodes(String namePattern) with all possible patterns.
 void testGetParent()
          Tests if getParent() returns parent node
 void testGetParentOfRoot()
          Tests if getParent() of root throws an ItemNotFoundException
 void testGetPath()
          Tests if getPath() returns the correct path.
 void testGetPrimaryItem()
          Test if getPrimaryItem returns the primary item as defined in the primary node type.
 void testGetPrimaryItemItemNotFoundException()
          Test if getPrimaryItem does throw an ItemNotFoundException if the primary node type does not define a primary item.
 void testGetProperties()
          Test if all returned items are of type node.
 void testGetPropertiesNamePattern()
          Test getProperties(String namePattern) with all possible patterns.
 void testGetProperty()
          Test if getProperty(String relPath) returns the correct node and if a PathNotFoundException is thrown when property at relPath does not exist
 void testGetReferences()
           
 void testGetSession()
          Tests if getSession() is same as through which the Item was acquired
 void testGetUUID()
          Test if getUUID() returns the string value of the property "jcr:uuid".
 void testGetUUIDOfNonReferenceableNode()
          Test if getUUID() throws a UnsupportedRepositoryOperationException if Node is not referenceable
 void testHasNode()
          Test if hasNode(String relPath) returns true if the required node exists and false if it doesn't.
 void testHasNodes()
          Test if hasNodes() returns true if any sub node exists or false if not.
 void testHasProperties()
          Test if hasProperty() returns true if any property exists or false if not.
 void testHasProperty()
          Test if hasProperty(String relPath) returns true if a required property exists and false if it doesn't.
 void testIsNode()
          Tests if isNode() returns true
 void testIsSame()
          Tests if isSame() returns true when retrieving an item through different sessions
 
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureMultipleWorkspacesSupported, getNonExistingWorkspaceName, getProperty, getSize, isSupported, needsMixin, run
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeReadMethodsTest

public NodeReadMethodsTest()
Method Detail

setUp

protected void setUp()
              throws Exception
Sets up the fixture for this test.

Overrides:
setUp in class AbstractJCRTest
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Releases the session aquired in setUp().

Overrides:
tearDown in class AbstractJCRTest
Throws:
Exception

testGetPath

public void testGetPath()
                 throws NotExecutableException,
                        RepositoryException
Tests if getPath() returns the correct path.

Throws:
NotExecutableException
RepositoryException

testGetName

public void testGetName()
                 throws RepositoryException,
                        NotExecutableException
Tests if getName() returns same as last name returned by getPath()

Throws:
RepositoryException
NotExecutableException

testGetAncestorOfNodeDepth

public void testGetAncestorOfNodeDepth()
                                throws RepositoryException
Test if the ancestor at depth = n, where n is the depth of this Item, returns this Node itself.

Throws:
RepositoryException

testGetAncestorOfGreaterDepth

public void testGetAncestorOfGreaterDepth()
                                   throws RepositoryException
Test if getting the ancestor of depth = n, where n is greater than depth of this Node, throws an ItemNotFoundException.

Throws:
RepositoryException

testGetAncestorOfNegativeDepth

public void testGetAncestorOfNegativeDepth()
                                    throws RepositoryException
Test if getting the ancestor of negative depth throws an ItemNotFoundException.

Throws:
RepositoryException

testGetParent

public void testGetParent()
                   throws NotExecutableException,
                          RepositoryException
Tests if getParent() returns parent node

Throws:
NotExecutableException
RepositoryException

testGetParentOfRoot

public void testGetParentOfRoot()
                         throws RepositoryException
Tests if getParent() of root throws an ItemNotFoundException

Throws:
RepositoryException

testGetDepth

public void testGetDepth()
                  throws RepositoryException
Tests if depth of root is 0 and depth of a sub node of root is 1

Throws:
RepositoryException

testGetSession

public void testGetSession()
                    throws RepositoryException
Tests if getSession() is same as through which the Item was acquired

Throws:
RepositoryException

testIsNode

public void testIsNode()
Tests if isNode() returns true


testIsSame

public void testIsSame()
                throws RepositoryException
Tests if isSame() returns true when retrieving an item through different sessions

Throws:
RepositoryException

testAccept

public void testAccept()
                throws RepositoryException
Throws:
RepositoryException

testGetNode

public void testGetNode()
                 throws NotExecutableException,
                        RepositoryException
Test if getNode(String relPath) returns the correct node and if a PathNotFoundException is thrown when Node at relPath does not exist

Throws:
NotExecutableException
RepositoryException

testGetNodes

public void testGetNodes()
                  throws RepositoryException
Test if all returned items are of type node.

Throws:
RepositoryException

testGetNodesNamePattern

public void testGetNodesNamePattern()
                             throws NotExecutableException,
                                    RepositoryException
Test getNodes(String namePattern) with all possible patterns. Tested node: root - NotExecutableException is thrown when root node has no sub nodes.

Throws:
NotExecutableException
RepositoryException

testGetProperty

public void testGetProperty()
                     throws NotExecutableException,
                            RepositoryException
Test if getProperty(String relPath) returns the correct node and if a PathNotFoundException is thrown when property at relPath does not exist

Throws:
NotExecutableException
RepositoryException

testGetProperties

public void testGetProperties()
                       throws RepositoryException
Test if all returned items are of type node.

Throws:
RepositoryException

testGetPropertiesNamePattern

public void testGetPropertiesNamePattern()
                                  throws NotExecutableException,
                                         RepositoryException
Test getProperties(String namePattern) with all possible patterns. Tested node: root - a NotExecutableException is thrown when root node has no properties.

Throws:
NotExecutableException
RepositoryException

testGetPrimaryItem

public void testGetPrimaryItem()
                        throws NotExecutableException,
                               RepositoryException
Test if getPrimaryItem returns the primary item as defined in the primary node type. Therefor a node with a primary item is located recursively in the entire repository. A NotExecutableException is thrown when no such node is found.

Throws:
NotExecutableException
RepositoryException

testGetPrimaryItemItemNotFoundException

public void testGetPrimaryItemItemNotFoundException()
                                             throws NotExecutableException,
                                                    RepositoryException
Test if getPrimaryItem does throw an ItemNotFoundException if the primary node type does not define a primary item. Therefor a node without a primary item is located recursively in the entire repository. A NotExecutableException is thrown when no such node is found.

Throws:
NotExecutableException
RepositoryException

testGetIndex

public void testGetIndex()
                  throws RepositoryException
Test if getIndex() returns the correct index. Therefor a node with same name sibling is located recursively in the entire repository. If no such node is found, the test checks if the testRootNode returns 1

Throws:
RepositoryException

testGetReferences

public void testGetReferences()
                       throws NotExecutableException,
                              RepositoryException
Throws:
NotExecutableException
RepositoryException

testGetUUID

public void testGetUUID()
                 throws NotExecutableException,
                        RepositoryException
Test if getUUID() returns the string value of the property "jcr:uuid". Therefor a node of type "mix:referenceable" is located recursively in the entire repository. A NotExecutableException is thrown when no node of this type is found.

Throws:
NotExecutableException
RepositoryException

testGetUUIDOfNonReferenceableNode

public void testGetUUIDOfNonReferenceableNode()
                                       throws NotExecutableException,
                                              RepositoryException
Test if getUUID() throws a UnsupportedRepositoryOperationException if Node is not referenceable

Throws:
NotExecutableException
RepositoryException

testHasNode

public void testHasNode()
                 throws NotExecutableException,
                        RepositoryException
Test if hasNode(String relPath) returns true if the required node exists and false if it doesn't. Tested node: root

Throws:
NotExecutableException
RepositoryException

testHasNodes

public void testHasNodes()
                  throws RepositoryException
Test if hasNodes() returns true if any sub node exists or false if not. Tested node: root

Throws:
RepositoryException

testHasProperty

public void testHasProperty()
                     throws NotExecutableException,
                            RepositoryException
Test if hasProperty(String relPath) returns true if a required property exists and false if it doesn't. Tested node: root

Throws:
NotExecutableException
RepositoryException

testHasProperties

public void testHasProperties()
                       throws RepositoryException
Test if hasProperty() returns true if any property exists or false if not. Tested node: root

Throws:
RepositoryException


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.