org.apache.derbyTesting.functionTests.tests.jdbcapi
Class CharacterStreamsTest

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.jdbcapi.CharacterStreamsTest
All Implemented Interfaces:
junit.framework.Test

public class CharacterStreamsTest
extends BaseJDBCTestCase

Tests the following PreparedStatement methods: -> setCharacterStream(int parameterIndex, InputStream x, int length) -> setAsciiStream(int parameterIndex, Reader reader, int length)


Field Summary
private static java.lang.String ASCII_VALUE
           
private static java.lang.String CHAR_VALUE1
           
private static java.lang.String CHAR_VALUE2
           
private static int LEN_ASCII_VALUE
           
private static int LEN_CHAR_VALUE1
           
private static int LEN_CHAR_VALUE2
           
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
CharacterStreamsTest(java.lang.String name)
          Creates a new instance of CharacterStreamsTest
 
Method Summary
private  void checkAsciiStream(java.io.InputStream is, int length, int fixedLen)
           
private  void checkAsciiStream(java.io.Reader r, int length, int fixedLen)
           
private  void checkAsciiStreams(java.sql.PreparedStatement psDel, java.sql.PreparedStatement psi, java.sql.PreparedStatement psq2, int cl, int vcl, int lvcl, int lob)
           
private  void checkCharacterStreams(java.sql.PreparedStatement psDel, java.sql.PreparedStatement psi, java.sql.PreparedStatement psq2, java.sql.PreparedStatement psqSQLLength, int cl, int vcl, int lvcl, int lob, int bytesPerChar)
           
private  void checkCharStream(java.io.InputStream is, int length, int fixedLen, int bytesPerChar)
           
private  void checkCharStream(java.io.Reader r, int length, int fixedLen, int bytesPerChar)
           
private  int getMaxId()
           
private  java.io.Reader getSourceStream(int length, int bytesPerChar)
           
private  void runTestSetAsciiStream(int col)
           
private  void runTestSetAsciiStreamLongValues()
           
private  void runTestSetCharacterStream(int col)
           
private  void runTestSetCharacterStreamLongValues()
           
private  void setAscii(java.sql.PreparedStatement ps, int targetCol)
           
private  void setCharacter(java.sql.PreparedStatement ps, int targetCol)
           
protected  void setUp()
           
static junit.framework.Test suite()
           
protected  void tearDown()
          Tear down this fixture, sub-classes should call super.tearDown().
 void testSetAsciiStreamIntoChar()
          Test PreparedStatement.setAsciiStream() with column of type CHAR
 void testSetAsciiStreamIntoClob()
          Test PreparedStatement.setAsciiStream() with column of type CLOB
 void testSetAsciiStreamIntoLongVarchar()
          Test PreparedStatement.setAsciiStream() with column of type LONG VARCHAR
 void testSetAsciiStreamIntoVarchar()
          Test PreparedStatement.setAsciiStream() with column of type VARCHAR
 void testSetAsciiStreamLongValues()
          Test PreparedStatement.setAsciiStream() with streams with sizes from 60characters to 32K characters
 void testSetCharacterStreamIntoChar()
          Test PreparedStatement.setCharacterStream() with column of type CHAR
 void testSetCharacterStreamIntoClob()
          Test PreparedStatement.setCharacterStream() with column of type CLOB
 void testSetCharacterStreamIntoLongVarchar()
          Test PreparedStatement.setCharacterStream() with column of type LONG VARCHAR
 void testSetCharacterStreamIntoVarchar()
          Test PreparedStatement.setCharacterStream() with column of type VARCHAR
 void testSetCharacterStreamLongValues()
          Test PreparedStatement.setCharacterStream() with streams with sizes from 60 characters to 32K characters
private  void verifyAsciiStreamResults(java.sql.ResultSet rs, int col)
           
private  void verifyCharStreamResults(java.sql.ResultSet rs, int col)
           
private  void verifyResultsUsingAsciiStream(java.sql.ResultSet rs, int col)
           
private  void verifyResultsUsingCharacterStream(java.sql.ResultSet rs, int col)
           
private  void verifyResultsUsingCharacterStreamBlock(java.sql.ResultSet rs, int col)
           
 
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, 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

ASCII_VALUE

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

LEN_ASCII_VALUE

private static final int LEN_ASCII_VALUE
See Also:
Constant Field Values

CHAR_VALUE1

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

LEN_CHAR_VALUE1

private static final int LEN_CHAR_VALUE1
See Also:
Constant Field Values

CHAR_VALUE2

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

LEN_CHAR_VALUE2

private static final int LEN_CHAR_VALUE2
See Also:
Constant Field Values
Constructor Detail

CharacterStreamsTest

public CharacterStreamsTest(java.lang.String name)
Creates a new instance of CharacterStreamsTest

Method Detail

suite

public static junit.framework.Test suite()

testSetAsciiStreamIntoChar

public void testSetAsciiStreamIntoChar()
                                throws java.lang.Exception
Test PreparedStatement.setAsciiStream() with column of type CHAR

Throws:
java.lang.Exception

testSetAsciiStreamIntoVarchar

public void testSetAsciiStreamIntoVarchar()
                                   throws java.lang.Exception
Test PreparedStatement.setAsciiStream() with column of type VARCHAR

Throws:
java.lang.Exception

testSetAsciiStreamIntoLongVarchar

