org.apache.jackrabbit.test.api.version
Class VersionHistoryTest

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.version.AbstractVersionTest
                      extended by org.apache.jackrabbit.test.api.version.VersionHistoryTest
All Implemented Interfaces:
junit.framework.Test

public class VersionHistoryTest
extends AbstractVersionTest

VersionHistoryTest provides test methods related to version history methods and general version history issues.


Field Summary
protected  VersionHistory vHistory
           
 
Fields inherited from class org.apache.jackrabbit.test.api.version.AbstractVersionTest
nonVersionableNode, nonVersionableNodeType, propertyValue, versionableNode, versionableNodeType
 
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
helper, isReadOnly, jcrBaseVersion, jcrCreated, jcrFrozenNode, jcrFrozenUuid, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntBase, ntFrozenNode, ntQuery, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testPath, testRoot, testRootNode, workspaceName
 
Fields inherited from class org.apache.jackrabbit.test.JUnitTest
log
 
Constructor Summary
VersionHistoryTest()
           
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testAccept()
          Tests if VersionHistory.accept(ItemVisitor) accepts a ItemVisitor and if the right Node is provided to that visitor.
 void testAddMixin()
          Tests if VersionHistory.addMixin(String) throws a ConstraintViolationException
 void testAddNode()
          Tests if VersionHistory.addNode(String) and VersionHistory.addNode(String, String) throw a ConstraintViolationException
 void testAutocreatedRootVersion()
          Test if initially there is an auto-created root version present in the version history.
 void testCanAddMixin()
          Tests if VersionHistory.canAddMixin(String) returns false
 void testCancelMerge()
          Tests if VersionHistory.cancelMerge(Version) throws an UnsupportedRepositoryOperationException
 void testCheckin()
          Tests if VersionHistory.checkin() throws an UnsupportedRepositoryOperationException
 void testCheckout()
          Tests if VersionHistory.checkout() throws an UnsupportedRepositoryOperationException
 void testDoneMerge()
          Tests if VersionHistory.doneMerge(Version) throws an UnsupportedRepositoryOperationException
 void testGetAllVersions()
          Test that VersionHistory.getAllVersions() returns an iterator containing the root version and all versions that have been created by Node.checkin().
 void testGetAncestor()
          Tests if VersionHistory.getAncestor(int) returns the right ancestor
 void testGetBaseVersion()
          Tests if VersionHistory.getBaseVersion() throws an UnsupportedRepositoryOperationException
 void testGetCorrespondingNodePath()
          Tests if VersionHistory.getCorrespondingNodePath(String) returns the right path
 void testGetDepth()
          Tests if VersionHistory.getDepth() returns the right depth
 void testGetIndex()
          Tests if VersionHistory.getIndex() returns the right index
 void testGetLock()
          Tests if VersionHistory.getLock() throws an LockException
 void testGetMixinNodeTypes()
          Tests if VersionHistory.getMixinNodeTypes() does not return null.
 void testGetName()
          Tests if VersionHistory.getName() returns the right name
 void testGetNode()
          Tests if VersionHistory.getNode(String) returns the right child Node
 void testGetNodes()
          Tests if VersionHistory.getNodes() and VersionHistory.getNodes(String) returns the right child Node
 void testGetParent()
          Tests if VersionHistory.getParent() returns the right parent Node
 void testGetPath()
          Tests if VersionHistory.getPath() returns the right path
 void testGetPrimaryItem()
          Tests if VersionHistory.getPrimaryItem() throws a ItemNotFoundException
 void testGetPrimaryNodeType()
          Tests if VersionHistory.getPrimaryNodeType() returns the right primary node type nt:versionHistory
 void testGetProperties()
          Tests if VersionHistory.getProperties() and VersionHistory.getProperties(String) return the right property
 void testGetProperty()
          Tests if VersionHistory.getProperty(String) returns the right property
 void testGetReferences()
          Tests if VersionHistory.getReferences() returns the right reference of the versionable node
 void testGetSession()
          Tests if VersionHistory.getSession() returns the right session
 void testGetUUID()
          Tests if VersionHistory.getUUID() returns the right UUID
 void testGetVersion()
          Test VersionHistory.getVersion(String versionName) if 'versionName' is the name of an existing version (created by Node.checkin()).
 void testGetVersionHistory()
          Tests if VersionHistory.getVersionHistory() throws an UnsupportedRepositoryOperationException
 void testGetVersionHistoryOnNonVersionableNode()
          Test if UnsupportedRepositoryOperationException is thrown when calling Node.getVersionHistory() on a non-versionable node.
 void testHasNode()
          Tests if VersionHistory.hasNode(String) returns the right boolean value
 void testHasNodes()
          Tests if VersionHistory.hasNodes() returns true
 void testHasProperties()
          Tests if VersionHistory.hasProperties() returns true
 void testHasProperty()
          Tests if VersionHistory.hasProperty(String) returns the right boolean value
 void testHoldsLock()
          Tests if VersionHistory.holdsLock() returns false
 void testInitiallyGetAllVersionsContainsTheRootVersion()
          Test if the iterator returned by VersionHistory.getAllVersions() contains the root version upon creation of the version history.
 void testInitialNumberOfVersions()
          The version history must initially contain two versions (root version + first test version).
 void testIsCheckedOut()
          Tests if VersionHistory.isCheckedOut() returns true
 void testIsLocked()
          Tests if VersionHistory.isLocked() returns false
 void testIsModified()
          Tests if VersionHistory.isModified() returns false
 void testIsNew()
          Tests if VersionHistory.isNew() returns false
 void testIsNode()
          Tests if VersionHistory.isNode() returns true
 void testIsNodeType()
          Tests if VersionHistory.isNodeType(String) returns the right boolean value
 void testIsSame()
          Tests if VersionHistory.isSame() returns the right boolean value
 void testLock()
          Tests if VersionHistory.lock(boolean, boolean) throws a LockException
 void testMerge()
          Tests if VersionHistory.merge(String) throws an ConstraintViolationException
 void testOrderBefore()
          Tests if VersionHistory.orderBefore(String, String) throws an UnsupportedRepositoryOperationException
 void testRefresh()
          Tests if VersionHistory.refresh(boolean) works as expected (do nothing and return quietly)
 void testRemove()
          Tests if VersionHistory.remove() throws an ConstraintViolationException
 void testRemoveMixin()
          Tests if VersionHistory.removeMixin(String) throws an NoSuchNodeTypeException
 void testRestore()
          Tests if VersionHistory.restore(String, boolean) and VersionHistory.restore(Version, boolean) throw an UnsupportedRepositoryOperationException and VersionHistory.restore(Version, String, boolean) throws a ConstraintViolationException.
 void testRestoreByLabel()
          Tests if VersionHistory.restoreByLabel(String, boolean) throws an UnsupportedRepositoryOperationException
 void testSetProperty()
          Tests if VersionHistory.setProperty(String, String[]) VersionHistory.setProperty(String, String[], int) VersionHistory.setProperty(String, Value[]) VersionHistory.setProperty(String, Value[], int) VersionHistory.setProperty(String, boolean) VersionHistory.setProperty(String, double) VersionHistory.setProperty(String, InputStream) VersionHistory.setProperty(String, String) VersionHistory.setProperty(String, Calendar) VersionHistory.setProperty(String, Node) VersionHistory.setProperty(String, Value) VersionHistory.setProperty(String, long) all throw a ConstraintViolationException
 void testUnlock()
          Tests if VersionHistory.unlock() throws a LockException
 void testUpdate()
          Tests if VersionHistory.update(String) throws an ConstraintViolationException
 
