Noticed compile errors for unit tests, correcting.
This commit is contained in:
parent
9c4624133b
commit
0f83ba94b6
|
@ -49,7 +49,7 @@ public class DiskHelperTest extends TestCase {
|
||||||
junit.textui.TestRunner.run(DiskHelperTest.class);
|
junit.textui.TestRunner.run(DiskHelperTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLoadDos33() throws IOException {
|
public void testLoadDos33() throws IOException, DiskException {
|
||||||
FormattedDisk[] disks = showDirectory(config.getDiskDir() +
|
FormattedDisk[] disks = showDirectory(config.getDiskDir() +
|
||||||
"/DOS 3.3.po"); //$NON-NLS-1$
|
"/DOS 3.3.po"); //$NON-NLS-1$
|
||||||
assertApplesoftFile(disks[0], "HELLO"); //$NON-NLS-1$
|
assertApplesoftFile(disks[0], "HELLO"); //$NON-NLS-1$
|
||||||
|
@ -58,39 +58,39 @@ public class DiskHelperTest extends TestCase {
|
||||||
assertBinaryFile(disks[0], "BOOT13"); //$NON-NLS-1$
|
assertBinaryFile(disks[0], "BOOT13"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLoadMaster() throws IOException {
|
public void testLoadMaster() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir() + "/MASTER.DSK"); //$NON-NLS-1$
|
showDirectory(config.getDiskDir() + "/MASTER.DSK"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLoadGalacticAttack1() throws IOException {
|
public void testLoadGalacticAttack1() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir() + "/galatt.dsk"); //$NON-NLS-1$
|
showDirectory(config.getDiskDir() + "/galatt.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLoadProdos() throws IOException {
|
public void testLoadProdos() throws IOException, DiskException {
|
||||||
FormattedDisk[] disks = showDirectory(config.getDiskDir() + "/Prodos.dsk"); //$NON-NLS-1$
|
FormattedDisk[] disks = showDirectory(config.getDiskDir() + "/Prodos.dsk"); //$NON-NLS-1$
|
||||||
assertApplesoftFile(disks[0], "COPY.ME"); //$NON-NLS-1$
|
assertApplesoftFile(disks[0], "COPY.ME"); //$NON-NLS-1$
|
||||||
assertBinaryFile(disks[0], "SETTINGS"); //$NON-NLS-1$
|
assertBinaryFile(disks[0], "SETTINGS"); //$NON-NLS-1$
|
||||||
assertBinaryFile(disks[0], "PRODOS"); //$NON-NLS-1$
|
assertBinaryFile(disks[0], "PRODOS"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLoadMarbleMadness() throws IOException {
|
public void testLoadMarbleMadness() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir()
|
showDirectory(config.getDiskDir()
|
||||||
+ "/Marble Madness (1985)(Electronic Arts).2mg"); //$NON-NLS-1$
|
+ "/Marble Madness (1985)(Electronic Arts).2mg"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLoadHd1() throws IOException {
|
public void testLoadHd1() throws IOException, DiskException {
|
||||||
showDirectory("C:/My Apple2/ApplePC/hd1.hdv"); //$NON-NLS-1$
|
showDirectory("C:/My Apple2/ApplePC/hd1.hdv"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRdosBoot() throws IOException {
|
public void testRdosBoot() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir() + "/RDOSboot.dsk"); //$NON-NLS-1$
|
showDirectory(config.getDiskDir() + "/RDOSboot.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSsiSave() throws IOException {
|
public void testSsiSave() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir() + "/SSIsave.dsk"); //$NON-NLS-1$
|
showDirectory(config.getDiskDir() + "/SSIsave.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPhan2d1() throws IOException {
|
public void testPhan2d1() throws IOException, DiskException {
|
||||||
FormattedDisk[] disks = showDirectory(config.getDiskDir()
|
FormattedDisk[] disks = showDirectory(config.getDiskDir()
|
||||||
+ "/phan2d1.dsk"); //$NON-NLS-1$
|
+ "/phan2d1.dsk"); //$NON-NLS-1$
|
||||||
assertApplesoftFile(disks[0], "PHANTASIE II"); //$NON-NLS-1$
|
assertApplesoftFile(disks[0], "PHANTASIE II"); //$NON-NLS-1$
|
||||||
|
@ -99,42 +99,42 @@ public class DiskHelperTest extends TestCase {
|
||||||
assertGraphicsFile(disks[0], "ICE DRAGON"); //$NON-NLS-1$
|
assertGraphicsFile(disks[0], "ICE DRAGON"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPhan2d2() throws IOException {
|
public void testPhan2d2() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir() + "/phan2d2.dsk"); //$NON-NLS-1$
|
showDirectory(config.getDiskDir() + "/phan2d2.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPhantasie1() throws IOException {
|
public void testPhantasie1() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir() + "/Phantasie1.dsk"); //$NON-NLS-1$
|
showDirectory(config.getDiskDir() + "/Phantasie1.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPhantasie2() throws IOException {
|
public void testPhantasie2() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir() + "/Phantasie2.dsk"); //$NON-NLS-1$
|
showDirectory(config.getDiskDir() + "/Phantasie2.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCavernsOfFreitag() throws IOException {
|
public void testCavernsOfFreitag() throws IOException, DiskException {
|
||||||
FormattedDisk[] disks = showDirectory(config.getDiskDir()
|
FormattedDisk[] disks = showDirectory(config.getDiskDir()
|
||||||
+ "/CavernsOfFreitag.dsk"); //$NON-NLS-1$
|
+ "/CavernsOfFreitag.dsk"); //$NON-NLS-1$
|
||||||
assertGraphicsFile(disks[0], "TITLE.PIC"); //$NON-NLS-1$
|
assertGraphicsFile(disks[0], "TITLE.PIC"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUniDosD3110() throws IOException {
|
public void testUniDosD3110() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir()
|
showDirectory(config.getDiskDir()
|
||||||
+ "/UniDOS/D3110.dsk"); //$NON-NLS-1$
|
+ "/UniDOS/D3110.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUniDosD3151() throws IOException {
|
public void testUniDosD3151() throws IOException, DiskException {
|
||||||
showDirectory(config.getDiskDir()
|
showDirectory(config.getDiskDir()
|
||||||
+ "/UniDOS/D3151.dsk"); //$NON-NLS-1$
|
+ "/UniDOS/D3151.dsk"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FormattedDisk[] showDirectory(String imageName) throws IOException {
|
protected FormattedDisk[] showDirectory(String imageName) throws IOException, DiskException {
|
||||||
Disk disk = new Disk(imageName);
|
Disk disk = new Disk(imageName);
|
||||||
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
FormattedDisk[] formattedDisks = disk.getFormattedDisks();
|
||||||
for (int i=0; i<formattedDisks.length; i++) {
|
for (int i=0; i<formattedDisks.length; i++) {
|
||||||
FormattedDisk formattedDisk = formattedDisks[i];
|
FormattedDisk formattedDisk = formattedDisks[i];
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println(formattedDisk.getDiskName());
|
System.out.println(formattedDisk.getDiskName());
|
||||||
List files = formattedDisk.getFiles();
|
List<FileEntry> files = formattedDisk.getFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
showFiles(files, ""); //$NON-NLS-1$
|
showFiles(files, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -150,11 +150,11 @@ public class DiskHelperTest extends TestCase {
|
||||||
return formattedDisks;
|
return formattedDisks;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showFiles(List files, String indent) {
|
protected void showFiles(List<FileEntry> files, String indent) throws DiskException {
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
FileEntry entry = files.get(i);
|
||||||
if (!entry.isDeleted()) {
|
if (!entry.isDeleted()) {
|
||||||
List data = entry.getFileColumnData(FormattedDisk.FILE_DISPLAY_NATIVE);
|
List<String> data = entry.getFileColumnData(FormattedDisk.FILE_DISPLAY_NATIVE);
|
||||||
System.out.print(indent);
|
System.out.print(indent);
|
||||||
for (int d=0; d<data.size(); d++) {
|
for (int d=0; d<data.size(); d++) {
|
||||||
System.out.print(data.get(d));
|
System.out.print(data.get(d));
|
||||||
|
@ -196,7 +196,7 @@ public class DiskHelperTest extends TestCase {
|
||||||
System.out.println("U = used, . = free"); //$NON-NLS-1$
|
System.out.println("U = used, . = free"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertApplesoftFile(FormattedDisk disk, String filename) {
|
protected void assertApplesoftFile(FormattedDisk disk, String filename) throws DiskException {
|
||||||
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
||||||
FileEntry fileEntry = disk.getFile(filename);
|
FileEntry fileEntry = disk.getFile(filename);
|
||||||
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
||||||
|
@ -204,7 +204,7 @@ public class DiskHelperTest extends TestCase {
|
||||||
fileEntry.getSuggestedFilter() instanceof ApplesoftFileFilter);
|
fileEntry.getSuggestedFilter() instanceof ApplesoftFileFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertIntegerFile(FormattedDisk disk, String filename) {
|
protected void assertIntegerFile(FormattedDisk disk, String filename) throws DiskException {
|
||||||
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
||||||
FileEntry fileEntry = disk.getFile(filename);
|
FileEntry fileEntry = disk.getFile(filename);
|
||||||
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
||||||
|
@ -212,7 +212,7 @@ public class DiskHelperTest extends TestCase {
|
||||||
fileEntry.getSuggestedFilter() instanceof IntegerBasicFileFilter);
|
fileEntry.getSuggestedFilter() instanceof IntegerBasicFileFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertTextFile(FormattedDisk disk, String filename) {
|
protected void assertTextFile(FormattedDisk disk, String filename) throws DiskException {
|
||||||
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
||||||
FileEntry fileEntry = disk.getFile(filename);
|
FileEntry fileEntry = disk.getFile(filename);
|
||||||
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
||||||
|
@ -220,7 +220,7 @@ public class DiskHelperTest extends TestCase {
|
||||||
fileEntry.getSuggestedFilter() instanceof TextFileFilter);
|
fileEntry.getSuggestedFilter() instanceof TextFileFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertBinaryFile(FormattedDisk disk, String filename) {
|
protected void assertBinaryFile(FormattedDisk disk, String filename) throws DiskException {
|
||||||
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
||||||
FileEntry fileEntry = disk.getFile(filename);
|
FileEntry fileEntry = disk.getFile(filename);
|
||||||
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
||||||
|
@ -228,7 +228,7 @@ public class DiskHelperTest extends TestCase {
|
||||||
fileEntry.getSuggestedFilter() instanceof BinaryFileFilter);
|
fileEntry.getSuggestedFilter() instanceof BinaryFileFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertGraphicsFile(FormattedDisk disk, String filename) {
|
protected void assertGraphicsFile(FormattedDisk disk, String filename) throws DiskException {
|
||||||
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: Disk should not be null", disk); //$NON-NLS-1$
|
||||||
FileEntry fileEntry = disk.getFile(filename);
|
FileEntry fileEntry = disk.getFile(filename);
|
||||||
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
assertNotNull(filename + " test: File not found", disk); //$NON-NLS-1$
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test writing and reading random files to a DOS 3.3 140K disk.
|
* Test writing and reading random files to a DOS 3.3 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToDos33() throws DiskFullException, IOException {
|
public void testWriteToDos33() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new DosOrder(imageLayout);
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = DosFormatDisk.create("write-test-dos33.dsk", imageOrder); //$NON-NLS-1$
|
FormattedDisk[] disks = DosFormatDisk.create("write-test-dos33.dsk", imageOrder); //$NON-NLS-1$
|
||||||
|
@ -77,7 +77,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test writing and reading random files to a DOS 3.3 140K nibbilized disk.
|
* Test writing and reading random files to a DOS 3.3 140K nibbilized disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToDos33Nibble() throws DiskFullException, IOException {
|
public void testWriteToDos33Nibble() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_NIBBLE_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_NIBBLE_DISK);
|
||||||
ImageOrder imageOrder = new NibbleOrder(imageLayout);
|
ImageOrder imageOrder = new NibbleOrder(imageLayout);
|
||||||
FormattedDisk[] disks = DosFormatDisk.create("write-test-dos33.nib", imageOrder); //$NON-NLS-1$
|
FormattedDisk[] disks = DosFormatDisk.create("write-test-dos33.nib", imageOrder); //$NON-NLS-1$
|
||||||
|
@ -88,7 +88,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test writing and reading random files to a ProDOS 140K disk.
|
* Test writing and reading random files to a ProDOS 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToPascal140kDisk() throws DiskFullException, IOException {
|
public void testWriteToPascal140kDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = PascalFormatDisk.create(
|
FormattedDisk[] disks = PascalFormatDisk.create(
|
||||||
|
@ -112,7 +112,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test writing and reading random files to a ProDOS 140K disk.
|
* Test writing and reading random files to a ProDOS 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToProdos140kDisk() throws DiskFullException, IOException {
|
public void testWriteToProdos140kDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
|
@ -124,7 +124,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test writing and reading random files to a ProDOS 800K disk.
|
* Test writing and reading random files to a ProDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToProdos800kDisk() throws DiskFullException, IOException {
|
public void testWriteToProdos800kDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
|
@ -136,7 +136,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test writing and reading random files to a ProDOS 5MB disk.
|
* Test writing and reading random files to a ProDOS 5MB disk.
|
||||||
*/
|
*/
|
||||||
public void testWriteToProdos5mbDisk() throws DiskFullException, IOException {
|
public void testWriteToProdos5mbDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_5MB_HARDDISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_5MB_HARDDISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
|
@ -148,7 +148,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test creating and deleting many files on a DOS 3.3 140K disk.
|
* Test creating and deleting many files on a DOS 3.3 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteDos33() throws IOException {
|
public void testCreateAndDeleteDos33() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new DosOrder(imageLayout);
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = DosFormatDisk.create(
|
FormattedDisk[] disks = DosFormatDisk.create(
|
||||||
|
@ -160,7 +160,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test creating and deleting many files on an OzDOS 800K disk.
|
* Test creating and deleting many files on an OzDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteOzDos() throws IOException {
|
public void testCreateAndDeleteOzDos() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = OzDosFormatDisk.create(
|
FormattedDisk[] disks = OzDosFormatDisk.create(
|
||||||
|
@ -172,7 +172,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test creating and deleting many files on a UniDOS 800K disk.
|
* Test creating and deleting many files on a UniDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteUniDos() throws IOException {
|
public void testCreateAndDeleteUniDos() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
ImageOrder imageOrder = new DosOrder(imageLayout);
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = UniDosFormatDisk.create(
|
FormattedDisk[] disks = UniDosFormatDisk.create(
|
||||||
|
@ -184,7 +184,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test creating and deleting many files on a Pascal 140K disk.
|
* Test creating and deleting many files on a Pascal 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeletePascal140kDisk() throws IOException {
|
public void testCreateAndDeletePascal140kDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = PascalFormatDisk.create(
|
FormattedDisk[] disks = PascalFormatDisk.create(
|
||||||
|
@ -197,7 +197,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test creating and deleting many files on a Pascal 800K disk.
|
* Test creating and deleting many files on a Pascal 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeletePascal800kDisk() throws IOException {
|
public void testCreateAndDeletePascal800kDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = PascalFormatDisk.create(
|
FormattedDisk[] disks = PascalFormatDisk.create(
|
||||||
|
@ -210,7 +210,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test creating and deleting many files on a ProDOS 140K disk.
|
* Test creating and deleting many files on a ProDOS 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteProdos140kDisk() throws IOException {
|
public void testCreateAndDeleteProdos140kDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new DosOrder(imageLayout);
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
|
@ -223,7 +223,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test creating and deleting many files on a ProDOS 800K disk.
|
* Test creating and deleting many files on a ProDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateAndDeleteProdos800kDisk() throws IOException {
|
public void testCreateAndDeleteProdos800kDisk() throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
|
@ -238,7 +238,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* the old directory entry on a DOS 3.3 140K disk.
|
* the old directory entry on a DOS 3.3 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateDosDisk()
|
public void testCreateDeleteCreateDosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new DosOrder(imageLayout);
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = DosFormatDisk.create(
|
FormattedDisk[] disks = DosFormatDisk.create(
|
||||||
|
@ -252,7 +252,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* the old directory entry on a OzDOS 800K disk.
|
* the old directory entry on a OzDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateOzdosDisk()
|
public void testCreateDeleteCreateOzdosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = OzDosFormatDisk.create(
|
FormattedDisk[] disks = OzDosFormatDisk.create(
|
||||||
|
@ -266,7 +266,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* the old directory entry on a UniDOS 800K disk.
|
* the old directory entry on a UniDOS 800K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateUnidosDisk()
|
public void testCreateDeleteCreateUnidosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_800KB_DISK);
|
||||||
ImageOrder imageOrder = new DosOrder(imageLayout);
|
ImageOrder imageOrder = new DosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = UniDosFormatDisk.create(
|
FormattedDisk[] disks = UniDosFormatDisk.create(
|
||||||
|
@ -280,7 +280,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* the old directory entry on a Pascal 140K disk.
|
* the old directory entry on a Pascal 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreatePascalDisk()
|
public void testCreateDeleteCreatePascalDisk()
|
||||||
throws DiskFullException, IOException {
|
throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = PascalFormatDisk.create(
|
FormattedDisk[] disks = PascalFormatDisk.create(
|
||||||
|
@ -295,7 +295,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* the old directory entry on a ProDOS 140K disk.
|
* the old directory entry on a ProDOS 140K disk.
|
||||||
*/
|
*/
|
||||||
public void testCreateDeleteCreateProdosDisk()
|
public void testCreateDeleteCreateProdosDisk()
|
||||||
throws DiskFullException, IOException {
|
throws IOException, DiskException {
|
||||||
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(Disk.APPLE_140KB_DISK);
|
||||||
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
ImageOrder imageOrder = new ProdosOrder(imageLayout);
|
||||||
FormattedDisk[] disks = ProdosFormatDisk.create(
|
FormattedDisk[] disks = ProdosFormatDisk.create(
|
||||||
|
@ -312,7 +312,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* random bytes), and reading of files is done correctly.
|
* random bytes), and reading of files is done correctly.
|
||||||
*/
|
*/
|
||||||
protected void writeFiles(FormattedDisk[] disks, String binaryType,
|
protected void writeFiles(FormattedDisk[] disks, String binaryType,
|
||||||
String textType, boolean testText) throws DiskFullException {
|
String textType, boolean testText) throws DiskException {
|
||||||
FormattedDisk disk = disks[0];
|
FormattedDisk disk = disks[0];
|
||||||
showDirectory(disks, "BEFORE FILE CREATION"); //$NON-NLS-1$
|
showDirectory(disks, "BEFORE FILE CREATION"); //$NON-NLS-1$
|
||||||
writeFile(disk, 1, binaryType, true);
|
writeFile(disk, 1, binaryType, true);
|
||||||
|
@ -340,7 +340,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* Generate randomized data for writing to disk.
|
* Generate randomized data for writing to disk.
|
||||||
*/
|
*/
|
||||||
protected void writeFile(FormattedDisk disk, int size, String fileType,
|
protected void writeFile(FormattedDisk disk, int size, String fileType,
|
||||||
boolean test) throws DiskFullException {
|
boolean test) throws DiskException {
|
||||||
byte[] data = new byte[size];
|
byte[] data = new byte[size];
|
||||||
for (int i=0; i<data.length; i++) {
|
for (int i=0; i<data.length; i++) {
|
||||||
data[i] = (byte)(Math.random() * 1024);
|
data[i] = (byte)(Math.random() * 1024);
|
||||||
|
@ -355,7 +355,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* exact same length.
|
* exact same length.
|
||||||
*/
|
*/
|
||||||
protected void writeFile(FormattedDisk disk, byte[] data, String fileType,
|
protected void writeFile(FormattedDisk disk, byte[] data, String fileType,
|
||||||
boolean test) throws DiskFullException {
|
boolean test) throws DiskException {
|
||||||
FileEntry entry = disk.createFile();
|
FileEntry entry = disk.createFile();
|
||||||
entry.setFilename("file-" + data.length); //$NON-NLS-1$
|
entry.setFilename("file-" + data.length); //$NON-NLS-1$
|
||||||
entry.setFiletype(fileType);
|
entry.setFiletype(fileType);
|
||||||
|
@ -373,7 +373,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Display the contents of a directory.
|
* Display the contents of a directory.
|
||||||
*/
|
*/
|
||||||
protected void showDirectory(FormattedDisk[] formattedDisks, String title) {
|
protected void showDirectory(FormattedDisk[] formattedDisks, String title) throws DiskException {
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println("************************************************"); //$NON-NLS-1$
|
System.out.println("************************************************"); //$NON-NLS-1$
|
||||||
System.out.println(title);
|
System.out.println(title);
|
||||||
|
@ -381,7 +381,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
FormattedDisk formattedDisk = formattedDisks[i];
|
FormattedDisk formattedDisk = formattedDisks[i];
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println(formattedDisk.getDiskName());
|
System.out.println(formattedDisk.getDiskName());
|
||||||
List files = formattedDisk.getFiles();
|
List<FileEntry> files = formattedDisk.getFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
showFiles(files, "", false); //$NON-NLS-1$
|
showFiles(files, "", false); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -402,11 +402,11 @@ public class DiskWriterTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Display a list of files.
|
* Display a list of files.
|
||||||
*/
|
*/
|
||||||
protected void showFiles(List files, String indent, boolean showDeleted) {
|
protected void showFiles(List<FileEntry> files, String indent, boolean showDeleted) throws DiskException {
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
FileEntry entry = (FileEntry) files.get(i);
|
||||||
if (showDeleted || !entry.isDeleted()) {
|
if (showDeleted || !entry.isDeleted()) {
|
||||||
List data = entry.getFileColumnData(FormattedDisk.FILE_DISPLAY_NATIVE);
|
List<String> data = entry.getFileColumnData(FormattedDisk.FILE_DISPLAY_NATIVE);
|
||||||
System.out.print(indent);
|
System.out.print(indent);
|
||||||
for (int d=0; d<data.size(); d++) {
|
for (int d=0; d<data.size(); d++) {
|
||||||
System.out.print(data.get(d));
|
System.out.print(data.get(d));
|
||||||
|
@ -457,7 +457,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
* This is intended to excersize not only creating and deleting
|
* This is intended to excersize not only creating and deleting
|
||||||
* files but the disk management (ala Disk Map).
|
* files but the disk management (ala Disk Map).
|
||||||
*/
|
*/
|
||||||
protected void createAndDeleteFiles(FormattedDisk[] disks, String filetype) {
|
protected void createAndDeleteFiles(FormattedDisk[] disks, String filetype) throws DiskException {
|
||||||
byte[] data = new byte[129 * 1024];
|
byte[] data = new byte[129 * 1024];
|
||||||
for (int i=0; i<data.length; i++) {
|
for (int i=0; i<data.length; i++) {
|
||||||
data[i] = (byte)(Math.random() * 1024);
|
data[i] = (byte)(Math.random() * 1024);
|
||||||
|
@ -479,7 +479,7 @@ public class DiskWriterTest extends TestCase {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
// Remove the files:
|
// Remove the files:
|
||||||
List files = disk.getFiles();
|
List<FileEntry> files = disk.getFiles();
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
FileEntry entry = (FileEntry) files.get(i);
|
||||||
entry.delete();
|
entry.delete();
|
||||||
|
@ -498,13 +498,13 @@ public class DiskWriterTest extends TestCase {
|
||||||
* The expected result is that the deleted file entry is reused.
|
* The expected result is that the deleted file entry is reused.
|
||||||
*/
|
*/
|
||||||
protected void createDeleteCreate(FormattedDisk[] disks, String filetype)
|
protected void createDeleteCreate(FormattedDisk[] disks, String filetype)
|
||||||
throws DiskFullException {
|
throws DiskException {
|
||||||
for (int d=0; d<disks.length; d++) {
|
for (int d=0; d<disks.length; d++) {
|
||||||
FormattedDisk disk = disks[d];
|
FormattedDisk disk = disks[d];
|
||||||
System.out.println("Exercising create, delete, create sequence " //$NON-NLS-1$
|
System.out.println("Exercising create, delete, create sequence " //$NON-NLS-1$
|
||||||
+ "on disk " + disk.getDiskName() + "."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ "on disk " + disk.getDiskName() + "."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
writeFile(disk, 5432, filetype, false);
|
writeFile(disk, 5432, filetype, false);
|
||||||
List files = disk.getFiles();
|
List<FileEntry> files = disk.getFiles();
|
||||||
for (int i=0; i<files.size(); i++) {
|
for (int i=0; i<files.size(); i++) {
|
||||||
FileEntry entry = (FileEntry) files.get(i);
|
FileEntry entry = (FileEntry) files.get(i);
|
||||||
entry.delete();
|
entry.delete();
|
||||||
|
|
Loading…
Reference in New Issue