net.sf.zig_project.gpl.test.io
Class ThreadedXferTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynet.sf.zig_project.gpl.test.io.ThreadedXferTest
All Implemented Interfaces:
Test

public class ThreadedXferTest
extends TestCase

Simplistic test case for ThreadedTransfer. Since we are testing a multi-threaded class, the tests are designed to start simple, and grow abusive in an attempt to force out intermittent thread communication problems.

Each test will create a temporary file on the hard disk, containing random data. A ThreadedTransfer is spawned to duplicate that file to some set of mirrors. Then, all mirrors are tested for independantly for equality with the origional file.

Since all files are being stored in the same temporary space (usually a single hard disk) this class is purely a bug test, and a poor gauge for performance testing.

Version:
September 19, 2004
Author:
Frank Ziglar

Method Summary
protected  void setUp()
          Creates all temp files.
static TestSuite suite()
           
protected  void tearDown()
          Deletes temp files.
 void testBulkDuplication()
          Tests ThreadedTransfer.write(byte[], int, int)
 void testByteDuplication()
          Tests ThreadedTransfer.write(int)
 void testSlurpDuplication()
          Tests ThreadedTransfer.slurp(InputStream)
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setUp

protected void setUp()
              throws Exception
Creates all temp files. Fills the source file with random data.

Throws:
Exception

testSlurpDuplication

public void testSlurpDuplication()
                          throws IOException
Tests ThreadedTransfer.slurp(InputStream)

Throws:
IOException

testBulkDuplication

public void testBulkDuplication()
                         throws IOException
Tests ThreadedTransfer.write(byte[], int, int)

Throws:
IOException

testByteDuplication

public void testByteDuplication()
                         throws IOException
Tests ThreadedTransfer.write(int)

Throws:
IOException

tearDown

protected void tearDown()
                 throws Exception
Deletes temp files. May throw an Error if a stream is still open, in which case remnants may have to be cleaned up manually.

Throws:
Exception

suite

public static TestSuite suite()