public class StatementTest extends BaseJDBCTestCase
| Modifier and Type | Class and Description |
|---|---|
static class |
StatementTest.StatementWrapper
This wrapper is used to expose JDBC 4.2 methods which can run on
VM rev levels lower than Java 8.
|
| Modifier and Type | Field and Description |
|---|---|
private java.sql.Statement |
stmt
Default statement used by the tests.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE| Constructor and Description |
|---|
StatementTest(java.lang.String name)
Create a new test with the given name.
|
| Modifier and Type | Method and Description |
|---|---|
private static void |
createBatch(StatementTest.StatementWrapper sw) |
private static void |
largeBatchTest(StatementTest.StatementWrapper sw,
long rowCountBase) |
private static void |
largeBatchUpdateExceptionTest(StatementTest.StatementWrapper sw,
long rowCountBase) |
private static void |
largeMaxRowsTest(StatementTest.StatementWrapper sw,
long maxRows) |
static void |
largeUpdate_jdbc4_2(java.sql.Connection conn) |
private static void |
largeUpdateTest(StatementTest.StatementWrapper sw,
long rowCountBase) |
private static void |
largeUpdateTest(StatementTest.StatementWrapper sw,
long rowCountBase,
long rowCount) |
static void |
setRowCountBase(long newBase)
Set the base which is used for returned row counts and fetched row counters
|
static void |
setRowCountBase(java.sql.Statement stmt,
boolean onClient,
long rowCountBase) |
protected void |
setUp()
Create default connection and statement.
|
private static int[] |
squashLongs(long[] longs) |
static junit.framework.Test |
suite()
Create test suite for StatementTest.
|
protected void |
tearDown()
Close default connection and statement if necessary.
|
void |
test_jdbc4_1_queryTimeoutException()
Test that Statement.setQueryTimeout() causes statements to
raise SQLTimeoutException per the JDBC 4.1 spec clarification.
|
void |
testCompletionClosure_jdbc4_1_implicitRSClosure()
Test the closeOnCompletion() and isCloseOnCompletion() methods
when using ResultSets which close implicitly.
|
void |
testIsClosedBasic()
Check that
isClosed returns true after
the statement has been explicitly closed. |
void |
testIsClosedWhenClosingConnection()
Test that the two statements created on the connection are closed
when the connection itself is closed.
|
void |
testIsClosedWhenClosingConnectionInInvalidState()
Check the state of the statement when the connection is first attempted
closed when in an invalid transaction state, then closed after a
commit.
|
void |
testIsClosedWithTwoStatementsOnSameConnection()
Test that creating two statements on the same connection does not
cause side effects on the statements.
|
void |
testIsNotWrapperForCallableStatement() |
void |
testIsNotWrapperForPreparedStatement() |
void |
testIsNotWrapperForResultSet() |
void |
testIsWrapperForStatement() |
void |
testLargeUpdate_jdbc4_2()
Test the large update methods added by JDBC 4.2.
|
void |
testPoolable()
Tests isPoolable, setPoolable, and the default poolability.
|
void |
testStatementExecuteAfterConnectionClose()
Execute a query on a statement after the parent connection has been
closed.
|
void |
testUnwrapCallableStatement() |
void |
testUnwrapPreparedStatement() |
void |
testUnwrapResultSet() |
void |
testUnwrapStatement() |
private static void |
truncate(StatementTest.StatementWrapper sw) |
private static void |
vetUpdateSize(StatementTest.StatementWrapper sw,
int expected,
int actual,
long longAnswer) |
private static void |
vetUpdateSize(StatementTest.StatementWrapper sw,
long expected,
long actual,
long longAnswer) |
assertCallError, assertCheckTable, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, emptyStatementCache, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, usingDB2Client, usingDerbyNetClient, usingEmbeddedalarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isJava8, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemProperty, sleep, sleepAtLeastOneTick, traceitassertEquals, 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, toStringpublic StatementTest(java.lang.String name)
name - name of the test.protected void setUp()
throws java.sql.SQLException
setUp in class junit.framework.TestCasejava.sql.SQLException - if setAutoCommit, createStatement or
BaseJDBCTestCase.getConnection fails.protected void tearDown()
throws java.lang.Exception
tearDown in class BaseJDBCTestCasejava.sql.SQLException - if a database access exception occurs.java.lang.Exceptionpublic void testIsClosedBasic()
throws java.sql.SQLException
isClosed returns true after
the statement has been explicitly closed.java.sql.SQLExceptionpublic void testIsClosedWithTwoStatementsOnSameConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIsClosedWhenClosingConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIsClosedWhenClosingConnectionInInvalidState()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testStatementExecuteAfterConnectionClose()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIsWrapperForStatement()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIsNotWrapperForPreparedStatement()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIsNotWrapperForCallableStatement()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testIsNotWrapperForResultSet()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testUnwrapStatement()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testUnwrapPreparedStatement()
public void testUnwrapCallableStatement()
public void testUnwrapResultSet()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void testPoolable()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void test_jdbc4_1_queryTimeoutException()
throws java.lang.Exception
java.lang.Exceptionpublic void testCompletionClosure_jdbc4_1_implicitRSClosure()
throws java.lang.Exception
java.lang.Exceptionpublic void testLargeUpdate_jdbc4_2()
throws java.lang.Exception
java.lang.Exceptionpublic static void largeUpdate_jdbc4_2(java.sql.Connection conn)
throws java.lang.Exception
java.lang.Exceptionprivate static void largeUpdateTest(StatementTest.StatementWrapper sw, long rowCountBase) throws java.lang.Exception
java.lang.Exceptionprivate static void largeUpdateTest(StatementTest.StatementWrapper sw, long rowCountBase, long rowCount) throws java.lang.Exception
java.lang.Exceptionprivate static void vetUpdateSize(StatementTest.StatementWrapper sw, int expected, int actual, long longAnswer) throws java.lang.Exception
java.lang.Exceptionprivate static void vetUpdateSize(StatementTest.StatementWrapper sw, long expected, long actual, long longAnswer) throws java.lang.Exception
java.lang.Exceptionprivate static void largeBatchTest(StatementTest.StatementWrapper sw, long rowCountBase) throws java.lang.Exception
java.lang.Exceptionprivate static void createBatch(StatementTest.StatementWrapper sw) throws java.lang.Exception
java.lang.Exceptionprivate static void largeMaxRowsTest(StatementTest.StatementWrapper sw, long maxRows) throws java.lang.Exception
java.lang.Exceptionprivate static void largeBatchUpdateExceptionTest(StatementTest.StatementWrapper sw, long rowCountBase) throws java.lang.Exception
java.lang.Exceptionpublic static void setRowCountBase(java.sql.Statement stmt,
boolean onClient,
long rowCountBase)
throws java.lang.Exception
java.lang.Exceptionprivate static void truncate(StatementTest.StatementWrapper sw) throws java.lang.Exception
java.lang.Exceptionprivate static int[] squashLongs(long[] longs)
public static junit.framework.Test suite()
public static void setRowCountBase(long newBase)
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.