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

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.SURBaseTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ConcurrencyTest, HoldabilityTest, SURQueryMixTest, SURTest

public abstract class SURBaseTest
extends BaseJDBCTestCase

Base class for testing Scrollable Updatable ResultSets. The setUp() provides a Connection to the database. Tests of this class needs to be decorated by a DBSetup and SURDataModelSetup.


Field Summary
(package private) static java.lang.String CURSOR_NOT_POSITIONED_ON_INSERT_ROW
           
(package private) static java.lang.String CURSOR_NOT_UPDATABLE_SQL_STATE
           
(package private) static java.lang.String CURSOR_OPERATION_CONFLICT
           
(package private) static java.lang.String FOR_UPDATE_NOT_PERMITTED_SQL_STATE
          Error codes and SQL state
(package private) static java.lang.String INVALID_CURSOR_STATE_NO_CURRENT_ROW
           
(package private) static java.lang.String LOCK_TIMEOUT_EXPRESSION_SQL_STATE
           
(package private) static java.lang.String LOCK_TIMEOUT_SQL_STATE
           
(package private) static java.lang.String QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET
           
(package private)  int recordCount
           
(package private) static java.lang.String RESULTSET_NOT_UPDATABLE_SQL_STATE
           
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
SURBaseTest(java.lang.String name)
          Creates a new instance of SURBaseTest
SURBaseTest(java.lang.String name, int records)
          Creates a new instance of SURBaseTest
 
Method Summary
protected  void assertFailOnUpdate(java.sql.ResultSet rs)
          Assert that update of ResultSet fails with a SQLException due to read-only ResultSet.
protected  void assertWarning(java.sql.SQLWarning warn, java.lang.String sqlState)
          Assert that a warning was received
protected  void initializeConnection(java.sql.Connection conn)
          Override a connection's default state to ensure it is always in autocommit false and repeatable read as a starting point.
protected  void scrollBackward(java.sql.ResultSet rs)
          Scroll backward to the beginning of the ResultSet, and verify tuples while scrolling.
protected  void scrollBackwardAndUpdate(java.sql.ResultSet rs)
          Scroll backward and update the records using updateXXX() and updateRow()
protected  void scrollBackwardAndUpdatePositioned(java.sql.ResultSet rs)
          Scroll backward and update the records using positioned updates.
protected  void scrollForward(java.sql.ResultSet rs)
          Scroll forward to the end of the ResultSet, and verify tuples while scrolling.
protected  void scrollForwardAndUpdate(java.sql.ResultSet rs)
          Scroll forward and update the tuples using updateXXX() and updateRow()
protected  void scrollForwardAndUpdatePositioned(java.sql.ResultSet rs)
          Scroll forward and do positioned updates.
protected  void updateTuple(java.sql.ResultSet rs)
          Update the current tuple in the ResultSet using updateXXX() and updateRow()
protected  void updateTuplePositioned(java.sql.ResultSet rs)
          Update the current tuple in the ResultSet using positioned update
protected  void verifyTuple(java.sql.ResultSet rs)
          Verify the data of a tuple in the ResultSet, based on the data that were inserted.
 
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, 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
 

Field Detail

recordCount

final int recordCount

FOR_UPDATE_NOT_PERMITTED_SQL_STATE

static final java.lang.String FOR_UPDATE_NOT_PERMITTED_SQL_STATE
Error codes and SQL state

See Also:
Constant Field Values

CURSOR_NOT_UPDATABLE_SQL_STATE

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

RESULTSET_NOT_UPDATABLE_SQL_STATE

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

LOCK_TIMEOUT_SQL_STATE

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

LOCK_TIMEOUT_EXPRESSION_SQL_STATE

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

INVALID_CURSOR_STATE_NO_CURRENT_ROW

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

CURSOR_OPERATION_CONFLICT

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

QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET

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

CURSOR_NOT_POSITIONED_ON_INSERT_ROW

static final java.lang.String CURSOR_NOT_POSITIONED_ON_INSERT_ROW
See Also:
Constant Field Values
Constructor Detail

SURBaseTest

public SURBaseTest(java.lang.String name)
Creates a new instance of SURBaseTest


SURBaseTest

public SURBaseTest(java.lang.String name,
                   int records)
Creates a new instance of SURBaseTest

Method Detail

initializeConnection

protected void initializeConnection(java.sql.Connection conn)
                             throws java.sql.SQLException
Override a connection's default state to ensure it is always in autocommit false and repeatable read as a starting point.

Overrides:
initializeConnection in class BaseJDBCTestCase
Parameters:
conn - Connection to be intialized
Throws:
java.sql.SQLException - Error setting the initial state.

verifyTuple

protected void verifyTuple(java.sql.ResultSet rs)
                    throws java.sql.SQLException
Verify the data of a tuple in the ResultSet, based on the data that were inserted.

Throws:
java.sql.SQLException

updateTuple

protected void updateTuple(java.sql.ResultSet rs)
                    throws java.sql.SQLException
Update the current tuple in the ResultSet using updateXXX() and updateRow()

Throws:
java.sql.SQLException

updateTuplePositioned

protected void updateTuplePositioned(java.sql.ResultSet rs)
                              throws java.sql.SQLException
Update the current tuple in the ResultSet using positioned update

Throws:
java.sql.SQLException

scrollForward

protected void scrollForward(java.sql.ResultSet rs)
                      throws java.sql.SQLException
Scroll forward to the end of the ResultSet, and verify tuples while scrolling.

Throws:
java.sql.SQLException

scrollBackward

protected void scrollBackward(java.sql.ResultSet rs)
                       throws java.sql.SQLException
Scroll backward to the beginning of the ResultSet, and verify tuples while scrolling.

Throws:
java.sql.SQLException

scrollForwardAndUpdate

protected void scrollForwardAndUpdate(java.sql.ResultSet rs)
                               throws java.sql.SQLException
Scroll forward and update the tuples using updateXXX() and updateRow()

Throws:
java.sql.SQLException

scrollForwardAndUpdatePositioned

protected void scrollForwardAndUpdatePositioned(java.sql.ResultSet rs)
                                         throws java.sql.SQLException
Scroll forward and do positioned updates.

Throws:
java.sql.SQLException

scrollBackwardAndUpdate

protected void scrollBackwardAndUpdate(java.sql.ResultSet rs)
                                throws java.sql.SQLException
Scroll backward and update the records using updateXXX() and updateRow()

Throws:
java.sql.SQLException

scrollBackwardAndUpdatePositioned

protected void scrollBackwardAndUpdatePositioned(java.sql.ResultSet rs)
                                          throws java.sql.SQLException
Scroll backward and update the records using positioned updates.

Throws:
java.sql.SQLException

assertFailOnUpdate

protected void assertFailOnUpdate(java.sql.ResultSet rs)
                           throws java.sql.SQLException
Assert that update of ResultSet fails with a SQLException due to read-only ResultSet.

Throws:
java.sql.SQLException

assertWarning

protected void assertWarning(java.sql.SQLWarning warn,
                             java.lang.String sqlState)
                      throws java.sql.SQLException
Assert that a warning was received

Throws:
java.sql.SQLException

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.