org.apache.derbyTesting.functionTests.tests.junitTests.compatibility
Class JDBCDriverTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.derbyTesting.functionTests.util.DerbyJUnitTest
              extended by org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite
                  extended by org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.JDBCDriverTest
All Implemented Interfaces:
junit.framework.Test

public class JDBCDriverTest
extends CompatibilitySuite


Nested Class Summary
static class JDBCDriverTest.MyBlob
           A crude Blob implementation for datatype testing.
static class JDBCDriverTest.MyClob
           A crude Clob implementation for datatype testing.
static class JDBCDriverTest.T_CN
           This helper class captures TypeCoercion logic.
static class JDBCDriverTest.TypeDescriptor
           This helper class describes a legal datatype and the version of Derby and db2jcc where the datatype first appears.
 
Nested classes/interfaces inherited from class org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite
CompatibilitySuite.Creator, CompatibilitySuite.Version
 
Field Summary
private static boolean _
           
private static java.util.HashMap _coercionIndex
           
private static java.util.HashMap _types
           
private static JDBCDriverTest.TypeDescriptor[] ALL_TYPES
           
private static java.lang.String ALL_TYPES_TABLE
           
private static JDBCDriverTest.T_CN[] COERCIONS
           
private static java.lang.String KEY_COLUMN
           
private static java.lang.Object[] ROW_1
           
private static byte[] SAMPLE_BYTES
           
private static java.lang.String SAMPLE_STRING
           
private static boolean Y
           
 
Fields inherited from class org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite
DRB_10_0, DRB_10_1, DRB_10_2, IBM_2_4, SERVER_VERSION_FUNCTION, VM_1_3, VM_1_4, VM_1_5
 
Fields inherited from class org.apache.derbyTesting.functionTests.util.DerbyJUnitTest
DATABASE_URL, DEBUG_FLAG, DEFAULT_DATABASE_NAME, DEFAULT_PASSWORD, DEFAULT_USER_NAME, DRIVER_NAME, FAILURE_EXIT, FRAMEWORK_NAME, JDBC_BOOLEAN, LEGAL_CLIENTS, SUCCESS_EXIT
 
Constructor Summary
JDBCDriverTest()
           
 
Method Summary
private  void addColumn(java.lang.StringBuffer buffer, int columnNumber, java.lang.String text)
           
private  void beginColumnList(java.lang.StringBuffer buffer)
           
private  void buildCoercionMap()
           
private  void buildTypeMap()
           
private  void checkCoercions(java.sql.ResultSet rs, java.lang.String columnName, JDBCDriverTest.TypeDescriptor type, java.util.List casts)
           
private  void checkDBMetadata(java.sql.Connection conn, java.lang.String tableName)
           
private  void checkParameter(java.sql.ResultSet rs, int param, java.lang.Object value)
           
private  void checkProcMetadata(java.sql.Connection conn, java.lang.String procName, JDBCDriverTest.TypeDescriptor[] signature)
           
private  void checkRow(java.sql.ResultSet rs, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[] row, java.util.List casts)
           
private  void checkRows(java.sql.ResultSet rs, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[][] rows, java.util.List casts)
           
private  void checkRSMD(java.sql.ResultSet rs)
           
private  boolean clientSupports(JDBCDriverTest.TypeDescriptor type)
           
private  void createSchema(java.sql.Connection conn)
           
private  void createTable(java.sql.Connection conn, java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types)
           
private  void datatypesTest(java.sql.Connection conn)
           
private  int ddmdTypeKludge(int originalJDbcType)
           
private  java.lang.String doubleQuote(java.lang.String text)
           
private  void dropSchema(java.sql.Connection conn)
           
private  void endColumnList(java.lang.StringBuffer buffer)
           
private  int getCoercionIndex(int jdbcType)
           
private  java.lang.Object getColumn(java.sql.ResultSet rs, java.lang.String columnName, JDBCDriverTest.TypeDescriptor type)
           
private  java.lang.Object getOutArg(java.sql.CallableStatement cs, int arg, JDBCDriverTest.TypeDescriptor type)
           
private  JDBCDriverTest.TypeDescriptor getType(int jdbcType)
           
private  JDBCDriverTest.TypeDescriptor getType(JDBCDriverTest.TypeDescriptor[] types, java.lang.String typeName)
           
