org.alfresco.filesys.repo
Class ContentDiskDriverTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.alfresco.filesys.repo.ContentDiskDriverTest
All Implemented Interfaces:
junit.framework.Test

public class ContentDiskDriverTest
extends junit.framework.TestCase

Unit tests for Alfresco Repository ContentDiskDriver


Nested Class Summary
 class ContentDiskDriverTest.TestServer
          Test server
 
Constructor Summary
ContentDiskDriverTest()
           
 
Method Summary
 void DISABLED_testScenarioEmacsSave()
          This test tries to simulate the cifs shuffling that is done to support EMACS a) emacsTest.txt b) Rename original file to emacsTest.txt~ c) Create emacsTest.txt
 void DISABLED_testScenarioSmultronSave()
          This test tries to simulate the cifs shuffling that is done to support smultron a) smultronTest.txt b) Save new file to .dat04cd.004 c) Delete smultronTest.txt c) Rename .dat04cd.004 to smultronTest.txt
protected  void setUp()
           
protected  void tearDown()
           
 void testCreateFile()
          Test Create File
 void testDeleteFile()
          Unit test of delete file
 void testDirListing()
           
 void testFileExists()
          Unit test of file exists
 void testFileInformationUpdatingByEditorUserForAlf8808()
           
 void testMetadataExtraction()
          This test tries to simulate the shuffling that is done by MS Word 2003 with regard to metadata extraction.
 void testOpenCloseVersionableFile()
          Unit test of open read/write close versionable file - should not do anything.
 void testOpenFile()
          Test Open File
 void testRenameFile()
          Unit test of rename file
 void testScenarioDeleteViaNodeService()
          This time we create a file through the ContentDiskDriver and then delete it through the repo.
 void testScenarioFrameMakerShuffle()
          Frame maker save a) Lock File Created (X.fm.lck) b) Create new file (X.fm.C29) c) Existing file rename out of the way.
 void testScenarioMSWord2003SaveAsShuffle()
          Simulates a SaveAs from Word2003 1.
 void testScenarioMSWord2003SaveAsShuffleCheckedOutFile()
          Simulates a SaveAs from Word2003 for a checked out file 1.
 void testScenarioMSWord2003SaveShuffle()
          This test tries to simulate the shuffling that is done by MS Word 2003 upon file save a) TEST.DOC b) Save to ~WRDnnnn.TMP c) Delete ~WRLnnnn.TMP d) Rename TEST.DOC ~WDLnnnn.TMP e) Delete TEST.DOC f) Rename ~WRDnnnn.TMP to TEST.DOC g) Delete ~WRLnnnn.TMP We need to check that properties, aspects, primary assocs, secondary assocs, peer assocs, node type, version history, creation date are maintained.
 void testScenarioMSWord2003SaveShuffleWithBackup()
          This test tries to simulate the shuffling that is done by MS Word 2003 with backup enabled upon file save a) TEST.DOC b) Save to ~WRDnnnn.TMP c) Delete "Backup of TEST.DOC" d) Rename TEST.DOC to "Backup of TEST.DOC" e) Delete TEST.DOC f) Rename ~WRDnnnn.TMP to TEST.DOC We need to check that properties, aspects, primary assocs, secondary assocs, peer assocs, node type, version history, creation date are maintained.
 void testScenarioMSWord2007Save()
          This test tries to simulate the cifs shuffling that is done to support MS Word 2007 a) TEST.DOCX b) Save new to 00000001.TMP c) Rename TEST.DOCX to 00000002.TMP d) Rename 000000001.TMP to TEST.DOCX e) Delete 000000002.TMP
 void testScenarioOpenCloseFile()
          Test Open Close File Scenario 1) open(readOnly) 2) open(readWrite) 3) open(readWrite) - does nothing.
 void testScenarioRenameVersionableFile()
          Unit test of rename versionable file
 void testScenarioViSave()
          This test tries to simulate the cifs shuffling that is done to support vi a) viTest.txt b) Rename original file to viTest.txt~ c) Create viTest.txt d) Delete viTest.txt~
 void testSetFileInfo()
          Test Set Info Three flags set SetDeleteOnClose SetCreationDate SetModifyDate
 void testZeroByteRules()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, 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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentDiskDriverTest

