|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.apache.jackrabbit.test.JUnitTest org.apache.jackrabbit.test.AbstractJCRTest org.apache.jackrabbit.test.api.NodeTest
public class NodeTest
NodeTest
contains all test cases for the
javax.jcr.Node
that are related to writing, modifing or deleting
nodes (level 2 of the specification).
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, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntUnstructured, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testPath, testRoot, testRootNode, vf, workspaceName |
Fields inherited from class org.apache.jackrabbit.test.JUnitTest |
---|
log |
Constructor Summary | |
---|---|
NodeTest()
|
Method Summary | |
---|---|
void |
setUp()
to be able to test the update(String) and getCorrespondingNodePath(String) methods we need an addtional 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 correcty 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 accuired 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()
Checks if Item.refresh(boolean refresh) works properly
with refresh set to false . |
void |
testRefreshBooleanTrue()
Checks if Item.refresh(boolean refresh) works properly
with refresh set to true . |
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 |
testSaveContstraintViolationException()
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. |
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest |
---|
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getProperty, 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 |
---|
public NodeTest()
Method Detail |
---|
public void setUp() throws Exception
setUp
in class AbstractJCRTest
Exception
public void tearDown() throws Exception
tearDown
in class AbstractJCRTest
Exception
public void testGetCorrespondingNodePathNoSuchWorkspaceException() throws RepositoryException
Node.getCorrespondingNodePath(String )
with a non
existing workspace.
This should throw an NoSuchWorkspaceException
.
RepositoryException
public void testGetCorrespondingNodePathItemNotFoundException() throws RepositoryException, NotExecutableException
Node.getCorrespondingNodePath(String)
on a node
that has no corresponding node in second workspace
RepositoryException
NotExecutableException
public void testGetCorrespondingNodePath() throws RepositoryException, NotExecutableException
Node.getCorrespondingNodePath(String)
works properly.
RepositoryException
NotExecutableException
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 testing
RepositoryException
NotExecutableException
public void testUpdateNoSuchWorkspaceException() throws RepositoryException
Node.update(String)
with an invalid
workspace.
This should throw an NoSuchWorkspaceException
.
RepositoryException
public 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 testing
RepositoryException
public 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 testing
RepositoryException
NotExecutableException
public 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
.
RepositoryException
public 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 testing
RepositoryException
public 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.
RepositoryException
public void testAddNodePathNotFoundException() throws RepositoryException
Node.addNode(String)
to a non
existing destination node.
This should throw an PathNotFoundException
.
RepositoryException
public void testAddNodeRepositoryExceptionRelPathIndex() throws RepositoryException
Node.addNode(String)
with an
index for the new name.
This should throw an RepositoryException
.
RepositoryException
public void testAddNodeRepositoryExceptionSaveOnNewNode() throws RepositoryException
Node.addNode(String)
, then tries to call
Item.save()
on the newly node.
This should throw an RepositoryException
.
RepositoryException
public 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 safed.
RepositoryException
public void testAddNodeSessionSave() throws RepositoryException
Node.addNode(String)
, saves using
Session.save()
. Uses a second session to verify if the
node has been safed.
RepositoryException
public 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 node
RepositoryException
public void testRemoveInvalidItemStateException() throws RepositoryException
Item.remove()
with session 1,
afterwards it tries the same with session 2.
This should throw an InvalidItemStateException
.
RepositoryException
public void testRemoveNodeParentSave() throws RepositoryException
Item.remove()
, then saves with
parent's nodes Item.save()
method.
RepositoryException
public void testRemoveNodeSessionSave() throws RepositoryException
Item.remove()
, then saves using
Session.save()
method.
RepositoryException
public 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
.
LockException
NotExecutableException
RepositoryException
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
.
LockException
NotExecutableException
RepositoryException
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 testing
RepositoryException
public 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.
RepositoryException
public void testIsModified() throws RepositoryException
Item.isModified()
works correcty for unmodified and
modified nodes.
RepositoryException
public void testIsNew() throws RepositoryException
Item.isNew()
works correctly for new and existing,
unmodified nodes.
RepositoryException
public void testRefreshInvalidItemStateException() throws RepositoryException
Item.refresh(boolean)
on a deleted node.
This should throw an InvalidItemStateException
.
RepositoryException
public 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 nodetype
RepositoryException
public 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
nodetype
RepositoryException
public 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 nodetype
RepositoryException
public void testSaveContstraintViolationException() throws RepositoryException
Item.save()
with
an mandatory property that is not set on saving time.
Prerequisites:
javax.jcr.tck.Node.testSaveContstraintViolationException.nodetype2
must reference a nodetype that has at least one property that is
mandatory but not autocreated
RepositoryException
public void testNodeSave() throws RepositoryException
RepositoryException
public void testSaveOnNewNodeRepositoryException() throws Exception
RepositoryException
is thrown when calling
Node.save()
on a newly added node
Exception
public void testPrimaryType() throws Exception
Exception
public void testPrimaryTypeProtected() throws Exception
Exception
public void testMixinTypesProtected() throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |