Package org.apache.jackrabbit.test.api
Class NodeReadMethodsTest
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.apache.jackrabbit.test.JUnitTest
-
- org.apache.jackrabbit.test.AbstractJCRTest
-
- org.apache.jackrabbit.test.api.NodeReadMethodsTest
-
- All Implemented Interfaces:
junit.framework.Test
public class NodeReadMethodsTest extends AbstractJCRTest
Tests the 'read' methods specified in theNodeinterface on a level 1 repository.Most tests require at least one child node under the root node, otherwise a
NotExecutableExceptionis thrown.
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
isReadOnly, jcrBaseVersion, jcrCopiedFrom, jcrCreated, jcrFrozenNode, jcrFrozenUuid, jcrIsCheckedOut, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixShareable, mixSimpleVersionable, mixTitle, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntActivity, ntBase, ntFrozenNode, ntQuery, ntUnstructured, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testNodeTypeTestRoot, testPath, testRoot, testRootNode, vf, workspaceName
-
-
Constructor Summary
Constructors Constructor Description NodeReadMethodsTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidsetUp()Sets up the fixture for this test.protected voidtearDown()Releases the session aquired insetUp().voidtestAccept()voidtestGetAncestorOfGreaterDepth()Test if getting the ancestor of depth = n, where n is greater than depth of thisNode, throws anItemNotFoundException.voidtestGetAncestorOfNegativeDepth()Test if getting the ancestor of negative depth throws anItemNotFoundException.voidtestGetAncestorOfNodeDepth()Test if the ancestor at depth = n, where n is the depth of thisItem, returns thisNodeitself.voidtestGetDepth()Tests if depth of root is 0 and depth of a sub node of root is 1voidtestGetIndex()Test if getIndex() returns the correct index.voidtestGetName()Tests if getName() returns same as last name returned by getPath()voidtestGetNode()Test if getNode(String relPath) returns the correct node and if a PathNotFoundException is thrown when Node at relPath does not existvoidtestGetNodes()Test if all returned items are of type node.voidtestGetNodesNamePattern()Test getNodes(String namePattern) with all possible patterns.voidtestGetNodesNamePatternArray()Test getNodes(String[] namePattern) with all possible patterns.voidtestGetParent()Tests if getParent() returns parent nodevoidtestGetParentOfRoot()Tests if getParent() of root throws an ItemNotFoundExceptionvoidtestGetPath()Tests if getPath() returns the correct path.voidtestGetPrimaryItem()Test if getPrimaryItem returns the primary item as defined in the primary node type.voidtestGetPrimaryItemItemNotFoundException()Test if getPrimaryItem does throw an ItemNotFoundException if the primary node type does not define a primary item.voidtestGetProperties()Test if all returned items are of type node.voidtestGetPropertiesNamePattern()Test getProperties(String namePattern) with all possible patterns.voidtestGetPropertiesNamePatternArray()Test getProperties(String[] namePattern) with all possible patterns.voidtestGetProperty()Test if getProperty(String relPath) returns the correct node and if a PathNotFoundException is thrown when property at relPath does not existvoidtestGetReferences()voidtestGetSession()Tests if getSession() is same as through which the Item was acquiredvoidtestGetUUID()Test if getUUID() returns the string value of the property "jcr:uuid".voidtestGetUUIDOfNonReferenceableNode()Test if getUUID() throws a UnsupportedRepositoryOperationException if Node is not referenceablevoidtestHasNode()Test if hasNode(String relPath) returns true if the required node exists and false if it doesn't.voidtestHasNodes()Test if hasNodes() returns true if any sub node exists or false if not.voidtestHasProperties()Test if hasProperty() returns true if any property exists or false if not.voidtestHasProperty()Test if hasProperty(String relPath) returns true if a required property exists and false if it doesn't.voidtestIsNode()Tests if isNode() returns truevoidtestIsSame()Tests if isSame() returns true when retrieving an item through different sessions-
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureLockingSupported, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getPrefix, getProperty, getProperty, getQualifiedName, getSize, isSupported, needsMixin, run
-
Methods inherited from class junit.framework.TestCase
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, runBare, runTest, setName, toString
-
-
-
-
Method Detail
-
setUp
protected void setUp() throws ExceptionSets up the fixture for this test.- Overrides:
setUpin classAbstractJCRTest- Throws:
Exception
-
tearDown
protected void tearDown() throws ExceptionReleases the session aquired insetUp().- Overrides:
tearDownin classAbstractJCRTest- Throws:
Exception
-
testGetPath
public void testGetPath() throws NotExecutableException, RepositoryExceptionTests if getPath() returns the correct path.
-
testGetName
public void testGetName() throws RepositoryException, NotExecutableExceptionTests if getName() returns same as last name returned by getPath()
-
testGetAncestorOfNodeDepth
public void testGetAncestorOfNodeDepth() throws RepositoryExceptionTest if the ancestor at depth = n, where n is the depth of thisItem, returns thisNodeitself.- Throws:
RepositoryException
-
testGetAncestorOfGreaterDepth
public void testGetAncestorOfGreaterDepth() throws RepositoryExceptionTest if getting the ancestor of depth = n, where n is greater than depth of thisNode, throws anItemNotFoundException.- Throws:
RepositoryException
-
testGetAncestorOfNegativeDepth
public void testGetAncestorOfNegativeDepth() throws RepositoryExceptionTest if getting the ancestor of negative depth throws anItemNotFoundException.- Throws:
RepositoryException
-
testGetParent
public void testGetParent() throws NotExecutableException, RepositoryExceptionTests if getParent() returns parent node
-
testGetParentOfRoot
public void testGetParentOfRoot() throws RepositoryExceptionTests if getParent() of root throws an ItemNotFoundException- Throws:
RepositoryException
-
testGetDepth
public void testGetDepth() throws RepositoryExceptionTests if depth of root is 0 and depth of a sub node of root is 1- Throws:
RepositoryException
-
testGetSession
public void testGetSession() throws RepositoryExceptionTests 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 RepositoryExceptionTests 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, RepositoryExceptionTest if getNode(String relPath) returns the correct node and if a PathNotFoundException is thrown when Node at relPath does not exist
-
testGetNodes
public void testGetNodes() throws RepositoryExceptionTest if all returned items are of type node.- Throws:
RepositoryException
-
testGetNodesNamePattern
public void testGetNodesNamePattern() throws NotExecutableException, RepositoryExceptionTest getNodes(String namePattern) with all possible patterns. Tested node: root - NotExecutableException is thrown when root node has no sub nodes.
-
testGetNodesNamePatternArray
public void testGetNodesNamePatternArray() throws NotExecutableException, RepositoryExceptionTest getNodes(String[] namePattern) with all possible patterns. Tested node: root- Throws:
NotExecutableException- is thrown when root node has no sub nodes.RepositoryException
-
testGetProperty
public void testGetProperty() throws NotExecutableException, RepositoryExceptionTest if getProperty(String relPath) returns the correct node and if a PathNotFoundException is thrown when property at relPath does not exist
-
testGetProperties
public void testGetProperties() throws RepositoryExceptionTest if all returned items are of type node.- Throws:
RepositoryException
-
testGetPropertiesNamePattern
public void testGetPropertiesNamePattern() throws NotExecutableException, RepositoryExceptionTest getProperties(String namePattern) with all possible patterns. Tested node: root - a NotExecutableException is thrown when root node has no properties.
-
testGetPropertiesNamePatternArray
public void testGetPropertiesNamePatternArray() throws NotExecutableException, RepositoryExceptionTest getProperties(String[] namePattern) with all possible patterns.- Throws:
NotExecutableException- is thrown when root node has no properties.RepositoryException
-
testGetPrimaryItem
public void testGetPrimaryItem() throws NotExecutableException, RepositoryExceptionTest 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.
-
testGetPrimaryItemItemNotFoundException
public void testGetPrimaryItemItemNotFoundException() throws NotExecutableException, RepositoryExceptionTest 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.
-
testGetIndex
public void testGetIndex() throws RepositoryExceptionTest 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
-
testGetUUID
public void testGetUUID() throws NotExecutableException, RepositoryExceptionTest 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.
-
testGetUUIDOfNonReferenceableNode
public void testGetUUIDOfNonReferenceableNode() throws NotExecutableException, RepositoryExceptionTest if getUUID() throws a UnsupportedRepositoryOperationException if Node is not referenceable
-
testHasNode
public void testHasNode() throws NotExecutableException, RepositoryExceptionTest if hasNode(String relPath) returns true if the required node exists and false if it doesn't. Tested node: root
-
testHasNodes
public void testHasNodes() throws RepositoryExceptionTest if hasNodes() returns true if any sub node exists or false if not. Tested node: root- Throws:
RepositoryException
-
testHasProperty
public void testHasProperty() throws NotExecutableException, RepositoryExceptionTest if hasProperty(String relPath) returns true if a required property exists and false if it doesn't. Tested node: root
-
testHasProperties
public void testHasProperties() throws RepositoryExceptionTest if hasProperty() returns true if any property exists or false if not. Tested node: root- Throws:
RepositoryException
-
-