Methods inherited from class org.apache.jackrabbit.test.api.version.AbstractVersionTest
createVersionableNode, getNumberOfVersions
 
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureMultipleWorkspacesSupported, getNonExistingWorkspaceName, 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
 

Field Detail

vHistory

protected VersionHistory vHistory
Constructor Detail

VersionHistoryTest

public VersionHistoryTest()
Method Detail

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class AbstractVersionTest
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class AbstractVersionTest
Throws:
Exception

testAutocreatedRootVersion

public void testAutocreatedRootVersion()
                                throws RepositoryException
Test if initially there is an auto-created root version present in the version history.

Throws:
RepositoryException

testInitialNumberOfVersions

public void testInitialNumberOfVersions()
                                 throws RepositoryException
The version history must initially contain two versions (root version + first test version).

Throws:
RepositoryException

testInitiallyGetAllVersionsContainsTheRootVersion

public void testInitiallyGetAllVersionsContainsTheRootVersion()
                                                       throws RepositoryException
Test if the iterator returned by VersionHistory.getAllVersions() contains the root version upon creation of the version history.

Throws:
RepositoryException
See Also:
VersionHistory.getRootVersion()

testGetAllVersions

public void testGetAllVersions()
                        throws RepositoryException
Test that VersionHistory.getAllVersions() returns an iterator containing the root version and all versions that have been created by Node.checkin().

