org.opencms.file
Class TestUndoChanges

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

public class TestUndoChanges
extends OpenCmsTestCase

Unit test for the "undoChanges" method of the CmsObject.


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
TestUndoChanges(String arg0)
          Default JUnit constructor.
 
Method Summary
static junit.framework.Test suite()
          Test suite for this test class.
 void testUndoChangesAfterCopyNewOverDeleted()
          Tests undo changes after a resource was deleted and another resource was copied over the deleted file "as new".
 void testUndoChangesAfterCopySiblingOverDeleted()
          Tests undo changes after a resource was deleted and another resource was copied over the deleted file "as sibling".
 void testUndoChangesFolder()
          Test undoChanges method to a single folder.
 void testUndoChangesFolderRecursive()
          Test undoChanges method to a single folder.
 void testUndoChangesMove()
          Tests undo changes for the move operation only.
 void testUndoChangesMoveContent()
          Tests undo changes for the content changes only.
 void testUndoChangesMovedFileAfterEdit()
          Tests undo changes after a file was moved and edited.
 void testUndoChangesMovedFolder()
          Tests undo changes after a folder was moved.
 void testUndoChangesMovedFolderAfterEdit()
          Tests undo changes after a folder was moved and a file in the folder edited.
 void testUndoChangesMovedFolderNewFile()
          Tests undo changes after a folder was moved and a file in the folder edited.
 void testUndoChangesOnNewResource()
          Tests undo changes on a new resource, this must lead to an exception!
 void testUndoChangesResource()
          Test undoChanges method to a single file.
 void testUndoChangesScenario1()
          Tests undo changes of move operations as follows:
 void testUndoChangesSeveralMovedFolder()
          Tests undo changes after a folder was moved several times.
 void testUndoChangesSharedProperty()
          Test undoChanges method to a resource with an ace.
 void testUndoChangesSubfolderAfterMoving()
          Test undoChanges method to a sub folder after moving a whole folder.
 void testUndoChangesWithAce()
          Test undoChanges method to a resource with an ace.
static void undoChanges(OpenCmsTestCase tc, CmsObject cms, String resource1)
          Test the touch method to touch a single resource.
static void undoChangesFolder(OpenCmsTestCase tc, CmsObject cms, String resource1)
          Test undoChanges method to a single folder.
static void undoChangesFolderRecursive(OpenCmsTestCase tc, CmsObject cms, String resource1)
          Test undoChanges method to a single folder and all resources within the folder.
 
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

TestUndoChanges

public TestUndoChanges(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

undoChanges

public static void undoChanges(OpenCmsTestCase tc,
                               CmsObject cms,
                               String resource1)
                        throws Throwable
Test the touch method to touch a single resource.

Parameters:
tc - the OpenCmsTestCase
cms - the CmsObject
resource1 - the resource to touch
Throws:
Throwable - if something goes wrong

undoChangesFolder

public static void undoChangesFolder(OpenCmsTestCase tc,
                                     CmsObject cms,
                                     String resource1)
                              throws Throwable
Test undoChanges method to a single folder.

Parameters:
tc - the OpenCmsTestCase
cms - the CmsObject
resource1 - the resource to touch
Throws:
Throwable - if something goes wrong

undoChangesFolderRecursive

public static void undoChangesFolderRecursive(OpenCmsTestCase tc,
                                              CmsObject cms,
                                              String resource1)
                                       throws Throwable
Test undoChanges method to a single folder and all resources within the folder.

Parameters:
tc - the OpenCmsTestCase
cms - the CmsObject
resource1 - the resource to touch
Throws:
Throwable - if something goes wrong

testUndoChangesAfterCopyNewOverDeleted

public void testUndoChangesAfterCopyNewOverDeleted()
                                            throws Throwable
Tests undo changes after a resource was deleted and another resource was copied over the deleted file "as new".

Throws:
Throwable - if something goes wrong

testUndoChangesScenario1

public void testUndoChangesScenario1()
                              throws Throwable
Tests undo changes of move operations as follows:

having following start structure: - (black) /folder - (black) /folder/subfolder - (black) /folder/subfolder/subsubfolder a. move /folder/subfolder to /subfolder b. move /subfolder/subsubfolder to /subsubfolder c. move /subfolder back to its starting location: /folder/subfolder d. undo changes of move operation for /subsubfolder to get following scenario: - (black) /folder - (red) /folder/subfolder - (black) /folder/subfolder/subsubfolder e. undo changes of move operation for /folder/subfolder

Throws:
Throwable - if something goes wrong

testUndoChangesAfterCopySiblingOverDeleted

public void testUndoChangesAfterCopySiblingOverDeleted()
                                                throws Throwable
Tests undo changes after a resource was deleted and another resource was copied over the deleted file "as sibling".

Throws:
Throwable - if something goes wrong

testUndoChangesFolder

public void testUndoChangesFolder()
                           throws Throwable
Test undoChanges method to a single folder.

Throws:
Throwable - if something goes wrong

testUndoChangesFolderRecursive

public void testUndoChangesFolderRecursive()
                                    throws Throwable
Test undoChanges method to a single folder.

Throws:
Throwable - if something goes wrong

testUndoChangesMove

public void testUndoChangesMove()
                         throws Throwable
Tests undo changes for the move operation only.

Throws:
Throwable - if something goes wrong

testUndoChangesMoveContent

public void testUndoChangesMoveContent()
                                throws Throwable
Tests undo changes for the content changes only.

Throws:
Throwable - if something goes wrong

testUndoChangesMovedFileAfterEdit

public void testUndoChangesMovedFileAfterEdit()
                                       throws Throwable
Tests undo changes after a file was moved and edited.

Throws:
Throwable - if something goes wrong

testUndoChangesMovedFolder

public void testUndoChangesMovedFolder()
                                throws Throwable
Tests undo changes after a folder was moved.

Throws:
Throwable - if something goes wrong

testUndoChangesMovedFolderAfterEdit

public void testUndoChangesMovedFolderAfterEdit()
                                         throws Throwable
Tests undo changes after a folder was moved and a file in the folder edited.

Throws:
Throwable - if something goes wrong

testUndoChangesMovedFolderNewFile

public void testUndoChangesMovedFolderNewFile()
                                       throws Throwable
Tests undo changes after a folder was moved and a file in the folder edited.

Throws:
Throwable - if something goes wrong

testUndoChangesOnNewResource

public void testUndoChangesOnNewResource()
                                  throws Throwable
Tests undo changes on a new resource, this must lead to an exception!

Throws:
Throwable - if something goes wrong

testUndoChangesResource

public void testUndoChangesResource()
                             throws Throwable
Test undoChanges method to a single file.

Throws:
Throwable - if something goes wrong

testUndoChangesSeveralMovedFolder

public void testUndoChangesSeveralMovedFolder()
                                       throws Throwable
Tests undo changes after a folder was moved several times.

Throws:
Throwable - if something goes wrong

testUndoChangesSharedProperty

public void testUndoChangesSharedProperty()
                                   throws Throwable
Test undoChanges method to a resource with an ace.

Throws:
Throwable - if something goes wrong

testUndoChangesSubfolderAfterMoving

public void testUndoChangesSubfolderAfterMoving()
                                         throws Throwable
Test undoChanges method to a sub folder after moving a whole folder.

Throws:
Throwable - if something goes wrong

testUndoChangesWithAce

public void testUndoChangesWithAce()
                            throws Throwable
Test undoChanges method to a resource with an ace.

Throws:
Throwable - if something goes wrong