org.apache.jackrabbit.test.api
Class SessionTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.jackrabbit.test.JUnitTest
              extended by org.apache.jackrabbit.test.AbstractJCRTest
                  extended by org.apache.jackrabbit.test.api.SessionTest
All Implemented Interfaces:
junit.framework.Test

public class SessionTest
extends AbstractJCRTest

SessionTest contains all test cases for the javax.jcr.Session class 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, 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
SessionTest()
           
 
Method Summary
 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()
          Checks if Session.refresh(boolean refresh) works properly with refresh set to false.
 void testRefreshBooleanTrue()
          Checks if Session.refresh(boolean refresh) works properly with refresh set to true.
 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 Session.save().
 void testSaveNewNode()
          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, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getProperty, getProperty, getSize, isSupported, needsMixin, run, setUp, tearDown
 
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

SessionTest

public SessionTest()
Method Detail

testMoveItemExistsException

public void testMoveItemExistsException()
                                 throws RepositoryException
Tries to move a node using Session.move(String src, String dest) to a location where a node already exists with same name.

Prerequisites:

This should throw an ItemExistsException.

Throws:
RepositoryException

testMovePathNotFoundExceptionDestInvalid

public void testMovePathNotFoundExceptionDestInvalid()
                                              throws RepositoryException
Calls Session.move(String src, String dest) with invalid destination path.

Should throw a PathNotFoundException.

Throws:
RepositoryException

testMovePathNotFoundExceptionSrcInvalid

public void testMovePathNotFoundExceptionSrcInvalid()
                                             throws RepositoryException
Calls Session.move(String src, String dest) with invalid source path.

Should throw a PathNotFoundException.

Throws:
RepositoryException

testMoveRepositoryException

public void testMoveRepositoryException()
                                 throws RepositoryException
Calls Session.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 RepositoryException
Moves a node using Session.move(String src, String dest), afterwards it tries to only save the old parent node.

This should throw ConstraintViolationException.

Prerequisites:

Throws:
RepositoryException

testMoveConstraintViolationExceptionDest

public void testMoveConstraintViolationExceptionDest()
                                              throws RepositoryException
Moves a node using Session.move(String src, String dest), afterwards it tries to only save the destination parent node.

This should throw a ConstraintViolationException.

Prerequisites:

Throws:
RepositoryException

testMoveLockException

public void testMoveLockException()
                           throws NotExecutableException,
                                  RepositoryException
Calls Session.move(String src, String dest) where the parent node of src is locked.

Should throw a LockException immediately or on save.

Throws:
NotExecutableException
RepositoryException

testMoveNode

public void testMoveNode()
                  throws RepositoryException
Checks if 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:

Throws:
RepositoryException

testSaveNewNode

public void testSaveNewNode()
                     throws RepositoryException
Checks 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 RepositoryException
Checks 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.nodetype must accept children of same nodetype

Throws:
RepositoryException

testSaveContstraintViolationException

public void testSaveContstraintViolationException()
                                           throws RepositoryException
Tries to create and save a node using Session.save() with an mandatory property that is not set on saving time.

Prerequisites:

Throws:
RepositoryException

testSaveInvalidStateException

public void testSaveInvalidStateException()
                                   throws RepositoryException
Tries to save a node using Session.save() that was already deleted by an other session.

Procedure:

This should throw an InvalidItemStateException.

Prerequisites:

Throws:
RepositoryException

testRefreshBooleanFalse

public void testRefreshBooleanFalse()
                             throws RepositoryException
Checks if Session.refresh(boolean refresh) works properly with refresh set to false.

Procedure:

Session 1 changes should be cleared and session 2 changes should now be visible to session 1.

Prerequisites:

Throws:
RepositoryException

testRefreshBooleanTrue

public void testRefreshBooleanTrue()
                            throws RepositoryException
Checks if Session.refresh(boolean refresh) works properly with refresh set to true.

Procedure:

Session 1 changes and session 2 changes now be visible to session 1.

Prerequisites:

Throws:
RepositoryException

testHasPendingChanges

public void testHasPendingChanges()
                           throws RepositoryException
Checks if Session.hasPendingChanges() works properly.

Procedure:

Prerequisites:

Throws:
RepositoryException

testHasCapability

public void testHasCapability()
                       throws RepositoryException
Checks if Session.hasCapability(String, Object, Object[]) works as specified.

Throws:
RepositoryException


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.