public class NodeTest extends AbstractJCRTest
NodeTest contains all test cases for the
javax.jcr.Node that are related to writing, modifying or deleting
nodes (level 2 of the specification).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 and Description |
|---|
NodeTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
setUp()
to be able to test the update(String) and getCorrespondingNodePath(String)
methods we need an additional workspace
|
void |
tearDown()
remove all nodes in second workspace and log out
|
void |
testAddNodeConstraintViolationExceptionProperty()
Tries to add a node using
Node.addNode(String) as a
child of a property. |
void |
testAddNodeConstraintViolationExceptionUndefinedNodeType()
Tries to add a node using
Node.addNode(String) where
node type can not be determined by parent (nt:base is used
as parent nodetype). |
void |
testAddNodeItemExistsException()
Tries to create a node using
Node.addNode(String,
String) at a location where there is already a node with same name and
the parent does not allow same name siblings. |
void |
testAddNodeParentSave()
Creates a new node using
Node.addNode(String) , saves using
Item.save() on parent node. |
void |
testAddNodePathNotFoundException()
Tries to add a node using
Node.addNode(String) to a non
existing destination node. |
void |
testAddNodeRepositoryExceptionRelPathIndex()
Adds a new node using
Node.addNode(String) with an
index for the new name. |
void |
testAddNodeRepositoryExceptionSaveOnNewNode()
Creates a new node using
Node.addNode(String), then tries to call
Item.save() on the newly node. |
void |
testAddNodeSessionSave()
Creates a new node using
Node.addNode(String) , saves using
Session.save(). |
void |
testGetCorrespondingNodePath()
Creates a node with same path in both workspaces to check if
Node.getCorrespondingNodePath(String) works properly. |
void |
testGetCorrespondingNodePathItemNotFoundException()
Calls
Node.getCorrespondingNodePath(String) on a node
that has no corresponding node in second workspace |
void |
testGetCorrespondingNodePathNoSuchWorkspaceException()
Calls
Node.getCorrespondingNodePath(String ) with a non
existing workspace. |
void |
testIsModified()
Checks if
Item.isModified() works correctly for unmodified and
modified nodes. |
void |
testIsNew()
Checks if
Item.isNew() works correctly for new and existing,
unmodified nodes. |
void |
testIsSameMustNotCompareStates()
Tests if
Item.isSame(Item otherItem) will return true when
two Node objects representing the same actual repository
item have been retrieved through two different sessions and one has been
modified. |
void |
testMixinTypesProtected()
Tests if jcr:mixinTypes is protected
|
void |
testNodeIdentity()
Tests object identity, meaning two nodes objects acquired through the
same session must have the same properties and states.
|
void |
testNodeSave()
Creates a new node, saves it uses second session to verify if node has
been added.
|
void |
testPrimaryType()
Tests if the primary node type is properly stored in jcr:primaryType
|
void |
testPrimaryTypeProtected()
Tests if jcr:primaryType is protected
|
void |
testRefreshBooleanFalse()
|
void |
testRefreshBooleanTrue()
|
void |
testRefreshInvalidItemStateException()
Tries to call
Item.refresh(boolean) on a deleted node. |
void |
testRemoveInvalidItemStateException()
Removes a node using
Item.remove() with session 1,
afterwards it tries the same with session 2. |
void |
testRemoveMandatoryNode()
Creates a node with a mandatory child node using
Node.addNode(String, String), saves on parent node then tries to delete
the mandatory child node. |
void |
testRemoveNodeLockedItself()
Tests if
Node.remove() does not throw a
LockException if Node is locked. |
void |
testRemoveNodeParentLocked()
Tests if
Node.remove() throws a LockException
if the parent node of Node is locked. |
void |
testRemoveNodeParentSave()
Removes a node using
Item.remove(), then saves with
parent's nodes Item.save() method. |
void |
testRemoveNodeSessionSave()
Removes a node using
Item.remove(), then saves using
Session.save() method. |
void |
testSaveConstraintViolationException()
Tries to create and save a node using
Item.save() with
an mandatory property that is not set on saving time. |
void |
testSaveInvalidStateException()
Tries to save a node using
Item.save() that was already
deleted by an other session. |
void |
testSaveOnNewNodeRepositoryException()
Tests if a
RepositoryException is thrown when calling
Node.save() on a newly added node |
void |
testUpdate()
Checks if
Node.update(String) works properly by
creating the same node in two workspaces one with a child node the other
with a property set. |
void |
testUpdateInvalidItemStateException()
Tries calling
Node.update(String) after node has
changed in first workspace but not been saved yet. |
void |
testUpdateNoClone()
Calls
Node.update(String) for a node that only exists
in current workspace. |
void |
testUpdateNoSuchWorkspaceException()
Tries to use
Node.update(String) with an invalid
workspace. |
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureLockingSupported, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getPrefix, getProperty, getProperty, getQualifiedName, getSize, isSupported, needsMixin, runassertEquals, 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, toStringpublic void setUp()
throws Exception
setUp in class AbstractJCRTestExceptionpublic void tearDown()
throws Exception
tearDown in class AbstractJCRTestExceptionpublic void testGetCorrespondingNodePathNoSuchWorkspaceException()
throws RepositoryException
Node.getCorrespondingNodePath(String ) with a non
existing workspace.
This should throw an NoSuchWorkspaceException.
RepositoryExceptionpublic void testGetCorrespondingNodePathItemNotFoundException()
throws RepositoryException,
NotExecutableException
Node.getCorrespondingNodePath(String) on a node
that has no corresponding node in second workspacepublic void testGetCorrespondingNodePath()
throws RepositoryException,
NotExecutableException
Node.getCorrespondingNodePath(String) works properly.public void testUpdateInvalidItemStateException()
throws RepositoryException,
NotExecutableException
Node.update(String) after node has
changed in first workspace but not been saved yet.
This should throw an InvalidItemStateException.
Prerequisites:
javax.jcr.tck.propertyname1 name of
a String property that can be modified in javax.jcr.tck.nodetype
for testingpublic void testUpdateNoSuchWorkspaceException()
throws RepositoryException
Node.update(String) with an invalid
workspace.
This should throw an NoSuchWorkspaceException.
RepositoryExceptionpublic void testUpdateNoClone()
throws RepositoryException
Node.update(String) for a node that only exists
in current workspace. Prerequisites:
javax.jcr.tck.propertyname1
name of a String property that can be modified in
javax.jcr.tck.nodetype for testingRepositoryExceptionpublic void testUpdate()
throws RepositoryException,
NotExecutableException
Node.update(String) works properly by
creating the same node in two workspaces one with a child node the other
with a property set.
Calling update() on the node
with properties, should remove the properties and add the child node.
Prerequisites:
javax.jcr.tck.nodetype
must allow children of same nodetype. javax.jcr.tck.propertyname1
name of a String property that can be modified in
javax.jcr.tck.nodetype for testingpublic void testAddNodeConstraintViolationExceptionUndefinedNodeType()
throws RepositoryException
Node.addNode(String) where
node type can not be determined by parent (nt:base is used
as parent nodetype).
This should throw a ConstraintViolationException.
RepositoryExceptionpublic void testAddNodeConstraintViolationExceptionProperty()
throws RepositoryException
Node.addNode(String) as a
child of a property.
This should throw an ConstraintViolationException.
Prerequisites:
javax.jcr.tck.propertyname1
name of a String property that can be set in javax.jcr.tck.nodetype
for testingRepositoryExceptionpublic void testAddNodeItemExistsException()
throws RepositoryException
Node.addNode(String,
String) at a location where there is already a node with same name and
the parent does not allow same name siblings.
This should throw an ItemExistsException.
Prerequisites:
javax.jcr.tck.NodeTest.testAddNodeItemExistsException.nodetype
node type that does not allow same name siblings and allows to add child
nodes of the same type.RepositoryExceptionpublic void testAddNodePathNotFoundException()
throws RepositoryException
Node.addNode(String) to a non
existing destination node.
This should throw an PathNotFoundException.
RepositoryExceptionpublic void testAddNodeRepositoryExceptionRelPathIndex()
throws RepositoryException
Node.addNode(String) with an
index for the new name.
This should throw an RepositoryException.
RepositoryExceptionpublic void testAddNodeRepositoryExceptionSaveOnNewNode()
throws RepositoryException
Node.addNode(String), then tries to call
Item.save() on the newly node.
This should throw an RepositoryException.
RepositoryExceptionpublic void testAddNodeParentSave()
throws RepositoryException
Node.addNode(String) , saves using
Item.save() on parent node. Uses a second session to
verify if the node has been saved.RepositoryExceptionpublic void testAddNodeSessionSave()
throws RepositoryException
Node.addNode(String) , saves using
Session.save(). Uses a second session to verify if the
node has been saved.RepositoryExceptionpublic void testRemoveMandatoryNode()
throws RepositoryException
Node.addNode(String, String), saves on parent node then tries to delete
the mandatory child node.
This should throw a ConstraintViolationException.
Prerequisites:
javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype2
a node type that has a mandatory child nodejavax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype3
nodetype of the mandatory child nodejavax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodename3
name of the mandatory child nodeRepositoryExceptionpublic void testRemoveInvalidItemStateException()
throws RepositoryException
Item.remove() with session 1,
afterwards it tries the same with session 2.
This should throw an InvalidItemStateException.
RepositoryExceptionpublic void testRemoveNodeParentSave()
throws RepositoryException
Item.remove(), then saves with
parent's nodes Item.save() method.RepositoryExceptionpublic void testRemoveNodeSessionSave()
throws RepositoryException
Item.remove(), then saves using
Session.save() method.RepositoryExceptionpublic void testRemoveNodeLockedItself()
throws LockException,
NotExecutableException,
RepositoryException
Node.remove() does not throw a
LockException if Node is locked.
The test creates a node nodeName1 of type
testNodeType under testRoot and locks the node
with the superuser session. Then the test removes
nodeName1.
public void testRemoveNodeParentLocked()
throws LockException,
NotExecutableException,
RepositoryException
Node.remove() throws a LockException
if the parent node of Node is locked.
The test creates a node nodeName1 of type
testNodeType under testRoot, adds a child node
nodeName2 and locks it with the superuser session. Then the
test tries to remove the nodeName2.
public void testNodeIdentity()
throws RepositoryException
Prerequisites:
javax.jcr.tck.nodetype must allow
children of same node typejavax.jcr.tck.propertyname1
name of a String property that can be set in javax.jcr.tck.nodetype
for testingRepositoryExceptionpublic void testIsSameMustNotCompareStates()
throws RepositoryException
Item.isSame(Item otherItem) will return true when
two Node objects representing the same actual repository
item have been retrieved through two different sessions and one has been
modified.RepositoryExceptionpublic void testIsModified()
throws RepositoryException
Item.isModified() works correctly for unmodified and
modified nodes.RepositoryExceptionpublic void testIsNew()
throws RepositoryException
Item.isNew() works correctly for new and existing,
unmodified nodes.RepositoryExceptionpublic void testRefreshInvalidItemStateException()
throws RepositoryException
Item.refresh(boolean) on a deleted node.
This should throw an InvalidItemStateException.
RepositoryExceptionpublic void testRefreshBooleanFalse()
throws RepositoryException
Item.refresh(boolean refresh) works properly
with refresh set to false.
Procedure:
Item.save()Node.refresh(false)
on root node in session 1Prerequisites:
javax.jcr.tck.nodetype
must accept children of same nodetypeRepositoryExceptionpublic void testRefreshBooleanTrue()
throws RepositoryException
Item.refresh(boolean refresh) works properly
with refresh set to true.
Procedure:
Item.save()Node.refresh(true) on
root node in session 1Prerequisites:
javax.jcr.tck.nodetype must accept children of same
nodetypeRepositoryExceptionpublic void testSaveInvalidStateException()
throws RepositoryException
Item.save() that was already
deleted by an other session.
Procedure:
Node.save() on root node .InvalidItemStateException.
Prerequisites:
javax.jcr.tck.nodetype
must accept children of same nodetypeRepositoryExceptionpublic void testSaveConstraintViolationException()
throws RepositoryException
Item.save() with
an mandatory property that is not set on saving time.
Prerequisites:
javax.jcr.tck.Node.testSaveConstraintViolationException.nodetype2
must reference a nodetype that has at least one property that is
mandatory but not autocreatedRepositoryExceptionpublic void testNodeSave()
throws RepositoryException
RepositoryExceptionpublic void testSaveOnNewNodeRepositoryException()
throws Exception
RepositoryException is thrown when calling
Node.save() on a newly added nodeExceptionpublic void testPrimaryType()
throws Exception
Exceptionpublic void testPrimaryTypeProtected()
throws Exception
ExceptionCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.