org.apache.derbyTesting.functionTests.tests.derbynet
Class ByteArrayCombinerStreamTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.derbyTesting.junit.BaseTestCase
              extended by org.apache.derbyTesting.functionTests.tests.derbynet.ByteArrayCombinerStreamTest
All Implemented Interfaces:
junit.framework.Test

public class ByteArrayCombinerStreamTest
extends BaseTestCase

Test functionality of ByteArrayCombinerStream.


Field Summary
private  org.apache.derby.client.am.ByteArrayCombinerStream combiner
           
private static byte[] defaultArray
           
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
ByteArrayCombinerStreamTest(java.lang.String name)
           
 
Method Summary
static junit.framework.Test suite()
           
 void testCombineAvailable4bytes()
           
 void testCombineAvailableNull()
           
 void testCombineNullRead()
           
 void testCombineNullReadArray()
           
 void testCombineOneArray()
           
 void testCombineWithExtraEmptyByteArray()
          Make sure an extra "empty" array doesn't cause errors.
 void testCominbe100SmallArrays()
           
 void testNegativeLengthArgument()
          Make sure an exception is thrown if a negative length is specified.
 void testNegativeValueInDataCausesEndOfStream()
          Demonstrate that the stream does not change negative values in the underlying data.
 void testTooLittleDataNoCombine()
          Make sure an exception is thrown if there is less data available than the specified length.
 void testTooLittleDataWithCombine()
          Make sure an exception is thrown if there is less data available than the specified length.
 void testTruncateDataFromOneArray()
           
 void testTruncateDataFromTwoArrays()
           
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultArray

private static final byte[] defaultArray

combiner

private org.apache.derby.client.am.ByteArrayCombinerStream combiner
Constructor Detail

ByteArrayCombinerStreamTest

public ByteArrayCombinerStreamTest(java.lang.String name)
Method Detail

testCombineNullRead

public void testCombineNullRead()
                         throws java.io.IOException
Throws:
java.io.IOException

testCombineNullReadArray

public void testCombineNullReadArray()
                              throws java.io.IOException
Throws:
java.io.IOException

testCombineAvailableNull

public void testCombineAvailableNull()
                              throws java.io.IOException
Throws:
java.io.IOException

testCombineAvailable4bytes

public void testCombineAvailable4bytes()
                                throws java.io.IOException
Throws:
java.io.IOException

testCombineWithExtraEmptyByteArray

public void testCombineWithExtraEmptyByteArray()
                                        throws java.io.IOException
Make sure an extra "empty" array doesn't cause errors. This test is based on knowledge of the implementation, where an extra byte array was not removed during the reducation process. This can cause nextArray to not return null when it should, causing an ArrayIndexOutOfBoundsException. This bug was corrected by DERBY-1417.

Throws:
java.io.IOException

testCombineOneArray

public void testCombineOneArray()
                         throws java.io.IOException
Throws:
java.io.IOException

testCominbe100SmallArrays

public void testCominbe100SmallArrays()
                               throws java.io.IOException
Throws:
java.io.IOException

testTruncateDataFromOneArray

public void testTruncateDataFromOneArray()
                                  throws java.io.IOException
Throws:
java.io.IOException

testTruncateDataFromTwoArrays

public void testTruncateDataFromTwoArrays()
                                   throws java.io.IOException
Throws:
java.io.IOException

testTooLittleDataNoCombine

public void testTooLittleDataNoCombine()
Make sure an exception is thrown if there is less data available than the specified length.


testTooLittleDataWithCombine

public void testTooLittleDataWithCombine()
Make sure an exception is thrown if there is less data available than the specified length.


testNegativeLengthArgument

public void testNegativeLengthArgument()
Make sure an exception is thrown if a negative length is specified.


testNegativeValueInDataCausesEndOfStream

public void testNegativeValueInDataCausesEndOfStream()
                                              throws java.io.IOException
Demonstrate that the stream does not change negative values in the underlying data. This can cause code to believe the stream is exhausted even though it is not.

Throws:
java.io.IOException

suite

public static junit.framework.Test suite()

Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.