Class SessionTest
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.apache.jackrabbit.test.JUnitTest
-
- org.apache.jackrabbit.test.AbstractJCRTest
-
- org.apache.jackrabbit.test.api.SessionTest
-
- All Implemented Interfaces:
junit.framework.Test
public class SessionTest extends AbstractJCRTest
SessionTestcontains all test cases for thejavax.jcr.Sessionclass that are level 2 (modifing repository content).
-
-
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 SessionTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestHasCapability()Checks ifSession.hasCapability(String, Object, Object[])works as specified.voidtestHasPendingChanges()Checks ifSession.hasPendingChanges()works properly.voidtestMoveConstraintViolationExceptionDest()Moves a node usingSession.move(String src, String dest), afterwards it tries to only save the destination parent node.voidtestMoveConstraintViolationExceptionSrc()Moves a node usingSession.move(String src, String dest), afterwards it tries to only save the old parent node.voidtestMoveItemExistsException()Tries to move a node usingSession.move(String src, String dest)to a location where a node already exists with same name.voidtestMoveLockException()CallsSession.move(String src, String dest)where the parent node of src is locked.voidtestMoveNode()Checks ifSession.move(String src, String dest)works properly.voidtestMovePathNotFoundExceptionDestInvalid()CallsSession.move(String src, String dest)with invalid destination path.voidtestMovePathNotFoundExceptionSrcInvalid()CallsSession.move(String src, String dest)with invalid source path.voidtestMoveRepositoryException()CallsSession.move(String src, String dest)with a destination path that has an index postfixed.voidtestRefreshBooleanFalse()voidtestRefreshBooleanTrue()voidtestSaveConstraintViolationException()Tries to create and save a node usingSession.save()with an mandatory property that is not set on saving time.voidtestSaveInvalidStateException()Tries to save a node usingSession.save()that was already deleted by an other session.voidtestSaveModifiedNode()Checks if a modified node gets properly saved using.Session.save()voidtestSaveNewNode()Checks if a newly created node gets properly saved using.Session.save()-
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, setUp, tearDown
-
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
-
testMoveItemExistsException
public void testMoveItemExistsException() throws RepositoryExceptionTries to move a node usingSession.move(String src, String dest)to a location where a node already exists with same name.Prerequisites:
javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype2must contain name of a nodetype that does not allow same name sibling child nodes.javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype3must contain name of a valid nodetype that can be added as a child ofnodetype2
This should throw an
ItemExistsException.- Throws:
RepositoryException
-
testMovePathNotFoundExceptionDestInvalid
public void testMovePathNotFoundExceptionDestInvalid() throws RepositoryExceptionCallsSession.move(String src, String dest)with invalid destination path.Should throw a
PathNotFoundException.- Throws:
RepositoryException
-
testMovePathNotFoundExceptionSrcInvalid
public void testMovePathNotFoundExceptionSrcInvalid() throws RepositoryExceptionCallsSession.move(String src, String dest)with invalid source path.Should throw a
PathNotFoundException.- Throws:
RepositoryException
-
testMoveRepositoryException
public void testMoveRepositoryException() throws RepositoryExceptionCallsSession.move(String src, String dest)with a destination path that has an index postfixed.This should throw a
RepositoryException.- Throws:
RepositoryException
-
testMoveConstraintViolationExceptionSrc
public void testMoveConstraintViolationExceptionSrc() throws RepositoryExceptionMoves a node usingSession.move(String src, String dest), afterwards it tries to only save the old parent node.This should throw
ConstraintViolationException.Prerequisites:
javax.jcr.tck.nodetypemust accept children of same nodetype
- Throws:
RepositoryException
-
testMoveConstraintViolationExceptionDest
public void testMoveConstraintViolationExceptionDest() throws RepositoryExceptionMoves a node usingSession.move(String src, String dest), afterwards it tries to only save the destination parent node.This should throw a
ConstraintViolationException.Prerequisites:
javax.jcr.tck.nodetypemust accept children of same nodetype
- Throws:
RepositoryException
-
testMoveLockException
public void testMoveLockException() throws NotExecutableException, RepositoryExceptionCallsSession.move(String src, String dest)where the parent node of src is locked.Should throw a
LockExceptionimmediately or on save.
-
testMoveNode
public void testMoveNode() throws RepositoryExceptionChecks ifSession.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.nodetypemust accept children of same nodetype
- Throws:
RepositoryException
-
testSaveNewNode
public void testSaveNewNode() throws RepositoryExceptionChecks if a newly created node gets properly saved using.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.- Throws:
RepositoryException
-
testSaveModifiedNode
public void testSaveModifiedNode() throws RepositoryExceptionChecks if a modified node gets properly saved using.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.nodetypemust accept children of same nodetype
- Throws:
RepositoryException
-
testSaveConstraintViolationException
public void testSaveConstraintViolationException() throws RepositoryExceptionTries to create and save a node usingSession.save()with an mandatory property that is not set on saving time.Prerequisites:
javax.jcr.tck.SessionTest.testSaveConstraintViolationException.nodetype2must reference a nodetype that has one at least one property that is mandatory but not autocreated
- Throws:
RepositoryException
-
testSaveInvalidStateException
public void testSaveInvalidStateException() throws RepositoryExceptionTries to save a node usingSession.save()that was already deleted by an other session.Procedure:
- Creates a new node with session 1, saves it, adds a child node.
- Access new node with session 2,deletes the node, saves it.
- session 1 tries to save modifications .
InvalidItemStateException.Prerequisites:
javax.jcr.tck.nodetypemust accept children of same nodetype
- Throws:
RepositoryException
-
testRefreshBooleanFalse
public void testRefreshBooleanFalse() throws RepositoryExceptionChecks ifSession.refresh(boolean refresh)works properly withrefreshset tofalse.Procedure:
- Creates two nodes with session 1
- Modifies node 1 with session 1 by adding a child node
- Get node 2 with session 2
- Modifies node 2 with session 2 by adding a child node
- saves session 2 changes using
Session.save() - calls
Session.refresh(false)on session 1
Prerequisites:
javax.jcr.tck.nodetypemust accept children of same nodetype
- Throws:
RepositoryException
-
testRefreshBooleanTrue
public void testRefreshBooleanTrue() throws RepositoryExceptionChecks ifSession.refresh(boolean refresh)works properly withrefreshset totrue.Procedure:
- Creates two nodes with session 1
- Modifies node 1 with session 1 by adding a child node
- Get node 2 with session 2
- Modifies node 2 with session 2 by adding a child node
- saves session 2 changes using
Session.save() - calls
Session.refresh(true)on session 1
Prerequisites:
javax.jcr.tck.nodetypemust accept children of same nodetype
- Throws:
RepositoryException
-
testHasPendingChanges
public void testHasPendingChanges() throws RepositoryExceptionChecks ifSession.hasPendingChanges()works properly.Procedure:
- Gets a session, checks inital flag setting
- Adds a node, checks flag
- Saves on session, checks flag
- Adds a property, checks flag
- Saves on session, checks flag
- Adds a child node, checks flag
- Saves on session, checks flag
- Removes child node, checks flag
- Saves on session, checks flag
- Removes property, checks flag
- Saves on session, checks flag
javax.jcr.tck.nodetypemust accept children of same nodetypejavax.jcr.tck.propertyname1must be the name of a String property that can be added to a node of type set injavax.jcr.tck.nodetype
- Throws:
RepositoryException
-
testHasCapability
public void testHasCapability() throws RepositoryExceptionChecks ifSession.hasCapability(String, Object, Object[])works as specified.- Throws:
RepositoryException
-
-