public class LobRsGetterTest extends BaseJDBCTestCase
Some relevant JIRAs:
Modifier and Type | Field and Description |
---|---|
private static int |
BLOB |
private static int |
CLOB |
private static boolean[][] |
COMPATIBLE_GETTERS
Lists the compatible getters for BLOB and CLOB.
|
private static boolean |
E
Supported, but not marked as valid by the JDBC spec.
|
private static int |
GET_ASCII_STREAM |
private static int |
GET_BINARY_STREAM |
private static int |
GET_BLOB |
private static int |
GET_BYTES |
private static int |
GET_CHARACTER_STREAM |
private static int |
GET_CLOB |
private static int |
GET_OBJECT |
private static int |
GET_STRING |
private static java.lang.String[] |
GETTER_NAMES
The names of the various getters used in this test.
|
private static boolean |
SUPPORTED |
private static java.lang.String |
TABLE |
private static boolean |
u |
private static boolean |
UNSUPPORTED |
private static boolean |
X |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
LobRsGetterTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private void |
_testGettersMultiInvocation(java.lang.String columnName,
int typeIdx) |
private void |
_testGettersSimple(java.lang.String columnName,
int typeIdx) |
private void |
_testGettersSimpleNegative(java.lang.String columnName,
int typeIdx) |
private java.lang.String |
debugInfo(int colIdx,
java.sql.ResultSet rs,
int typeIdx,
int getter)
Generates a debug string telling which getter failed.
|
private void |
invokeGetter(int column,
java.sql.ResultSet rs,
int typeIdx,
int getter)
Invokes the specified getter on the given result set 1-based index.
|
private void |
invokeGetter(java.sql.ResultSet rs,
int typeIdx,
int getter)
Invokes the specified getter on column 1 of the result set.
|
static junit.framework.Test |
suite()
Returns a suite with all tests running with both embedded and client.
|
void |
testBlobGettersMultiInvocation()
Tests that multiple invocations of getters on the same column/row throw
an exception in most cases.
|
void |
testBlobGettersSimple()
Tests that all getters marked as supported don't throw an exception.
|
void |
testBlobGettersSimpleNegative()
Tests that all getters marked as unsupported throw an exception.
|
void |
testBlobGetXFollowedByGetBytes()
Tests that
getBytes throws exception when invoked after any
other getters than getBytes and getString . |
void |
testClobGettersMultiInvocation()
Tests that multiple invocations of getters on the same column/row throw
an exception in most cases.
|
void |
testClobGettersSimple()
Tests that all getters marked as supported don't throw an exception.
|
void |
testClobGettersSimpleNegative()
Tests that all getters marked as unsupported throw an exception.
|
void |
testClobGetXFollowedByGetString()
Tests that
getString throws exception when invoked after any
other getter than getString . |
void |
testCorrectBlobDataWithMultiCall()
Tests that data returned by the last BLOB getter invokation is correct.
|
void |
testCorrectClobDataWithMultiCall()
Tests that data returned by the last CLOB getter invokation is correct.
|
private java.lang.String |
typeName(int typeIdx)
Returns the type name of the given test class specific type index.
|
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 TABLE
private static final boolean UNSUPPORTED
private static final boolean SUPPORTED
private static final int BLOB
private static final int CLOB
private static final int GET_BYTES
private static final int GET_STRING
private static final int GET_ASCII_STREAM
private static final int GET_BINARY_STREAM
private static final int GET_CHARACTER_STREAM
private static final int GET_CLOB
private static final int GET_BLOB
private static final int GET_OBJECT
private static final boolean X
private static final boolean E
private static final boolean u
private static final boolean[][] COMPATIBLE_GETTERS
Note that the getters getNCharacterStream
, getNString
and getNClob
aren't tested. They're not supported by Derby.
For notes on behavior when invoking the various character getters on binary columns, see JDBCImplementation.html.
private static final java.lang.String[] GETTER_NAMES
The positions/indexes must correspond to those in COMPATIBLE_GETTERS.
public static junit.framework.Test suite()
public void testBlobGettersSimple() throws java.sql.SQLException
java.sql.SQLException
public void testClobGettersSimple() throws java.sql.SQLException
java.sql.SQLException
public void testBlobGettersSimpleNegative() throws java.sql.SQLException
java.sql.SQLException
public void testClobGettersSimpleNegative() throws java.sql.SQLException
java.sql.SQLException
public void testBlobGettersMultiInvocation() throws java.sql.SQLException
For now getBytes
and getString
are behaving differently
for BLOBs.
java.sql.SQLException
public void testClobGettersMultiInvocation() throws java.sql.SQLException
For now getString
is behaving differently for CLOBs.
java.sql.SQLException
public void testBlobGetXFollowedByGetBytes() throws java.sql.SQLException
getBytes
throws exception when invoked after any
other getters than getBytes
and getString
.java.sql.SQLException
public void testClobGetXFollowedByGetString() throws java.sql.SQLException
getString
throws exception when invoked after any
other getter than getString
.java.sql.SQLException
public void testCorrectBlobDataWithMultiCall() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testCorrectClobDataWithMultiCall() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
private void _testGettersMultiInvocation(java.lang.String columnName, int typeIdx) throws java.sql.SQLException
java.sql.SQLException
private void _testGettersSimpleNegative(java.lang.String columnName, int typeIdx) throws java.sql.SQLException
java.sql.SQLException
private void _testGettersSimple(java.lang.String columnName, int typeIdx) throws java.sql.SQLException
java.sql.SQLException
private void invokeGetter(java.sql.ResultSet rs, int typeIdx, int getter) throws java.sql.SQLException
java.sql.SQLException
private void invokeGetter(int column, java.sql.ResultSet rs, int typeIdx, int getter) throws java.sql.SQLException
java.sql.SQLException
private java.lang.String typeName(int typeIdx)
private java.lang.String debugInfo(int colIdx, java.sql.ResultSet rs, int typeIdx, int getter) throws java.sql.SQLException
colIdx
- 1-based column index accessed on the result setrs
- the result set accessedtypeIdx
- test class specific type (BLOB or CLOB)getter
- test class specific getter indexjava.sql.SQLException
- if accessing result set meta data failsApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.