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

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

public class ParameterMetaDataJdbc30Test
extends BaseJDBCTestCase

Test the ParameterMetaData class in JDBC 30. This test converts the old jdbcapi/parameterMetaDataJdbc30.java test to JUnit.


Field Summary
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
ParameterMetaDataJdbc30Test(java.lang.String name)
          Create a test with the given name.
 
Method Summary
private static junit.framework.Test baseSuite(java.lang.String name)
           
static void dummy_numeric_Proc(java.math.BigDecimal[] max_param, java.math.BigDecimal[] min_param)
          A really simple method to test callable statement.
static void dummyDecimal(java.math.BigDecimal in_param, java.math.BigDecimal in_param2, java.math.BigDecimal[] in_param3, java.math.BigDecimal[] in_param4)
          Java method for procedure PMDD which tests ParameterMetaData for Java procedures with DECIMAL parameters.
static void dummyint(int in_param, int in_param2, int[] in_param3, int[] in_param4)
          A simple method to test callable statement.
static void dummyint2(int in_param, int in_param2, int[] in_param3, int[] in_param4)
          This is the Java method for procedure dummyint.
static void dummyString(java.lang.String in_param, java.lang.String in_param2, java.lang.String[] in_param3, java.lang.String[] in_param4)
          Java method for procedure PMDC which tests ParameterMetaData for Java procedures with CHAR parameters.
(package private) static void dumpParameterMetaDataNegative(java.sql.ParameterMetaData paramMetaData)
          ParameterMetaData Negative Test
(package private) static java.lang.String parameterIsNullableInStringForm(int nullabilityValue)
          print the parameter isNullable value in human readable form
(package private) static java.lang.String parameterModeInStringForm(int mode)
          print the parameter mode in human readable form
static junit.framework.Test suite()
          Create suite containing client and embedded tests and to run all tests in this class
 void testCallableStatement()
          Testing a callable statement by calling a SQL procedure with IN parameters, OUT parameters and IN_OUT parameters.
 void testCallableStatementReturnedScale()
          test: the scale returned should be the one set by registerOutParameter
 void testExecuteStatementUsing()
          test execute statements that no parameters would be returned if prepareStatement("execute statement systab using values('SYS%','8000001%')");
 void testLikeEscaleStatement()
          DERBY-44 added support for SELECT ...
 void testMetatdataAfterProcRecompile()
          test behaviour of meta data and out params after re-compile
(package private) static void testParameterMetaData(java.sql.ParameterMetaData paramMetaData, java.lang.String[][] paramMetaDataArray)
          tests parameterMetaData and reports error if the ParameterMetaData results does not match the expected results.
 void testParameterMetadataWithCHARParameters()
          test ParameterMetaData for Java procedures with CHAR parameters
 void testParameterMetadataWithDECIMALParameters()
          test ParameterMetaData for Java procedures with DECIMAL parameters
 void testParameterMetadataWithINTParameters()
          test ParameterMetaData for Java procedures with INTEGER parameters
 void testParameterMetadataWithLITERALParameters()
          test ParameterMetaData for Java procedures with some literal parameters
 void testPreparedStatement()
          Testing a prepared statement.
 void testSelectStatementUsingBoolean()
          testing SELECT statements for BOOLEANs (1 for true, 0 for false)
 void testSelectStatementUsingNoParameter()
          test: no parameter for the statement and then do getParameterMetaData()
 
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, tearDown, 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
 

Constructor Detail

ParameterMetaDataJdbc30Test

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

Parameters:
name - name of the test.
Method Detail

suite

public static junit.framework.Test suite()
Create suite containing client and embedded tests and to run all tests in this class


baseSuite

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

testCallableStatement

public void testCallableStatement()
                           throws java.sql.SQLException
Testing a callable statement by calling a SQL procedure with IN parameters, OUT parameters and IN_OUT parameters.

Throws:
java.sql.SQLException - if error occurs

testPreparedStatement

public void testPreparedStatement()
                           throws java.sql.SQLException
Testing a prepared statement.

Throws:
java.sql.SQLException - if database access errors or other errors occur

testLikeEscaleStatement

public void testLikeEscaleStatement()
                             throws java.sql.SQLException