public void testSetAsciiStreamIntoLongVarchar()
                                       throws java.lang.Exception
Test PreparedStatement.setAsciiStream() with column of type LONG VARCHAR

Throws:
java.lang.Exception

testSetAsciiStreamIntoClob

public void testSetAsciiStreamIntoClob()
                                throws java.lang.Exception
Test PreparedStatement.setAsciiStream() with column of type CLOB

Throws:
java.lang.Exception

testSetCharacterStreamIntoChar

public void testSetCharacterStreamIntoChar()
                                    throws java.lang.Exception
Test PreparedStatement.setCharacterStream() with column of type CHAR

Throws:
java.lang.Exception

testSetCharacterStreamIntoVarchar

public void testSetCharacterStreamIntoVarchar()
                                       throws java.lang.Exception
Test PreparedStatement.setCharacterStream() with column of type VARCHAR

Throws:
java.lang.Exception

testSetCharacterStreamIntoLongVarchar

public void testSetCharacterStreamIntoLongVarchar()
                                           throws java.lang.Exception
Test PreparedStatement.setCharacterStream() with column of type LONG VARCHAR

Throws:
java.lang.Exception

testSetCharacterStreamIntoClob

public void testSetCharacterStreamIntoClob()
                                    throws java.lang.Exception
Test PreparedStatement.setCharacterStream() with column of type CLOB

Throws:
java.lang.Exception

testSetAsciiStreamLongValues

public void testSetAsciiStreamLongValues()
                                  throws java.lang.Exception
Test PreparedStatement.setAsciiStream() with streams with sizes from 60characters to 32K characters

Throws:
java.lang.Exception

testSetCharacterStreamLongValues

public void testSetCharacterStreamLongValues()
                                      throws java.lang.Exception
Test PreparedStatement.setCharacterStream() with streams with sizes from 60 characters to 32K characters

Throws:
java.lang.Exception

runTestSetAsciiStream

private void runTestSetAsciiStream(int col)
                            throws java.lang.Exception
Throws:
java.lang.Exception

runTestSetCharacterStream

private void runTestSetCharacterStream(int col)
                                throws java.lang.Exception
Throws:
java.lang.Exception

runTestSetAsciiStreamLongValues

private void runTestSetAsciiStreamLongValues()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

runTestSetCharacterStreamLongValues

private void runTestSetCharacterStreamLongValues()
                                          throws java.lang.Exception
Throws:
java.lang.Exception

getMaxId

private int getMaxId()
              throws java.sql.SQLException
Throws:
java.sql.SQLException

setAscii

private void setAscii(java.sql.PreparedStatement ps,
                      int targetCol)
               throws java.lang.Exception
Throws:
java.lang.Exception

setCharacter

private void setCharacter(java.sql.PreparedStatement ps,
                          int targetCol)
                   throws java.lang.Exception
Throws:
java.lang.Exception

verifyAsciiStreamResults

private void verifyAsciiStreamResults(java.sql.ResultSet rs,
                                      int col)
                               throws java.lang.Exception
Throws:
java.lang.Exception

verifyCharStreamResults

private void verifyCharStreamResults(java.sql.ResultSet rs,
                                     int col)
                              throws java.lang.Exception
Throws:
java.lang.Exception

verifyResultsUsingAsciiStream

private void verifyResultsUsingAsciiStream(java.sql.ResultSet rs,
                                           int col)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

verifyResultsUsingCharacterStream

private void verifyResultsUsingCharacterStream(java.sql.ResultSet rs,
                                               int col)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

verifyResultsUsingCharacterStreamBlock

private void verifyResultsUsingCharacterStreamBlock(java.sql.ResultSet rs,
                                                    int col)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

checkAsciiStreams

private void checkAsciiStreams(java.sql.PreparedStatement psDel,
                               java.sql.PreparedStatement psi,
                               java.sql.PreparedStatement psq2,
                               int cl,
                               int vcl,
                               int lvcl,
                               int lob)
                        throws java.sql.SQLException,
                               java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

getSourceStream

private java.io.Reader getSourceStream(int length,
                                       int bytesPerChar)

checkCharacterStreams

private void checkCharacterStreams(java.sql.PreparedStatement psDel,
                                   java.sql.PreparedStatement psi,
                                   java.sql.PreparedStatement psq2,
                                   java.sql.PreparedStatement psqSQLLength,
                                   int cl,
                                   int vcl,
                                   int lvcl,
                                   int lob,
                                   int bytesPerChar)
                            throws java.sql.SQLException,
                                   java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

checkAsciiStream

private void checkAsciiStream(java.io.InputStream is,
                              int length,
                              int fixedLen)
                       throws java.io.IOException
Throws:
java.io.IOException

checkAsciiStream

private void checkAsciiStream(java.io.Reader r,
                              int length,
                              int fixedLen)
                       throws java.io.IOException
Throws:
java.io.IOException

checkCharStream

private void checkCharStream(java.io.InputStream is,
                             int length,
                             int fixedLen,
                             int bytesPerChar)
                      throws java.io.IOException
Throws:
java.io.IOException

checkCharStream

private void checkCharStream(java.io.Reader r,
                             int length,
                             int fixedLen,
                             int bytesPerChar)
                      throws java.io.IOException
Throws:
java.io.IOException

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
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.lang.Exception

Built on Wed 2009-11-25 18:43:31-0800, from revision 884373

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