org.apache.derbyTesting.functionTests.tests.memory
Class BlobMemTest

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.junit.BaseJDBCTestCase
                  extended by org.apache.derbyTesting.functionTests.tests.memory.BlobMemTest
All Implemented Interfaces:
junit.framework.Test

public class BlobMemTest
extends BaseJDBCTestCase


Field Summary
private static int LONG_BLOB_LENGTH
           
private static java.lang.String LONG_BLOB_LENGTH_STRING
           
private static byte[] SHORT_BLOB_BYTES
           
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
BlobMemTest(java.lang.String name)
           
 
Method Summary
static junit.framework.Test suite()
           
 void tearDown()
          Tear down this fixture, sub-classes should call super.tearDown().
 void testBlobLength()
          Test the length after inserting with the setBinaryStream api that takes length.
private  void testBlobLength(boolean lengthless, int extraLen)
          Insert a blob and test length.
 void testBlobLengthTooLongDerby961()
          Simple test to excercise message 22001 as described in DERBY-961.
 void testBlobLengthWithLengthlessInsert()
          Test the length after inserting the blob value with the lengthless setBinaryStream api.
 
Methods inherited from class org.apache.derbyTesting.junit.BaseJDBCTestCase
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertTableRowCount, assertUpdateCount, assertUpdateCount, checkAllConsistency, checkEstimatedRowCount, commit, createStatement, createStatement, createStatement, dropTable, dropTable, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runScript, runScript, runSQLCommands, setAutoCommit, usingDB2Client, usingDerbyNetClient, usingEmbedded
 
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, 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

LONG_BLOB_LENGTH

private static final int LONG_BLOB_LENGTH
See Also:
Constant Field Values

LONG_BLOB_LENGTH_STRING

private static final java.lang.String LONG_BLOB_LENGTH_STRING
See Also:
Constant Field Values

SHORT_BLOB_BYTES

private static final byte[] SHORT_BLOB_BYTES
Constructor Detail

BlobMemTest

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

tearDown

public void tearDown()
              throws java.sql.SQLException
Description copied from class: BaseJDBCTestCase
Tear down this fixture, sub-classes should call super.tearDown(). This cleanups & closes the connection if it is open and any statement objects returned through the utility methods.

Overrides:
tearDown in class BaseJDBCTestCase
Throws:
java.sql.SQLException

testBlobLength

private void testBlobLength(boolean lengthless,
                            int extraLen)
                     throws java.sql.SQLException,
                            java.io.IOException,
                            java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException,
                            java.lang.reflect.InvocationTargetException
Insert a blob and test length.

Parameters:
lengthless - if true use the lengthless setBinaryStream api
Throws:
java.sql.SQLException
java.io.IOException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException

testBlobLength

public void testBlobLength()
                    throws java.sql.SQLException,
                           java.io.IOException,
                           java.lang.IllegalArgumentException,
                           java.lang.IllegalAccessException,
                           java.lang.reflect.InvocationTargetException
Test the length after inserting with the setBinaryStream api that takes length. In this case the length will be encoded at the begining of the stream and the call should be fairly low overhead.

Throws:
java.sql.SQLException
java.io.IOException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException

testBlobLengthWithLengthlessInsert

public void testBlobLengthWithLengthlessInsert()
                                        throws java.sql.SQLException,
                                               java.io.IOException,
                                               java.lang.IllegalArgumentException,
                                               java.lang.IllegalAccessException,
                                               java.lang.reflect.InvocationTargetException
Test the length after inserting the blob value with the lengthless setBinaryStream api. In this case we will have to read the whole stream to get the length.

Throws:
java.sql.SQLException
java.io.IOException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException

testBlobLengthTooLongDerby961

public void testBlobLengthTooLongDerby961()
                                   throws java.sql.SQLException,
                                          java.io.IOException,
                                          java.lang.IllegalArgumentException,
                                          java.lang.IllegalAccessException,
                                          java.lang.reflect.InvocationTargetException
Simple test to excercise message 22001 as described in DERBY-961.

Throws:
java.sql.SQLException
java.io.IOException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

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.