DERBY-44 added support for SELECT ... WHERE column LIKE ? ESCAPE ? This test case tests a) that such a statement compiles, and b) that we get the correct error message if the escape sequence is an empty string (at one point this would lead to a StringIndexOutOfBoundsException)`

Throws:
java.sql.SQLException - if error occurs

testExecuteStatementUsing

public void testExecuteStatementUsing()
                               throws java.sql.SQLException
test execute statements that no parameters would be returned if prepareStatement("execute statement systab using values('SYS%','8000001%')");

Throws:
java.sql.SQLException - if error occurs

testSelectStatementUsingBoolean

public void testSelectStatementUsingBoolean()
                                     throws java.sql.SQLException
testing SELECT statements for BOOLEANs (1 for true, 0 for false)

Throws:
java.sql.SQLException - if error occurs

testSelectStatementUsingNoParameter

public void testSelectStatementUsingNoParameter()
                                         throws java.sql.SQLException
test: no parameter for the statement and then do getParameterMetaData()

Throws:
java.sql.SQLException - if error occurs

testCallableStatementReturnedScale

public void testCallableStatementReturnedScale()
                                        throws java.sql.SQLException
test: the scale returned should be the one set by registerOutParameter

Throws:
java.sql.SQLException

testMetatdataAfterProcRecompile

public void testMetatdataAfterProcRecompile()
                                     throws java.sql.SQLException
test behaviour of meta data and out params after re-compile

Throws:
java.sql.SQLException - if error occurs

testParameterMetadataWithINTParameters

public void testParameterMetadataWithINTParameters()
                                            throws java.sql.SQLException
test ParameterMetaData for Java procedures with INTEGER parameters

Throws:
java.sql.SQLException - if error occurs

testParameterMetadataWithCHARParameters

public void testParameterMetadataWithCHARParameters()
                                             throws java.sql.SQLException
test ParameterMetaData for Java procedures with CHAR parameters

Throws:
java.sql.SQLException - if error occurs

testParameterMetadataWithDECIMALParameters

public void testParameterMetadataWithDECIMALParameters()
                                                throws java.sql.SQLException
test ParameterMetaData for Java procedures with DECIMAL parameters

Throws:
java.sql.SQLException - if error occurs

testParameterMetadataWithLITERALParameters

public void testParameterMetadataWithLITERALParameters()
                                                throws java.sql.SQLException
test ParameterMetaData for Java procedures with some literal parameters

Throws:
java.sql.SQLException - if error occurs

parameterIsNullableInStringForm

static java.lang.String parameterIsNullableInStringForm(int nullabilityValue)
print the parameter isNullable value in human readable form

Parameters:
nullabilityValue -

parameterModeInStringForm

static java.lang.String parameterModeInStringForm(int mode)
print the parameter mode in human readable form

Parameters:
mode - identifies parameter's mode (IN, OUT, or IN_OUT)
Returns:
the parameter mode in readable form

testParameterMetaData

static void testParameterMetaData(java.sql.ParameterMetaData paramMetaData,
                                  java.lang.String[][] paramMetaDataArray)
                           throws java.sql.SQLException
tests parameterMetaData and reports error if the ParameterMetaData results does not match the expected results.

Parameters:
paramMetaData - ParameterMetadata object
paramMetaDataArray - 2 dimensional array containing expected test results.
Throws:
java.sql.SQLException - if any error occurs

dumpParameterMetaDataNegative

static void dumpParameterMetaDataNegative(java.sql.ParameterMetaData paramMetaData)
                                   throws java.sql.SQLException
ParameterMetaData Negative Test

Parameters:
paramMetaData - ParameterMetadata object
Throws:
java.sql.SQLException - if any error occurs

dummyint

public static void dummyint(int in_param,
                            int in_param2,
                            int[] in_param3,
                            int[] in_param4)
                     throws java.sql.SQLException
A simple method to test callable statement. This is the Java method for procedure dummyint.

Parameters:
in_param -
in_param2 -
in_param3 -
in_param4 -
Throws:
java.sql.SQLException

dummyint2

public static void dummyint2(int in_param,
                             int in_param2,
                             int[] in_param3,
                             int[] in_param4)
                      throws java.sql.SQLException
This is the Java method for procedure dummyint.

Parameters:
in_param -
in_param2 -
in_param3 -
in_param4 -
Throws:
java.sql.SQLException

dummy_numeric_Proc

public static void dummy_numeric_Proc(java.math.BigDecimal[] max_param,
                                      java.math.BigDecimal[] min_param)
                               throws java.sql.SQLException
A really simple method to test callable statement. This is the Java method for procedure dummy_numeric_Proc.

Parameters:
max_param -
min_param -
Throws:
java.sql.SQLException

dummyString

public static void dummyString(java.lang.String in_param,
                               java.lang.String in_param2,
                               java.lang.String[] in_param3,
                               java.lang.String[] in_param4)
Java method for procedure PMDC which tests ParameterMetaData for Java procedures with CHAR parameters.

Parameters:
in_param -
in_param2 -
in_param3 -
in_param4 -

dummyDecimal

public static void dummyDecimal(java.math.BigDecimal in_param,
                                java.math.BigDecimal in_param2,
                                java.math.BigDecimal[] in_param3,
                                java.math.BigDecimal[] in_param4)
Java method for procedure PMDD which tests ParameterMetaData for Java procedures with DECIMAL parameters.

Parameters:
in_param -
in_param2 -
in_param3 -
in_param4 -

Built on Thu 2009-11-26 18:42:53-0800, from revision 884739

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