org.opencms.file
Class TestHistory

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.opencms.test.OpenCmsTestCase
              extended by org.opencms.file.TestHistory
All Implemented Interfaces:
junit.framework.Test

public class TestHistory
extends OpenCmsTestCase

Unit tests for history operation.

Since:
6.9.1

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opencms.test.OpenCmsTestCase
OpenCmsTestCase.ConnectionData
 
Field Summary
 
Fields inherited from class org.opencms.test.OpenCmsTestCase
ARTICLE_TYPEID, DB_MYSQL, DB_ORACLE, m_additionalConnection, m_configuration, m_currentResourceStrorage, m_defaultConnection, m_defaultTablespace, m_indexTablespace, m_resourceStorages, m_setupConnection, m_tempTablespace
 
Constructor Summary
TestHistory(String arg0)
          Default JUnit constructor.
 
Method Summary
protected  String getContentString(CmsObject cms, byte[] content)
          Turns the byte content of a resource into a string.
static junit.framework.Test suite()
          Test suite for this test class.
 void testCreateAndDeleteFile()
          Creates and deletes a file n-times and tests if the historical data are correct and if the content can be properly restored.
 void testCreateAndDeleteFolder()
          Creates and deletes a folder n-times and tests if the historical data are correct and if the properties can be properly restored.
 void testDeleteDate()
          Tests the delete date of deleted resources.
 void testFileHistory()
          Creates a file, modifies and publishes it n-times, create a sibling, publishes both and compares the histories.
 void testFileHistoryFileWithSibling()
          creates a file, modifies and publishes it n-times, create 2 siblings, delete file and sibling N2, delete some versions from history, restore file and sibling from history and compare contents.
 void testFileRestore()
          Test restoring a file also possible missing folders are restored.
 void testFileRestoreIteration()
          Test restoring and deleting a file several times.
 void testFileVersions()
          Test the version numbers of a file after several modifications.
 void testMoveFile()
          Moves a resource n-times and tests if the version ID of the history resources are correct and if the content could be restored for a specified version ID.
 void testPathHistory()
          Tests reconstructing the resource path for the history.
 void testReadDeleted()
          Tests the retrieval of deleted resources by name in a folder.
 void testSiblingRestoreIteration()
          Test restoring and deleting a sibling several times.
 void testSiblingsEdition()
          Test a create and edit siblings scenario.
 void testSiblingsRestoration()
          Test a sibling restoration scenario.
 void testSiblingsV7HistoryIssue()
          Tests an issue present in OpenCms 7 siblings have a wrong history.
 void testSiblingsV7HistoryIssue2()
          Tests an issue present in OpenCms 7 siblings have a wrong history.
 void testSiblingVersions()
          Test the version number of siblings after different operations.
 void testVersioningLimit()
          Test that the versions are properly updated after reaching the limit of stored versions.
 
Methods inherited from class org.opencms.test.OpenCmsTestCase
addTestDataPath, assertAce, assertAcl, assertAcl, assertContains, assertContainsNot, assertContent, assertDateContent, assertDateContentAfter, assertDateCreated, assertDateCreatedAfter, assertDateExpired, assertDateLastModified, assertDateLastModifiedAfter, assertDateReleased, assertEquals, assertEquals, assertEquals, assertFilter, assertFilter, assertFilter, assertFilter, assertFlags, assertHistory, assertHistoryForRestored, assertIsFolder, assertIsIdentical, assertIsNotIdentical, assertLock, assertLock, assertLock, assertModifiedInCurrentProject, assertPermissionString, assertProject, assertPropertyChanged, assertPropertyChanged, assertPropertydefinitionExist, assertPropertydefinitions, assertPropertyEqual, assertPropertyNew, assertPropertyNew, assertPropertyRemoved, assertPropertyRemoved, assertRelation, assertResourceId, assertResourceType, assertSiblingCount, assertSiblingCountIncremented, assertState, assertStructureId, assertType, assertUserCreated, assertUserLastModified, assertVersion, checkErrors, createStorage, deleteFile, echo, generateContent, generateContent, generateName, generateProperties, generateResources, generateSetupTestWrapper, generateUsers, getCmsObject, getConnectionName, getDatabaseProduct, getDbProduct, getPreCalculatedState, getReplacer, getSetupDataPath, getSetupDb, getTestDataPath, importData, importResources, importTestResource, initTestDataPath, removeDatabase, removeDatabase, removeOpenCms, removeStorage, resetMapping, restart, restartOpenCms, setMapping, setupDatabase, setupDatabase, setupOpenCms, setupOpenCms, setupOpenCms, setupOpenCms, setupOpenCms, storeResources, storeResources, switchStorage
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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