Throws:
RepositoryException
See Also:
VersionHistory.getAllVersions()

testGetVersionHistoryOnNonVersionableNode

public void testGetVersionHistoryOnNonVersionableNode()
                                               throws RepositoryException
Test if UnsupportedRepositoryOperationException is thrown when calling Node.getVersionHistory() on a non-versionable node.

Throws:
RepositoryException

testGetVersion

public void testGetVersion()
                    throws RepositoryException
Test VersionHistory.getVersion(String versionName) if 'versionName' is the name of an existing version (created by Node.checkin()).

Throws:
RepositoryException
See Also:
VersionHistory.getVersion(String)

testAccept

public void testAccept()
                throws Exception
Tests if VersionHistory.accept(ItemVisitor) accepts a ItemVisitor and if the right Node is provided to that visitor.

Throws:
Exception

testAddMixin

public void testAddMixin()
                  throws Exception
Tests if VersionHistory.addMixin(String) throws a ConstraintViolationException

Throws:
Exception

testAddNode

public void testAddNode()
                 throws Exception
Tests if VersionHistory.addNode(String) and VersionHistory.addNode(String, String) throw a ConstraintViolationException

Throws:
Exception

testCanAddMixin

public void testCanAddMixin()
                     throws Exception
Tests if VersionHistory.canAddMixin(String) returns false

Throws:
Exception

testCancelMerge

public void testCancelMerge()
                     throws Exception
Tests if VersionHistory.cancelMerge(Version) throws an UnsupportedRepositoryOperationException

Throws:
Exception

testCheckin

public void testCheckin()
                 throws Exception
Tests if VersionHistory.checkin() throws an UnsupportedRepositoryOperationException

Throws:
Exception

testCheckout

public void testCheckout()
                  throws Exception
Tests if VersionHistory.checkout() throws an UnsupportedRepositoryOperationException

Throws:
Exception

testDoneMerge

public void testDoneMerge()
                   throws Exception
Tests if VersionHistory.doneMerge(Version) throws an UnsupportedRepositoryOperationException

Throws:
Exception

testGetAncestor

public void testGetAncestor()
                     throws Exception
Tests if VersionHistory.getAncestor(int) returns the right ancestor

Throws:
Exception

testGetBaseVersion

public void testGetBaseVersion()
                        throws Exception
Tests if VersionHistory.getBaseVersion() throws an UnsupportedRepositoryOperationException

Throws:
Exception

testGetCorrespondingNodePath

public void testGetCorrespondingNodePath()
                                  throws Exception
Tests if VersionHistory.getCorrespondingNodePath(String) returns the right path

Throws:
Exception

testGetDepth

public void testGetDepth()
                  throws Exception
Tests if VersionHistory.getDepth() returns the right depth

Throws:
Exception

testGetIndex

public void testGetIndex()
                  throws Exception
Tests if VersionHistory.getIndex() returns the right index

Throws:
Exception

testGetLock

public void testGetLock()
                 throws Exception
Tests if VersionHistory.getLock() throws an LockException

Throws:
Exception

testGetMixinNodeTypes

public void testGetMixinNodeTypes()
                           throws Exception
Tests if VersionHistory.getMixinNodeTypes() does not return null.

Throws:
Exception

testGetName

public void testGetName()
                 throws Exception
Tests if VersionHistory.getName() returns the right name

Throws:
Exception

testGetNode

public void testGetNode()
                 throws Exception
Tests if VersionHistory.getNode(String) returns the right child Node

Throws:
Exception

testGetNodes

public void testGetNodes()
                  throws Exception
Tests if VersionHistory.getNodes() and VersionHistory.getNodes(String) returns the right child Node

Throws:
Exception

testGetParent

public void testGetParent()
                   throws Exception
Tests if VersionHistory.getParent() returns the right parent Node

Throws:
Exception

testGetPath

public void testGetPath()
                 throws Exception
Tests if VersionHistory.getPath() returns the right path

Throws:
Exception

testGetPrimaryItem

public void testGetPrimaryItem()
                        throws Exception
Tests if VersionHistory.getPrimaryItem() throws a ItemNotFoundException

Throws:
Exception

testGetPrimaryNodeType

public void testGetPrimaryNodeType()
                            throws Exception
Tests if VersionHistory.getPrimaryNodeType() returns the right primary node type nt:versionHistory

Throws:
Exception

testGetProperties

public void testGetProperties()
                       throws Exception