private  JDBCDriverTest.TypeDescriptor getType(java.lang.String typeName)
           
private  java.sql.PreparedStatement makeInsert(java.sql.Connection conn, java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types)
           
private  java.lang.Object[] makeNullRow(int rowLength)
           
private  java.lang.Object[][] makeRows(java.lang.Object[][] rows)
           
private  void putCoercionIndex(int index)
           
private  void putType(JDBCDriverTest.TypeDescriptor type)
           
private  void readTable(java.sql.Connection conn, java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[][] rows, java.util.List casts)
           
private  java.sql.PreparedStatement readTableQuery(java.sql.Connection conn, java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types)
           
private  int rsmdTypeKludge(int originalJDbcType)
           
private  void setParameter(java.sql.PreparedStatement ps, int param, JDBCDriverTest.TypeDescriptor type, java.lang.Object value)
           
private  void setRow(java.sql.PreparedStatement ps, int keyValue, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[] row)
           
private  void stuffTable(java.sql.Connection conn, java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[][] rows)
           
 void testJDBCDriver()
           Main test of jdbc drivers.
 void testSanity()
           Sanity check the integrity of this test suite.
 
Methods inherited from class org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite
findClient, findServer, getClientVMVersion, getDriverVersion, getServerVersion, getServerVMVersion, getVMVersion, main, parseArgs, parseServerVMVersion, parseVMLevel, suite
 
Methods inherited from class org.apache.derbyTesting.functionTests.util.DerbyJUnitTest
alarm, assertColumnEquals, assertColumnEquals, assertRow, assertScalar, close, close, close, compareBytes, compareDates, compareObjects, createDB, dropFunction, dropProcedure, dropSchemaObject, dropTable, execute, executeDDL, exit, faultInDriver, findClientFromProperties, getClientSettings, getColumn, getColumn, getConnection, getConnection, getOutArg, initializeForOldHarness, parseDebug, prepare, prepareCall, println, printStackTrace, runUnderOldHarness, setClient, setDatabaseName, setDebug, setParameter, setParameter, singleQuote, truncateTable, usingDB2Client, usingDerbyClient, usingEmbeddedClient
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, 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

ALL_TYPES_TABLE

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

KEY_COLUMN

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

SAMPLE_BYTES

private static final byte[] SAMPLE_BYTES

SAMPLE_STRING

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

Y

private static final boolean Y
See Also:
Constant Field Values

_

private static final boolean _
See Also:
Constant Field Values

ALL_TYPES

private static final JDBCDriverTest.TypeDescriptor[] ALL_TYPES

ROW_1

private static final java.lang.Object[] ROW_1

COERCIONS

private static final JDBCDriverTest.T_CN[] COERCIONS

_types

private static java.util.HashMap _types

_coercionIndex

private static java.util.HashMap _coercionIndex
Constructor Detail

JDBCDriverTest

public JDBCDriverTest()
Method Detail

testSanity

public void testSanity()

Sanity check the integrity of this test suite.


testJDBCDriver

public void testJDBCDriver()
                    throws java.lang.Exception

Main test of jdbc drivers.

Throws:
java.lang.Exception

datatypesTest

private void datatypesTest(java.sql.Connection conn)
                    throws java.lang.Exception
Throws:
java.lang.Exception

checkDBMetadata

private void checkDBMetadata(java.sql.Connection conn,
                             java.lang.String tableName)
                      throws java.lang.Exception
Throws:
java.lang.Exception

checkProcMetadata

private void checkProcMetadata(java.sql.Connection conn,
                               java.lang.String procName,
                               JDBCDriverTest.TypeDescriptor[] signature)
                        throws java.lang.Exception
Throws:
java.lang.Exception

stuffTable

private void stuffTable(java.sql.Connection conn,
                        java.lang.String tableName,
                        JDBCDriverTest.TypeDescriptor[] types,
                        java.lang.Object[][] rows)
                 throws java.lang.Exception
Throws:
java.lang.Exception

makeInsert

private java.sql.PreparedStatement makeInsert(java.sql.Connection conn,
                                              java.lang.String tableName,
                                              JDBCDriverTest.TypeDescriptor[] types)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

readTable

