org.apache.derbyTesting.functionTests.tests.jdbc4
Class CallableStatementTest

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

public class CallableStatementTest
extends BaseJDBCTestCase

Tests of the java.sql.CallableStatement JDBC40 API.


Field Summary
private  java.sql.CallableStatement cStmt
          Default callable statement used by the tests.
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
CallableStatementTest(java.lang.String name)
          Create a test with the given name.
 
Method Summary
private static junit.framework.Test baseSuite(java.lang.String name)
           
protected  void setUp()
          Create a default callable statement and connection.
static junit.framework.Test suite()
          Return suite with all tests of the class.
protected  void tearDown()
          Close default callable statement and connection.
 void testGetCharacterStreamIntOnInParameterOfInvalidType()
          Test which SQLState is thrown when getCharacterStream is called on an IN parameter of an unsupported type.
 void testGetCharacterStreamIntOnInParameterOfValidType()
          Test which SQLState is thrown when getCharacterStream is called on an IN parameter of a supported type.
 void testGetCharacterStreamIntOnInvalidTypeDOUBLE()
           
 void testGetCharacterStreamIntOnVARBINARYWithNull()
          Read a SQL NULL value from a VARBINARY column through a reader.
 void testGetCharacterStreamIntOnVARCHARWithNull()
          Read a SQL NULL value from a VARCHAR column through a reader.
 void testGetCharacterStreamIntVARBINARYDirect()
          Test basic use of getCharacterStream on binary data.
 void testGetCharacterStreamIntVARBINARYFromDb()
          Fetch a string stored as bytes from the database through a reader, then recreate the string.
 void testGetCharacterStreamIntVARCHAR()
          Test basic use of getCharacterStream on character data.
 void testGetCharacterStreamStringNotImplemented()
           
 void testGetDoubleIntOnInParameter()
           
 void testGetNCharacterStreamIntNotImplemented()
           
 void testGetNCharacterStreamStringNotImplemented()
           
 void testGetNClobIntNotImplemented()
           
 void testGetNClobStringNotImplemented()
           
 void testGetNStringIntNotImplemented()
           
 void testGetNStringStringNotImplemented()
           
 void testGetSQLXMLIntNotImplemented()
           
 void testGetSQLXMLStringNotImplemented()
           
 void testIsNotWrapperForResultSet()
           
 void testIsWrapperForCallableStatement()
           
 void testIsWrapperForPreparedStatement()
           
 void testIsWrapperForStatement()
           
private  void testIsWrapperForXXXStatement(java.lang.Class klass)
          Helper method for testIsWrapperFor*Statement test cases.
 void testNamedParametersAreNotSupported()
           
 void testSetAsciiStream()
          Tests the setAsciiStream method that accepts length as a long parameter in the Callable Statement interface
 void testSetBinaryStream()
          Tests the setBinaryStream method that accepts length as a long parameter in the Callable Statement interface
 void testSetBlobNotImplemented()
           
 void testSetCharacterStream()
          Tests the setCharacterStream method that accepts length as a long parameter in the Callable Statement interface
 void testSetClobNotImplemented()
           
 void testSetNCharacterStreamNotImplemented()
           
 void testSetNClobNClobNotImplemented()
           
 void testSetNClobReaderNotImplemented()
           
 void testSetNStringNotImplemented()
           
 void testSetSQLXMLNotImplemented()
           
 void testUnwrapCallableStatement()
           
 void testUnwrapPreparedStatement()
           
 void testUnwrapResultSet()
           
 void testUnwrapStatement()
           
 
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

cStmt

private java.sql.CallableStatement cStmt
Default callable statement used by the tests.

Constructor Detail

CallableStatementTest

public CallableStatementTest(java.lang.String name)
Create a test with the given name.

Parameters:
name - name of the test.
Method Detail

setUp

protected void setUp()
              throws java.sql.SQLException
Create a default callable statement and connection.

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.sql.SQLException - if creation of connection or callable statement fail.

tearDown

protected void tearDown()
                 throws java.lang.Exception
Close default callable statement and connection.

Overrides:
tearDown in class BaseJDBCTestCase
Throws:
java.sql.SQLException - if closing of the connection or the callable statement fail.
java.lang.Exception

testNamedParametersAreNotSupported

public void testNamedParametersAreNotSupported()
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetDoubleIntOnInParameter

public void testGetDoubleIntOnInParameter()
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetNClobIntNotImplemented

public void testGetNClobIntNotImplemented()
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetNClobStringNotImplemented

public void testGetNClobStringNotImplemented()
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetNStringIntNotImplemented

public void testGetNStringIntNotImplemented()
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetNStringStringNotImplemented

public void testGetNStringStringNotImplemented()
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetCharacterStreamIntOnInvalidTypeDOUBLE

public void testGetCharacterStreamIntOnInvalidTypeDOUBLE()
                                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetCharacterStreamIntOnInParameterOfInvalidType

public void testGetCharacterStreamIntOnInParameterOfInvalidType()
                                                         throws java.sql.SQLException
Test which SQLState is thrown when getCharacterStream is called on an IN parameter of an unsupported type.