Tests if VersionHistory.getProperties() and VersionHistory.getProperties(String) return the right property

Throws:
Exception

testGetProperty

public void testGetProperty()
                     throws Exception
Tests if VersionHistory.getProperty(String) returns the right property

Throws:
Exception

testGetReferences

public void testGetReferences()
                       throws Exception
Tests if VersionHistory.getReferences() returns the right reference of the versionable node

Throws:
Exception

testGetSession

public void testGetSession()
                    throws Exception
Tests if VersionHistory.getSession() returns the right session

Throws:
Exception

testGetUUID

public void testGetUUID()
                 throws Exception
Tests if VersionHistory.getUUID() returns the right UUID

Throws:
Exception

testGetVersionHistory

public void testGetVersionHistory()
                           throws Exception
Tests if VersionHistory.getVersionHistory() throws an UnsupportedRepositoryOperationException

Throws:
Exception

testHasNode

public void testHasNode()
                 throws Exception
Tests if VersionHistory.hasNode(String) returns the right boolean value

Throws:
Exception

testHasNodes

public void testHasNodes()
                  throws Exception
Tests if VersionHistory.hasNodes() returns true

Throws:
Exception

testHasProperties

public void testHasProperties()
                       throws Exception
Tests if VersionHistory.hasProperties() returns true

Throws:
Exception

testHasProperty

public void testHasProperty()
                     throws Exception
Tests if VersionHistory.hasProperty(String) returns the right boolean value

Throws:
Exception

testHoldsLock

public void testHoldsLock()
                   throws Exception
Tests if VersionHistory.holdsLock() returns false

Throws:
Exception

testIsCheckedOut

public void testIsCheckedOut()
                      throws Exception
Tests if VersionHistory.isCheckedOut() returns true

Throws:
Exception

testIsLocked

public void testIsLocked()
                  throws Exception
Tests if VersionHistory.isLocked() returns false

Throws:
Exception

testIsModified

public void testIsModified()
                    throws Exception
Tests if VersionHistory.isModified() returns false

Throws:
Exception

testIsNew

public void testIsNew()
               throws Exception
Tests if VersionHistory.isNew() returns false

Throws:
Exception

testIsNode

public void testIsNode()
                throws Exception
Tests if VersionHistory.isNode() returns true

Throws:
Exception

testIsNodeType

public void testIsNodeType()
                    throws Exception
Tests if VersionHistory.isNodeType(String) returns the right boolean value

Throws:
Exception

testIsSame

public void testIsSame()
                throws Exception
Tests if VersionHistory.isSame() returns the right boolean value

Throws:
Exception

testLock

public void testLock()
              throws Exception
Tests if VersionHistory.lock(boolean, boolean) throws a LockException

Throws:
Exception

testMerge

public void testMerge()
               throws Exception
Tests if VersionHistory.merge(String) throws an ConstraintViolationException

Throws:
Exception

testOrderBefore

public void testOrderBefore()
                     throws Exception
Tests if VersionHistory.orderBefore(String, String) throws an UnsupportedRepositoryOperationException

Throws:
Exception

testRefresh

public void testRefresh()
                 throws Exception
Tests if VersionHistory.refresh(boolean) works as expected (do nothing and return quietly)

Throws:
Exception

testRemove

public void testRemove()
                throws Exception
Tests if VersionHistory.remove() throws an ConstraintViolationException

Throws:
Exception

testRemoveMixin

public void testRemoveMixin()
                     throws Exception
Tests if VersionHistory.removeMixin(String) throws an NoSuchNodeTypeException

Throws:
Exception

testRestore

public void testRestore()
                 throws Exception
Tests if VersionHistory.restore(String, boolean) and VersionHistory.restore(Version, boolean) throw an UnsupportedRepositoryOperationException and VersionHistory.restore(Version, String, boolean) throws a ConstraintViolationException.

Throws:
Exception

testRestoreByLabel

public void testRestoreByLabel()
                        throws Exception
Tests if VersionHistory.restoreByLabel(String, boolean) throws an UnsupportedRepositoryOperationException

Throws:
Exception

testSetProperty

public void testSetProperty()
                     throws Exception
Tests if all throw a ConstraintViolationException

Throws:
Exception

testUnlock

public void testUnlock()
                throws Exception
Tests if VersionHistory.unlock() throws a LockException

Throws:
Exception

testUpdate

public void testUpdate()
                throws Exception
Tests if VersionHistory.update(String) throws an ConstraintViolationException

Throws:
Exception


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