public ContentDiskDriverTest()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

testCreateFile

public void testCreateFile()
                    throws java.lang.Exception
Test Create File

Throws:
java.lang.Exception

testDeleteFile

public void testDeleteFile()
                    throws java.lang.Exception
Unit test of delete file

Throws:
java.lang.Exception

testSetFileInfo

public void testSetFileInfo()
                     throws java.lang.Exception
Test Set Info Three flags set
  1. SetDeleteOnClose
  2. SetCreationDate
  3. SetModifyDate

Throws:
java.lang.Exception

testOpenFile

public void testOpenFile()
                  throws java.lang.Exception
Test Open File

Throws:
java.lang.Exception

testFileExists

public void testFileExists()
                    throws java.lang.Exception
Unit test of file exists

Throws:
java.lang.Exception

testRenameFile

public void testRenameFile()
                    throws java.lang.Exception
Unit test of rename file

Throws:
java.lang.Exception

testScenarioRenameVersionableFile

public void testScenarioRenameVersionableFile()
                                       throws java.lang.Exception
Unit test of rename versionable file

Throws:
java.lang.Exception

testScenarioMSWord2003SaveShuffle

public void testScenarioMSWord2003SaveShuffle()
                                       throws java.lang.Exception
This test tries to simulate the shuffling that is done by MS Word 2003 upon file save a) TEST.DOC b) Save to ~WRDnnnn.TMP c) Delete ~WRLnnnn.TMP d) Rename TEST.DOC ~WDLnnnn.TMP e) Delete TEST.DOC f) Rename ~WRDnnnn.TMP to TEST.DOC g) Delete ~WRLnnnn.TMP We need to check that properties, aspects, primary assocs, secondary assocs, peer assocs, node type, version history, creation date are maintained.

Throws:
java.lang.Exception

testScenarioMSWord2003SaveShuffleWithBackup

public void testScenarioMSWord2003SaveShuffleWithBackup()
                                                 throws java.lang.Exception
This test tries to simulate the shuffling that is done by MS Word 2003 with backup enabled upon file save a) TEST.DOC b) Save to ~WRDnnnn.TMP c) Delete "Backup of TEST.DOC" d) Rename TEST.DOC to "Backup of TEST.DOC" e) Delete TEST.DOC f) Rename ~WRDnnnn.TMP to TEST.DOC We need to check that properties, aspects, primary assocs, secondary assocs, peer assocs, node type, version history, creation date are maintained.

Throws:
java.lang.Exception

testScenarioMSWord2007Save

public void testScenarioMSWord2007Save()
                                throws java.lang.Exception
This test tries to simulate the cifs shuffling that is done to support MS Word 2007 a) TEST.DOCX b) Save new to 00000001.TMP c) Rename TEST.DOCX to 00000002.TMP d) Rename 000000001.TMP to TEST.DOCX e) Delete 000000002.TMP

Throws:
java.lang.Exception

DISABLED_testScenarioEmacsSave

public void DISABLED_testScenarioEmacsSave()
                                    throws java.lang.Exception
This test tries to simulate the cifs shuffling that is done to support EMACS a) emacsTest.txt b) Rename original file to emacsTest.txt~ c) Create emacsTest.txt

Throws:
java.lang.Exception

testScenarioViSave

public void testScenarioViSave()
                        throws java.lang.Exception
This test tries to simulate the cifs shuffling that is done to support vi a) viTest.txt b) Rename original file to viTest.txt~ c) Create viTest.txt d) Delete viTest.txt~

Throws:
java.lang.Exception

DISABLED_testScenarioSmultronSave

public void DISABLED_testScenarioSmultronSave()
                                       throws java.lang.Exception