private void readTable(java.sql.Connection conn,
                       java.lang.String tableName,
                       JDBCDriverTest.TypeDescriptor[] types,
                       java.lang.Object[][] rows,
                       java.util.List casts)
                throws java.lang.Exception
Throws:
java.lang.Exception

readTableQuery

private java.sql.PreparedStatement readTableQuery(java.sql.Connection conn,
                                                  java.lang.String tableName,
                                                  JDBCDriverTest.TypeDescriptor[] types)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

checkRSMD

private void checkRSMD(java.sql.ResultSet rs)
                throws java.lang.Exception
Throws:
java.lang.Exception

checkRows

private void checkRows(java.sql.ResultSet rs,
                       JDBCDriverTest.TypeDescriptor[] types,
                       java.lang.Object[][] rows,
                       java.util.List casts)
                throws java.lang.Exception
Throws:
java.lang.Exception

checkRow

private void checkRow(java.sql.ResultSet rs,
                      JDBCDriverTest.TypeDescriptor[] types,
                      java.lang.Object[] row,
                      java.util.List casts)
               throws java.lang.Exception
Throws:
java.lang.Exception

checkCoercions

private void checkCoercions(java.sql.ResultSet rs,
                            java.lang.String columnName,
                            JDBCDriverTest.TypeDescriptor type,
                            java.util.List casts)
                     throws java.lang.Exception
Throws:
java.lang.Exception

rsmdTypeKludge

private int rsmdTypeKludge(int originalJDbcType)

ddmdTypeKludge

private int ddmdTypeKludge(int originalJDbcType)

setRow

private void setRow(java.sql.PreparedStatement ps,
                    int keyValue,
                    JDBCDriverTest.TypeDescriptor[] types,
                    java.lang.Object[] row)
             throws java.lang.Exception
Throws:
java.lang.Exception

makeRows

private java.lang.Object[][] makeRows(java.lang.Object[][] rows)

makeNullRow

private java.lang.Object[] makeNullRow(int rowLength)

buildTypeMap

private void buildTypeMap()

putType

private void putType(JDBCDriverTest.TypeDescriptor type)

getType

private JDBCDriverTest.TypeDescriptor getType(java.lang.String typeName)

getType

private JDBCDriverTest.TypeDescriptor getType(int jdbcType)

getType

private JDBCDriverTest.TypeDescriptor getType(JDBCDriverTest.TypeDescriptor[] types,
                                              java.lang.String typeName)

buildCoercionMap

private void buildCoercionMap()

putCoercionIndex

private void putCoercionIndex(int index)

getCoercionIndex

private int getCoercionIndex(int jdbcType)

createSchema

private void createSchema(java.sql.Connection conn)
                   throws java.lang.Exception
Throws:
java.lang.Exception

createTable

private void createTable(java.sql.Connection conn,
                         java.lang.String tableName,
                         JDBCDriverTest.TypeDescriptor[] types)
                  throws java.lang.Exception
Throws:
java.lang.Exception

beginColumnList

private void beginColumnList(java.lang.StringBuffer buffer)

endColumnList

private void endColumnList(java.lang.StringBuffer buffer)

addColumn

private void addColumn(java.lang.StringBuffer buffer,
                       int columnNumber,
                       java.lang.String text)

dropSchema

private void dropSchema(java.sql.Connection conn)

setParameter

private void setParameter(java.sql.PreparedStatement ps,
                          int param,
                          JDBCDriverTest.TypeDescriptor type,
                          java.lang.Object value)
                   throws java.lang.Exception
Throws:
java.lang.Exception

checkParameter

private void checkParameter(java.sql.ResultSet rs,
                            int param,
                            java.lang.Object value)
                     throws java.lang.Exception
Throws:
java.lang.Exception

clientSupports

private boolean clientSupports(JDBCDriverTest.TypeDescriptor type)

getColumn

private java.lang.Object getColumn(java.sql.ResultSet rs,
                                   java.lang.String columnName,
                                   JDBCDriverTest.TypeDescriptor type)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getOutArg

private java.lang.Object getOutArg(java.sql.CallableStatement cs,
                                   int arg,
                                   JDBCDriverTest.TypeDescriptor type)
                            throws java.lang.Exception
Throws:
java.lang.Exception

doubleQuote

private java.lang.String doubleQuote(java.lang.String text)

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.