public class SessionTest extends AbstractJCRTest
SessionTest contains all test cases for the
javax.jcr.Session class that are level 2 (modifing repository
content).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| Constructor and Description |
|---|
SessionTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
testHasCapability()
Checks if
Session.hasCapability(String, Object, Object[])
works as specified. |
void |
testHasPendingChanges()
Checks if
Session.hasPendingChanges() works
properly. |
void |
testMoveConstraintViolationExceptionDest()
Moves a node using
Session.move(String src, String dest),
afterwards it tries to only save the destination parent
node. |
void |
testMoveConstraintViolationExceptionSrc()
Moves a node using
Session.move(String src, String dest),
afterwards it tries to only save the old parent node. |
void |
testMoveItemExistsException()
Tries to move a node using
Session.move(String src, String dest)
to a location where a node already exists with
same name. |
void |
testMoveLockException()
Calls
Session.move(String src, String dest) where
the parent node of src is locked. |
void |
testMoveNode()
Checks if
Session.move(String src, String dest)
works properly. |
void |
testMovePathNotFoundExceptionDestInvalid()
Calls
Session.move(String src, String dest)
with invalid destination path. |
void |
testMovePathNotFoundExceptionSrcInvalid()
Calls
Session.move(String src, String dest) with
invalid source path. |
void |
testMoveRepositoryException()
Calls
Session.move(String src, String dest)
with a destination path that has an index postfixed. |
void |
testRefreshBooleanFalse()
|
void |
testRefreshBooleanTrue()
|
void |
testSaveContstraintViolationException()
Tries to create and save a node using
Session.save()
with an mandatory property that is not set on saving time. |
void |
testSaveInvalidStateException()
Tries to save a node using
Session.save() that was
already deleted by an other session. |
void |
testSaveModifiedNode()
Checks if a modified node gets properly saved using
. |
void |
testSaveNewNode()
Checks if a newly created node gets properly saved using
. |
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getProperty, getProperty, getSize, isSupported, needsMixin, run, setUp, tearDowncountTestCases, createResult, getName, run, runBare, runTest, setName, toStringassertEquals, 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, failNotEquals, failNotSame, failSame, formatpublic void testMoveItemExistsException()
throws RepositoryException
Session.move(String src, String dest)
to a location where a node already exists with
same name.
Prerequisites:
javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype2
must contain name of a nodetype that does not allow same name sibling
child nodes.javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype3
must contain name of a valid nodetype that can be added as a child of
nodetype2
This should throw an ItemExistsException.
RepositoryExceptionpublic void testMovePathNotFoundExceptionDestInvalid()
throws RepositoryException
Session.move(String src, String dest)
with invalid destination path.
Should throw a PathNotFoundException.
RepositoryExceptionpublic void testMovePathNotFoundExceptionSrcInvalid()
throws RepositoryException
Session.move(String src, String dest) with
invalid source path.
Should throw a PathNotFoundException.
RepositoryExceptionpublic void testMoveRepositoryException()
throws RepositoryException
Session.move(String src, String dest)
with a destination path that has an index postfixed.
This should throw a RepositoryException.
RepositoryExceptionpublic void testMoveConstraintViolationExceptionSrc()
throws RepositoryException
Session.move(String src, String dest),
afterwards it tries to only save the old parent node.
This should throw ConstraintViolationException.
Prerequisites:
javax.jcr.tck.nodetype
must accept children of same nodetypeRepositoryExceptionpublic void testMoveConstraintViolationExceptionDest()
throws RepositoryException
Session.move(String src, String dest),
afterwards it tries to only save the destination parent
node.
This should throw a ConstraintViolationException.
Prerequisites:
javax.jcr.tck.nodetype
must accept children of same nodetypeRepositoryExceptionpublic void testMoveLockException()
throws NotExecutableException,
RepositoryException
Session.move(String src, String dest) where
the parent node of src is locked.
Should throw a LockException immediately or on save.
public void testMoveNode()
throws RepositoryException
Session.move(String src, String dest)
works properly. To verify if node has been moved properly
it uses a second session to retrieve the moved node.
Prerequisites:
javax.jcr.tck.nodetype
must accept children of same nodetypeRepositoryExceptionpublic void testSaveNewNode()
throws RepositoryException
Session.save().
It creates a new node, saves
it using session.save() then uses a different session to
verify if the node has been properly saved.
RepositoryExceptionpublic void testSaveModifiedNode()
throws RepositoryException
Session.save().
It creates a new node, saves
it using session.save(), modifies the node by adding a child
node, saves again and finally verifies with a different session if
changes have been stored properly.
Prerequisites:
javax.jcr.tck.nodetype must accept children of same
nodetypeRepositoryExceptionpublic void testSaveContstraintViolationException()
throws RepositoryException
Session.save()
with an mandatory property that is not set on saving time.
Prerequisites:
javax.jcr.tck.SessionTest.testSaveContstraintViolationException.nodetype2
must reference a nodetype that has one at least one property that is
mandatory but not autocreatedRepositoryExceptionpublic void testSaveInvalidStateException()
throws RepositoryException
Session.save() that was
already deleted by an other session.
Procedure:
InvalidItemStateException.
Prerequisites:
javax.jcr.tck.nodetype must accept children of same
nodetypeRepositoryExceptionpublic void testRefreshBooleanFalse()
throws RepositoryException
Session.refresh(boolean refresh) works
properly with refresh set to false.
Procedure:
Session.save()Session.refresh(false)
on session 1Prerequisites:
javax.jcr.tck.nodetype must accept children of same
nodetypeRepositoryExceptionpublic void testRefreshBooleanTrue()
throws RepositoryException
Session.refresh(boolean refresh) works
properly with refresh set to true.
Procedure:
Session.save()Session.refresh(true)
on session 1Prerequisites:
javax.jcr.tck.nodetype must accept children of same
nodetypeRepositoryExceptionpublic void testHasPendingChanges()
throws RepositoryException
Session.hasPendingChanges() works
properly.
Procedure:
javax.jcr.tck.nodetype must accept
children of same nodetypejavax.jcr.tck.propertyname1
must be the name of a String property that can be added to a node of type
set in javax.jcr.tck.nodetype RepositoryExceptionpublic void testHasCapability()
throws RepositoryException
Session.hasCapability(String, Object, Object[])
works as specified.
RepositoryExceptionCopyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.