TestHistory

public TestHistory(String arg0)
Default JUnit constructor.

Parameters:
arg0 - JUnit parameters
Method Detail

suite

public static junit.framework.Test suite()
Test suite for this test class.

Returns:
the test suite

testCreateAndDeleteFile

public void testCreateAndDeleteFile()
                             throws Throwable
Creates and deletes a file n-times and tests if the historical data are correct and if the content can be properly restored.

Throws:
Throwable - if something goes wrong

testCreateAndDeleteFolder

public void testCreateAndDeleteFolder()
                               throws Throwable
Creates and deletes a folder n-times and tests if the historical data are correct and if the properties can be properly restored.

Throws:
Throwable - if something goes wrong

testDeleteDate

public void testDeleteDate()
                    throws Throwable
Tests the delete date of deleted resources.

Throws:
Throwable - if something goes wrong

testFileHistory

public void testFileHistory()
                     throws Throwable
Creates a file, modifies and publishes it n-times, create a sibling, publishes both and compares the histories.

Throws:
Throwable - if something goes wrong

testFileHistoryFileWithSibling

public void testFileHistoryFileWithSibling()
                                    throws Throwable
creates a file, modifies and publishes it n-times, create 2 siblings, delete file and sibling N2, delete some versions from history, restore file and sibling from history and compare contents.

Throws:
Throwable - if something goes wrong

testFileRestore

public void testFileRestore()
                     throws Throwable
Test restoring a file also possible missing folders are restored.

Throws:
Throwable - if something goes wrong

testFileRestoreIteration

public void testFileRestoreIteration()
                              throws Throwable
Test restoring and deleting a file several times.

Throws:
Throwable - if something goes wrong

testFileVersions

public void testFileVersions()
                      throws Throwable
Test the version numbers of a file after several modifications.

Throws:
Throwable - if something goes wrong

testMoveFile

public void testMoveFile()
                  throws Throwable
Moves a resource n-times and tests if the version ID of the history resources are correct and if the content could be restored for a specified version ID.

Throws:
Throwable - if something goes wrong

testPathHistory

public void testPathHistory()
                     throws Throwable
Tests reconstructing the resource path for the history.

Throws:
Throwable - if something goes wrong

testReadDeleted

public void testReadDeleted()
                     throws Throwable
Tests the retrieval of deleted resources by name in a folder.

Throws:
Throwable - if something goes wrong

testSiblingRestoreIteration

public void testSiblingRestoreIteration()
                                 throws Throwable
Test restoring and deleting a sibling several times.

Throws:
Throwable - if something goes wrong

testSiblingsEdition

public void testSiblingsEdition()
                         throws Throwable
Test a create and edit siblings scenario.

Throws:
Throwable - if something goes wrong

testSiblingsRestoration

public void testSiblingsRestoration()
                             throws Throwable
Test a sibling restoration scenario.

Throws:
Throwable - if something goes wrong

testSiblingsV7HistoryIssue

public void testSiblingsV7HistoryIssue()
                                throws Exception
Tests an issue present in OpenCms 7 siblings have a wrong history.

Throws:
Exception - if the test fails

testSiblingsV7HistoryIssue2

public void testSiblingsV7HistoryIssue2()
                                 throws Exception
Tests an issue present in OpenCms 7 siblings have a wrong history.

Throws:
Exception - if the test fails

testSiblingVersions

public void testSiblingVersions()
                         throws Throwable
Test the version number of siblings after different operations.

Throws:
Throwable - if something goes wrong

testVersioningLimit

public void testVersioningLimit()
                         throws Throwable
Test that the versions are properly updated after reaching the limit of stored versions.

Throws:
Throwable - if something goes wrong

getContentString

protected String getContentString(CmsObject cms,
                                  byte[] content)
Turns the byte content of a resource into a string.

Parameters:
cms - the current user's Cms object
content - the byte content of a resource
Returns:
the content as a string