Throws:
java.sql.SQLException

testGetCharacterStreamIntOnInParameterOfValidType

public void testGetCharacterStreamIntOnInParameterOfValidType()
                                                       throws java.sql.SQLException
Test which SQLState is thrown when getCharacterStream is called on an IN parameter of a supported type.

Throws:
java.sql.SQLException

testGetCharacterStreamIntVARCHAR

public void testGetCharacterStreamIntVARCHAR()
                                      throws java.io.IOException,
                                             java.sql.SQLException
Test basic use of getCharacterStream on character data. Create a CallableStatement that takes an integer as input and returns the number as a string. The string is read as a stream, and the integer is recreated from it and compared to the integer passed in.

Throws:
java.io.IOException
java.sql.SQLException

testGetCharacterStreamIntVARBINARYDirect

public void testGetCharacterStreamIntVARBINARYDirect()
                                              throws java.io.IOException,
                                                     java.sql.SQLException
Test basic use of getCharacterStream on binary data. Create a CallableStatement that takes a string as input and returns a byte representation, which is then read through a stream. The string is recreated and compared to the one passed in. Note that strings must be represented in UTF-16BE for this to work.

Throws:
java.io.IOException
java.sql.SQLException

testGetCharacterStreamIntVARBINARYFromDb

public void testGetCharacterStreamIntVARBINARYFromDb()
                                              throws java.io.IOException,
                                                     java.sql.SQLException
Fetch a string stored as bytes from the database through a reader, then recreate the string.

Throws:
java.io.IOException
java.sql.SQLException

testGetCharacterStreamIntOnVARBINARYWithNull

public void testGetCharacterStreamIntOnVARBINARYWithNull()
                                                  throws java.sql.SQLException
Read a SQL NULL value from a VARBINARY column through a reader.

Throws:
java.sql.SQLException

testGetCharacterStreamIntOnVARCHARWithNull

public void testGetCharacterStreamIntOnVARCHARWithNull()
                                                throws java.sql.SQLException
Read a SQL NULL value from a VARCHAR column through a reader.

Throws:
java.sql.SQLException

testGetCharacterStreamStringNotImplemented

public void testGetCharacterStreamStringNotImplemented()
                                                throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetNCharacterStreamIntNotImplemented

public void testGetNCharacterStreamIntNotImplemented()
                                              throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetNCharacterStreamStringNotImplemented

public void testGetNCharacterStreamStringNotImplemented()
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

testSetBlobNotImplemented

public void testSetBlobNotImplemented()
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

testSetClobNotImplemented

public void testSetClobNotImplemented()
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

testSetNCharacterStreamNotImplemented

public void testSetNCharacterStreamNotImplemented()
                                           throws java.sql.SQLException
Throws:
java.sql.SQLException

testSetNClobNClobNotImplemented

public void testSetNClobNClobNotImplemented()
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

testSetNClobReaderNotImplemented

public void testSetNClobReaderNotImplemented()
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

testSetNStringNotImplemented

public void testSetNStringNotImplemented()
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetSQLXMLIntNotImplemented

public void testGetSQLXMLIntNotImplemented()
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

testGetSQLXMLStringNotImplemented

public void testGetSQLXMLStringNotImplemented()
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

testSetSQLXMLNotImplemented

public void testSetSQLXMLNotImplemented()
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

testIsWrapperForXXXStatement

private void testIsWrapperForXXXStatement(java.lang.Class klass)
                                   throws java.sql.SQLException
Helper method for testIsWrapperFor*Statement test cases.

Throws:
java.sql.SQLException

testIsWrapperForStatement

public void testIsWrapperForStatement()
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

testIsWrapperForPreparedStatement

public void testIsWrapperForPreparedStatement()
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

testIsWrapperForCallableStatement

public void testIsWrapperForCallableStatement()
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

testIsNotWrapperForResultSet

public void testIsNotWrapperForResultSet()
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

testUnwrapStatement

public void testUnwrapStatement()
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

testUnwrapPreparedStatement

public void testUnwrapPreparedStatement()
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

testUnwrapCallableStatement

public void testUnwrapCallableStatement()
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

testUnwrapResultSet

public void testUnwrapResultSet()

testSetCharacterStream

public void testSetCharacterStream()
                            throws java.sql.SQLException
Tests the setCharacterStream method that accepts length as a long parameter in the Callable Statement interface

Throws:
java.sql.SQLException - Upon any error that occurs while calling this method

testSetAsciiStream

public void testSetAsciiStream()
                        throws java.sql.SQLException
Tests the setAsciiStream method that accepts length as a long parameter in the Callable Statement interface

Throws:
java.sql.SQLException - Upon any error that occurs while calling this method

testSetBinaryStream

public void testSetBinaryStream()
                         throws java.sql.SQLException
Tests the setBinaryStream method that accepts length as a long parameter in the Callable Statement interface

Throws:
java.sql.SQLException - Upon any error that occurs while calling this method

suite

public static junit.framework.Test suite()
Return suite with all tests of the class.


baseSuite

private static junit.framework.Test baseSuite(java.lang.String name)

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.