edu.wpi.prc.task.test
Class DataTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.wpi.prc.task.test.DataTest
All Implemented Interfaces:
junit.framework.Test

public class DataTest
extends junit.framework.TestCase

Tests data partitioning in the Task class.

Author:
James Baldassari

Field Summary
private static int PARTITION_LENGTH
           
private  WorkUnit wu
           
 
Constructor Summary
DataTest(java.lang.String name)
          The constructor initializes Hibernate.
 
Method Summary
private  void reinitializeHibernate()
          Shuts down Hibernate, then initializes it.
protected  void setUp()
          Before every test we start with a clean database by exporting the schema.
 void testBigData()
          Tests saving a 308KB byte array.
 void testDataLengthOne()
          Tests saving data with length = 1.
 void testNullData()
          Tests getting the data before it has been set and setting a null value for the data.
 void testOneAlmostCompletePartition()
          Tests saving data with length = PARTITION_LENGTH - 1.
 void testOneCompleteOneIncompletePartition()
          Tests saving data with PARTITION_LENGTH < length < 2 * PARTITION_LENGTH.
 void testOneCompletePartition()
          Tests saving data with length = PARTITION_LENGTH.
 void testOrder()
          Verfies that the order of the data does not change after it has been saved/retrieved.
 void testReallyBigData()
          Tests saving a 4MB byte array.
 void testSmallDataLength()
          Tests saving data with 1 < length < PARTITION_LENGTH.
 void testZeroData()
          Tests setting the data using a byte array of zero length.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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
 

Field Detail

PARTITION_LENGTH

private static final int PARTITION_LENGTH
See Also:
Constant Field Values

wu

private WorkUnit wu
Constructor Detail

DataTest

public DataTest(java.lang.String name)
The constructor initializes Hibernate.

Parameters:
name - The name of the test.
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Before every test we start with a clean database by exporting the schema.

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

reinitializeHibernate

private void reinitializeHibernate()
Shuts down Hibernate, then initializes it.


testNullData

public void testNullData()
Tests getting the data before it has been set and setting a null value for the data.


testZeroData

public void testZeroData()
Tests setting the data using a byte array of zero length.


testDataLengthOne

public void testDataLengthOne()
Tests saving data with length = 1.


testSmallDataLength

public void testSmallDataLength()
Tests saving data with 1 < length < PARTITION_LENGTH.


testOneAlmostCompletePartition

public void testOneAlmostCompletePartition()
Tests saving data with length = PARTITION_LENGTH - 1.


testOneCompletePartition

public void testOneCompletePartition()
Tests saving data with length = PARTITION_LENGTH.


testOneCompleteOneIncompletePartition

public void testOneCompleteOneIncompletePartition()
Tests saving data with PARTITION_LENGTH < length < 2 * PARTITION_LENGTH.


testBigData

public void testBigData()
Tests saving a 308KB byte array.


testReallyBigData

public void testReallyBigData()
Tests saving a 4MB byte array.


testOrder

public void testOrder()
Verfies that the order of the data does not change after it has been saved/retrieved.