public class JDBCDriverTest extends AbstractCompatibilityTest
Modifier and Type | Class and Description |
---|---|
static class |
JDBCDriverTest.T_CN
Helper class capturing TypeCoercion logic.
|
static class |
JDBCDriverTest.TypeDescriptor
Description of a legal datatype and the version of Derby
where the datatype first appears.
|
Modifier and Type | Field and Description |
---|---|
private static java.util.HashMap<java.lang.Integer,java.lang.Integer> |
_coercionIndex |
private static java.util.HashMap<java.lang.String,JDBCDriverTest.TypeDescriptor> |
_types |
private static JDBCDriverTest.TypeDescriptor[] |
ALL_TYPES |
private static java.lang.String |
ALL_TYPES_TABLE |
private static JDBCDriverTest.T_CN[] |
COERCIONS |
private static java.util.regex.Pattern |
DERBY_5449_PATTERN
A pattern that matches the value returned by
DatabaseMetaData.getDriverVersion() for the versions that suffer
from DERBY-5449.
|
private static java.lang.String |
KEY_COLUMN |
private static boolean |
n |
private static java.lang.Object[] |
ROW_1 |
private static byte[] |
SAMPLE_BYTES |
private static java.lang.String |
SAMPLE_STRING |
private static boolean |
Y |
SERVER_VERSION_FUNCTION
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
JDBCDriverTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private static void |
addColumn(java.lang.StringBuilder builder,
int columnNumber,
java.lang.String text) |
private static void |
beginColumnList(java.lang.StringBuilder builder) |
private void |
buildCoercionMap() |
private void |
buildTypeMap() |
private void |
checkCoercions(java.sql.PreparedStatement ps,
JDBCDriverTest.TypeDescriptor type)
Verify all legal JDBC coercions of a data value.
|
private void |
checkDBMetadata(java.lang.String tableName) |
private void |
checkPlainGet(java.sql.PreparedStatement ps,
int columnIndex,
JDBCDriverTest.TypeDescriptor type,
java.lang.Object[][] rows)
Checks that fetching the specified column as the declared data type
works, i.e doing rs.getString() on a VARCHAR column or rs.getInt() on
a SMALLINT column.
|
private void |
checkPMD(java.lang.String query,
java.lang.String expectedClassName,
int expectedJDBCType,
java.lang.String expectedSQLTypeName,
int expectedPrecision,
int expectedScale)
Check the ParameterMetaData for a statement whose first parameter is a UDT.
|
private void |
checkRows(java.sql.PreparedStatement ps,
JDBCDriverTest.TypeDescriptor[] types,
java.lang.Object[][] rows)
Verify that we select the values we originally inserted into a table,
and that the valid coercions succeeds.
|
private void |
checkRSMD(java.sql.ResultSet rs) |
private void |
checkRSMD(java.lang.String query,
java.lang.String expectedClassName,
int expectedDisplaySize,
int expectedJDBCType,
java.lang.String expectedSQLTypeName,
int expectedPrecision,
int expectedScale)
Check the ResultSetMetaData for a query whose first column is a UDT.
|
private boolean |
clientSupports(JDBCDriverTest.TypeDescriptor type) |
private static void |
create_derby_2602_objects(java.sql.Connection con) |
private static void |
createTable(java.sql.Connection con,
java.lang.String tableName,
JDBCDriverTest.TypeDescriptor[] types) |
private static void |
createUDTObjects(java.sql.Connection con) |
private void |
datatypesTest() |
private static java.lang.String |
doubleQuote(java.lang.String text) |
private void |
drop_derby_2602_objects() |
private void |
dropSchema() |
private void |
dropUDTObjects() |
private static void |
endColumnList(java.lang.StringBuilder builder) |
private int |
getCoercionIndex(int jdbcType) |
private java.lang.Object |
getColumn(java.sql.ResultSet rs,
java.lang.String columnName,
JDBCDriverTest.TypeDescriptor type) |
private JDBCDriverTest.TypeDescriptor |
getType(java.lang.String typeName) |
private java.sql.PreparedStatement |
makeInsert(java.lang.String tableName,
JDBCDriverTest.TypeDescriptor[] types) |
private java.lang.Object[] |
makeNullRow(int rowLength) |
private void |
putCoercionIndex(int index) |
private void |
putType(JDBCDriverTest.TypeDescriptor type) |
private void |
readTable(java.lang.String tableName,
JDBCDriverTest.TypeDescriptor[] types,
java.lang.Object[][] rows) |
private java.sql.PreparedStatement |
readTableQuery(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.lang.String tableName,
JDBCDriverTest.TypeDescriptor[] types,
java.lang.Object[][] rows) |
static junit.framework.Test |
suite()
Returns a suite with all the available JDBC client driver compatibility
tests.
|
void |
testDataTypesCompatibility()
Tests compatibility for the available data types.
|
void |
testDerby2602()
Verifies that timestamps retain their nanosecond-precision
across the network from release 10.6 onward.
|
void |
testDerby4613(java.sql.Connection conn)
Verify that embedded and network clients handle BOOLEAN values the
same way from release 10.7 onward.
|
void |
testDerby4888()
Test case for DERBY-4888.
|
void |
testDerby5449()
Test case for DERBY-5449.
|
void |
testSanity()
Sanity check the integrity of this test suite.
|
void |
testUDT()
Verify the metadata for user defined types.
|
void |
testVerifyVersions() |
private void |
vet_isindex_column(boolean correctBehavior,
java.lang.String conglomerateName,
boolean expectedValue)
Vet boolean results.
|
compareBytes, compareDates, compareObjects, dropFunction, dropProcedure, dropSchemaObject, dropUDT, getClientVMVersion, getColumn, getDriverVersion, getServerVersion, getServerVersion, getServerVMVersion, getVMVersion, serverSupportsUDTs, serverSupportsUDTs, setParameter
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, toString
private static final java.lang.String ALL_TYPES_TABLE
private static final java.lang.String KEY_COLUMN
private static final byte[] SAMPLE_BYTES
private static final java.lang.String SAMPLE_STRING
private static final boolean Y
private static final boolean n
private static final JDBCDriverTest.TypeDescriptor[] ALL_TYPES
private static final java.lang.Object[] ROW_1
private static final JDBCDriverTest.T_CN[] COERCIONS
private static java.util.HashMap<java.lang.String,JDBCDriverTest.TypeDescriptor> _types
private static java.util.HashMap<java.lang.Integer,java.lang.Integer> _coercionIndex
private static java.util.regex.Pattern DERBY_5449_PATTERN
public void testSanity()
public void testVerifyVersions() throws java.sql.SQLException
java.sql.SQLException
public void testDataTypesCompatibility() throws java.sql.SQLException
java.sql.SQLException
public void testDerby4613(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
private void vet_isindex_column(boolean correctBehavior, java.lang.String conglomerateName, boolean expectedValue) throws java.lang.Exception
java.lang.Exception
public void testDerby2602() throws java.sql.SQLException
java.sql.SQLException
public void testDerby4888() throws java.sql.SQLException
java.sql.SQLException
public void testDerby5449() throws java.sql.SQLException
java.sql.SQLException
public void testUDT() throws java.lang.Exception
java.lang.Exception
private void checkRSMD(java.lang.String query, java.lang.String expectedClassName, int expectedDisplaySize, int expectedJDBCType, java.lang.String expectedSQLTypeName, int expectedPrecision, int expectedScale) throws java.sql.SQLException
java.sql.SQLException
private void checkPMD(java.lang.String query, java.lang.String expectedClassName, int expectedJDBCType, java.lang.String expectedSQLTypeName, int expectedPrecision, int expectedScale) throws java.sql.SQLException
java.sql.SQLException
private void datatypesTest() throws java.sql.SQLException
java.sql.SQLException
private void checkDBMetadata(java.lang.String tableName) throws java.sql.SQLException
java.sql.SQLException
private void stuffTable(java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[][] rows) throws java.sql.SQLException
java.sql.SQLException
private java.sql.PreparedStatement makeInsert(java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types) throws java.sql.SQLException
java.sql.SQLException
private void readTable(java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[][] rows) throws java.sql.SQLException
java.sql.SQLException
private java.sql.PreparedStatement readTableQuery(java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types) throws java.sql.SQLException
java.sql.SQLException
private void checkRSMD(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
private void checkRows(java.sql.PreparedStatement ps, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[][] rows) throws java.sql.SQLException
ps
- the query used to obtain the resultstypes
- the type descriptions of the columnsrows
- the values expected to be returnedjava.lang.Exception
java.sql.SQLException
private void checkPlainGet(java.sql.PreparedStatement ps, int columnIndex, JDBCDriverTest.TypeDescriptor type, java.lang.Object[][] rows) throws java.sql.SQLException
ps
- the query used to obtain the resultscolumnIndex
- the index of the column to checktype
- the type description of the columnrows
- the values expected to be returnedjava.lang.Exception
java.sql.SQLException
private void checkCoercions(java.sql.PreparedStatement ps, JDBCDriverTest.TypeDescriptor type) throws java.sql.SQLException
ps
- the query used to obtain the rowstype
- the type description of the columnjava.sql.SQLException
private int rsmdTypeKludge(int originalJDbcType)
private void setRow(java.sql.PreparedStatement ps, int keyValue, JDBCDriverTest.TypeDescriptor[] types, java.lang.Object[] row) throws java.sql.SQLException
java.sql.SQLException
private java.lang.Object[] makeNullRow(int rowLength)
private void buildTypeMap()
private void putType(JDBCDriverTest.TypeDescriptor type)
private JDBCDriverTest.TypeDescriptor getType(java.lang.String typeName)
private void buildCoercionMap()
private void putCoercionIndex(int index)
private int getCoercionIndex(int jdbcType)
private static void createTable(java.sql.Connection con, java.lang.String tableName, JDBCDriverTest.TypeDescriptor[] types) throws java.sql.SQLException
java.sql.SQLException
private static void createUDTObjects(java.sql.Connection con) throws java.sql.SQLException
java.sql.SQLException
private static void create_derby_2602_objects(java.sql.Connection con) throws java.sql.SQLException
java.sql.SQLException
private static void beginColumnList(java.lang.StringBuilder builder)
private static void endColumnList(java.lang.StringBuilder builder)
private static void addColumn(java.lang.StringBuilder builder, int columnNumber, java.lang.String text)
private void dropSchema() throws java.sql.SQLException
java.sql.SQLException
private void dropUDTObjects() throws java.sql.SQLException
java.sql.SQLException
private void drop_derby_2602_objects() throws java.sql.SQLException
java.sql.SQLException
private void setParameter(java.sql.PreparedStatement ps, int param, JDBCDriverTest.TypeDescriptor type, java.lang.Object value) throws java.sql.SQLException
java.sql.SQLException
private boolean clientSupports(JDBCDriverTest.TypeDescriptor type) throws java.sql.SQLException
java.sql.SQLException
private java.lang.Object getColumn(java.sql.ResultSet rs, java.lang.String columnName, JDBCDriverTest.TypeDescriptor type) throws java.sql.SQLException
java.sql.SQLException
private static java.lang.String doubleQuote(java.lang.String text)
public static junit.framework.Test suite()
JUnit boilerplate which adds as test cases all public methods whose names start with the string "test" in the named classes.
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.