com.webcodepro.applecommander.storage
Class DiskWriterTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.webcodepro.applecommander.storage.DiskWriterTest
All Implemented Interfaces:
junit.framework.Test

public class DiskWriterTest
extends junit.framework.TestCase

Test Disk and FormattedDisk for write.

Date created: Oct 3, 2002 11:35:26 PM

Author:
Rob Greene

Constructor Summary
DiskWriterTest(java.lang.String name)
          Create the DiskWriterTest.
 
Method Summary
protected  void createAndDeleteFiles(FormattedDisk[] disks, java.lang.String filetype)
          Create a bunch of files and then delete them repeatedly.
protected  void createDeleteCreate(FormattedDisk[] disks, java.lang.String filetype)
          Test a create file, delete file, create file sequence.
static void main(java.lang.String[] args)
          Run the test in text mode.
protected  void saveDisks(FormattedDisk[] disks)
          Save a disk, if the saveImage flag has been set to true.
protected  void showDirectory(FormattedDisk[] formattedDisks, java.lang.String title)
          Display the contents of a directory.
protected  void showDiskUsage(FormattedDisk disk)
          Draw a disk usage map.
protected  void showFiles(java.util.List files, java.lang.String indent, boolean showDeleted)
          Display a list of files.
 void testCreateAndDeleteDos33()
          Test creating and deleting many files on a DOS 3.3 140K disk.
 void testCreateAndDeleteOzDos()
          Test creating and deleting many files on an OzDOS 800K disk.
 void testCreateAndDeletePascal140kDisk()
          Test creating and deleting many files on a Pascal 140K disk.
 void testCreateAndDeletePascal800kDisk()
          Test creating and deleting many files on a Pascal 800K disk.
 void testCreateAndDeleteProdos140kDisk()
          Test creating and deleting many files on a ProDOS 140K disk.
 void testCreateAndDeleteProdos800kDisk()
          Test creating and deleting many files on a ProDOS 800K disk.
 void testCreateAndDeleteUniDos()
          Test creating and deleting many files on a UniDOS 800K disk.
 void testCreateDeleteCreateDosDisk()
          Test creating, deleting, and then creating another file which re-uses the old directory entry on a DOS 3.3 140K disk.
 void testCreateDeleteCreateOzdosDisk()
          Test creating, deleting, and then creating another file which re-uses the old directory entry on a OzDOS 800K disk.
 void testCreateDeleteCreatePascalDisk()
          Test creating, deleting, and then creating another file which re-uses the old directory entry on a Pascal 140K disk.
 void testCreateDeleteCreateProdosDisk()
          Test creating, deleting, and then creating another file which re-uses the old directory entry on a ProDOS 140K disk.
 void testCreateDeleteCreateUnidosDisk()
          Test creating, deleting, and then creating another file which re-uses the old directory entry on a UniDOS 800K disk.
 void testWriteToDos33()
          Test writing and reading random files to a DOS 3.3 140K disk.
 void testWriteToDos33Nibble()
          Test writing and reading random files to a DOS 3.3 140K nibbilized disk.
 void testWriteToPascal140kDisk()
          Test writing and reading random files to a ProDOS 140K disk.
 void testWriteToPascal800kDisk()
          Test writing and reading random files to a ProDOS 140K disk.
 void testWriteToProdos140kDisk()
          Test writing and reading random files to a ProDOS 140K disk.
 void testWriteToProdos5mbDisk()
          Test writing and reading random files to a ProDOS 5MB disk.
 void testWriteToProdos800kDisk()
          Test writing and reading random files to a ProDOS 800K disk.
protected  void writeFile(FormattedDisk disk, byte[] data, java.lang.String fileType, boolean test)
          Create a file, write the file, and if specified, verify that the file contents match.
protected  void writeFile(FormattedDisk disk, int size, java.lang.String fileType, boolean test)
          Generate randomized data for writing to disk.
protected  void writeFiles(FormattedDisk[] disks, java.lang.String binaryType, java.lang.String textType, boolean testText)
          Write many files to disk, read from disk, and verify contents.
 
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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiskWriterTest

public DiskWriterTest(java.lang.String name)
Create the DiskWriterTest.

Method Detail

main

public static void main(java.lang.String[] args)
Run the test in text mode.


testWriteToDos33

public void testWriteToDos33()
                      throws DiskFullException,
                             java.io.IOException
Test writing and reading random files to a DOS 3.3 140K disk.

Throws:
DiskFullException
java.io.IOException

testWriteToDos33Nibble

public void testWriteToDos33Nibble()
                            throws DiskFullException,
                                   java.io.IOException
Test writing and reading random files to a DOS 3.3 140K nibbilized disk.

Throws:
DiskFullException
java.io.IOException

testWriteToPascal140kDisk

public void testWriteToPascal140kDisk()
                               throws DiskFullException,
                                      java.io.IOException
Test writing and reading random files to a ProDOS 140K disk.

Throws:
DiskFullException
java.io.IOException

testWriteToPascal800kDisk

public void testWriteToPascal800kDisk()
                               throws DiskFullException,
                                      java.io.IOException
Test writing and reading random files to a ProDOS 140K disk.

Throws:
DiskFullException
java.io.IOException

testWriteToProdos140kDisk

public void testWriteToProdos140kDisk()
                               throws DiskFullException,
                                      java.io.IOException
Test writing and reading random files to a ProDOS 140K disk.

Throws:
DiskFullException
java.io.IOException

testWriteToProdos800kDisk