This test tries to simulate the cifs shuffling that is done to support smultron a) smultronTest.txt b) Save new file to .dat04cd.004 c) Delete smultronTest.txt c) Rename .dat04cd.004 to smultronTest.txt

Throws:
java.lang.Exception

testScenarioDeleteViaNodeService

public void testScenarioDeleteViaNodeService()
                                      throws java.lang.Exception
This time we create a file through the ContentDiskDriver and then delete it through the repo. We check its no longer found by the driver.

Throws:
java.lang.Exception

testMetadataExtraction

public void testMetadataExtraction()
                            throws java.lang.Exception
This test tries to simulate the shuffling that is done by MS Word 2003 with regard to metadata extraction.

1: Setup an inbound rule for ContentMetadataExtractor. 2: Write ContentDiskDriverTest1 file to ContentDiskDriver.docx 3: Check metadata extraction for non update test Simulate a WORD 2003 CIFS shuffle 4: Write ContentDiskDriverTest2 file to ~WRD0003.TMP 5: Rename ContentDiskDriver.docx to ~WRL0003.TMP 6: Rename ~WRD0003.TMP to ContentDiskDriver.docx 7: Check metadata extraction

Throws:
java.lang.Exception

testDirListing

public void testDirListing()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testFileInformationUpdatingByEditorUserForAlf8808

public void testFileInformationUpdatingByEditorUserForAlf8808()
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

testScenarioMSWord2003SaveAsShuffle

public void testScenarioMSWord2003SaveAsShuffle()
                                         throws java.lang.Exception
Simulates a SaveAs from Word2003 1. Create new document SAVEAS.DOC, file did not exist 2. Create -WRDnnnn.TMP file, where 'nnnn' is a 4 digit sequence to make the name unique 3. Rename SAVEAS.DOC to Backup of SAVEAS.wbk 4. Rename -WRDnnnn.TMP to SAVEAS.DOC

Throws:
java.lang.Exception

testScenarioOpenCloseFile

public void testScenarioOpenCloseFile()
                               throws java.lang.Exception
Test Open Close File Scenario 1) open(readOnly) 2) open(readWrite) 3) open(readWrite) - does nothing. 4) close - does nothing 5) close - does nothing 6) close - updates the repo

Throws:
java.lang.Exception

testOpenCloseVersionableFile

public void testOpenCloseVersionableFile()
                                  throws java.lang.Exception
Unit test of open read/write close versionable file - should not do anything.

This is done with a CIFS shuffle from word. Basically Word holds the file open with a read/write lock while the shuffle is going on.

Create a file. Apply versionable aspect Open the file ReadWrite + OpLocks Close the file Check Version has not incremented.

Throws:
java.lang.Exception

testScenarioFrameMakerShuffle

public void testScenarioFrameMakerShuffle()
                                   throws java.lang.Exception
Frame maker save a) Lock File Created (X.fm.lck) b) Create new file (X.fm.C29) c) Existing file rename out of the way. (X.backup.fm) d) New file rename into place. (X.fm.C29) e) Old file deleted (open with delete on close) f) Lock file deleted (open with delete on close)

Throws:
java.lang.Exception

testZeroByteRules

public void testZeroByteRules()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testScenarioMSWord2003SaveAsShuffleCheckedOutFile

public void testScenarioMSWord2003SaveAsShuffleCheckedOutFile()
                                                       throws java.lang.Exception
Simulates a SaveAs from Word2003 for a checked out file 1. Create new document TESTFILE.DOC, file did not exist 2. CheckOut TESTFILE.DOC 3. Create -WRDnnnn.TMP file, where 'nnnn' is a 4 digit sequence to make the name unique 4. Rename TESTFILE(Working Copy).DOC to Backup of SAVEAS.wbk 5. Rename -WRDnnnn.TMP to TESTFILE(Working Copy).DOC 6 CheckIn working copy. 7. Validate TESTFILE.DOC

Throws:
java.lang.Exception


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.