public void testWriteToProdos800kDisk()
                               throws DiskFullException,
                                      java.io.IOException
Test writing and reading random files to a ProDOS 800K disk.

Throws:
DiskFullException
java.io.IOException

testWriteToProdos5mbDisk

public void testWriteToProdos5mbDisk()
                              throws DiskFullException,
                                     java.io.IOException
Test writing and reading random files to a ProDOS 5MB disk.

Throws:
DiskFullException
java.io.IOException

testCreateAndDeleteDos33

public void testCreateAndDeleteDos33()
                              throws java.io.IOException
Test creating and deleting many files on a DOS 3.3 140K disk.

Throws:
java.io.IOException

testCreateAndDeleteOzDos

public void testCreateAndDeleteOzDos()
                              throws java.io.IOException
Test creating and deleting many files on an OzDOS 800K disk.

Throws:
java.io.IOException

testCreateAndDeleteUniDos

public void testCreateAndDeleteUniDos()
                               throws java.io.IOException
Test creating and deleting many files on a UniDOS 800K disk.

Throws:
java.io.IOException

testCreateAndDeletePascal140kDisk

public void testCreateAndDeletePascal140kDisk()
                                       throws java.io.IOException
Test creating and deleting many files on a Pascal 140K disk.

Throws:
java.io.IOException

testCreateAndDeletePascal800kDisk

public void testCreateAndDeletePascal800kDisk()
                                       throws java.io.IOException
Test creating and deleting many files on a Pascal 800K disk.

Throws:
java.io.IOException

testCreateAndDeleteProdos140kDisk

public void testCreateAndDeleteProdos140kDisk()
                                       throws java.io.IOException
Test creating and deleting many files on a ProDOS 140K disk.

Throws:
java.io.IOException

testCreateAndDeleteProdos800kDisk

public void testCreateAndDeleteProdos800kDisk()
                                       throws java.io.IOException
Test creating and deleting many files on a ProDOS 800K disk.

Throws:
java.io.IOException

testCreateDeleteCreateDosDisk

public void testCreateDeleteCreateDosDisk()
                                   throws DiskFullException,
                                          java.io.IOException
Test creating, deleting, and then creating another file which re-uses the old directory entry on a DOS 3.3 140K disk.

Throws:
DiskFullException
java.io.IOException

testCreateDeleteCreateOzdosDisk

public void testCreateDeleteCreateOzdosDisk()
                                     throws DiskFullException,
                                            java.io.IOException
Test creating, deleting, and then creating another file which re-uses the old directory entry on a OzDOS 800K disk.

Throws:
DiskFullException
java.io.IOException

testCreateDeleteCreateUnidosDisk

public void testCreateDeleteCreateUnidosDisk()
                                      throws DiskFullException,
                                             java.io.IOException
Test creating, deleting, and then creating another file which re-uses the old directory entry on a UniDOS 800K disk.

Throws:
DiskFullException
java.io.IOException

testCreateDeleteCreatePascalDisk

public void testCreateDeleteCreatePascalDisk()
                                      throws DiskFullException,
                                             java.io.IOException
Test creating, deleting, and then creating another file which re-uses the old directory entry on a Pascal 140K disk.

Throws:
DiskFullException
java.io.IOException

testCreateDeleteCreateProdosDisk

public void testCreateDeleteCreateProdosDisk()
                                      throws DiskFullException,
                                             java.io.IOException
Test creating, deleting, and then creating another file which re-uses the old directory entry on a ProDOS 140K disk.

Throws:
DiskFullException
java.io.IOException

writeFiles

protected void writeFiles(FormattedDisk[] disks,
                          java.lang.String binaryType,
                          java.lang.String textType,
                          boolean testText)
                   throws DiskFullException
Write many files to disk, read from disk, and verify contents. The intention is to verify creating files is done correctly, writing of contents is done correctly (the files are a series of random bytes), and reading of files is done correctly.

Throws:
DiskFullException

writeFile

protected void writeFile(FormattedDisk disk,
                         int size,
                         java.lang.String fileType,
                         boolean test)
                  throws DiskFullException
Generate randomized data for writing to disk.

Throws:
DiskFullException

writeFile

protected void writeFile(FormattedDisk disk,
                         byte[] data,
                         java.lang.String fileType,
                         boolean test)
                  throws DiskFullException
Create a file, write the file, and if specified, verify that the file contents match. The verification is optional because some files, depending on the operating system format may not come back in the exact same length.

Throws:
DiskFullException

showDirectory

protected void showDirectory(FormattedDisk[] formattedDisks,
                             java.lang.String title)
Display the contents of a directory.


showFiles

protected void showFiles(java.util.List files,
                         java.lang.String indent,
                         boolean showDeleted)
Display a list of files.


showDiskUsage

protected void showDiskUsage(FormattedDisk disk)
Draw a disk usage map.


createAndDeleteFiles

protected void createAndDeleteFiles(FormattedDisk[] disks,
                                    java.lang.String filetype)
Create a bunch of files and then delete them repeatedly. This is intended to excersize not only creating and deleting files but the disk management (ala Disk Map).


createDeleteCreate

protected void createDeleteCreate(FormattedDisk[] disks,
                                  java.lang.String filetype)
                           throws DiskFullException
Test a create file, delete file, create file sequence. The expected result is that the deleted file entry is reused.

Throws:
DiskFullException

saveDisks

protected void saveDisks(FormattedDisk[] disks)
                  throws java.io.IOException
Save a disk, if the saveImage flag has been set to true.

Throws:
java.io.IOException