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

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.UpdateXXXTest
All Implemented Interfaces:
junit.framework.Test

public final class UpdateXXXTest
extends BaseJDBCTestCase

Tests updateXXX() methods on updatable resultsets. This is done by creating a table which has n columns with different SQL types. Then there is one testcase for each updateXXX method, which calls updateXXX on all columns.


Field Summary
private static int COLUMNS
           
private static java.lang.String SELECT_STMT
           
private static java.lang.String TABLE_NAME
           
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
UpdateXXXTest(java.lang.String name)
          Constructor
 
Method Summary
private static junit.framework.TestSuite baseSuite(java.lang.String name)
          Base suite of tests that will run in both embedded and client.
private  void checkColumnsAreNull()
          Checks that the columns in the row are all SQL null.
private  void checkColumnsAreUpdated()
          Checks that the columns in the row are updated in the database.
 void jdbc2testUpdateBigDecimal()
          Tests calling update on all columns of the row.
 void setUp()
          The setup creates a Connection to the database, and also creates a table with one row.
static junit.framework.Test suite()
          Run in both embedded and client.
 void testUpdateDouble()
          Tests calling updateDouble on all columns of the row.
 void testUpdateFloat()
          Tests calling updateFloat on all columns of the row.
 void testUpdateInt()
          Tests calling updateInt on all columns of the row.
 void testUpdateLong()
          Tests calling updateLong on all columns of the row.
 void testUpdateNull()
          Tests calling setNull on all columns
 void testUpdateObjectWithNull()
          Tests calling updateObject with a null value on all columns.
 void testUpdateShort()
          Tests calling updateShort on all columns of the row.
 void testUpdateString()
          Tests calling updateString on all columns of the row.
 
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, initializeConnection, 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, 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

TABLE_NAME

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

SELECT_STMT

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

COLUMNS

private static final int COLUMNS
See Also:
Constant Field Values
Constructor Detail

UpdateXXXTest

public UpdateXXXTest(java.lang.String name)
Constructor

Parameters:
name - name of testcase. Should be the name of test method.
Method Detail

suite

public static junit.framework.Test suite()
Run in both embedded and client.


baseSuite

private static junit.framework.TestSuite baseSuite(java.lang.String name)
Base suite of tests that will run in both embedded and client.

Parameters:
name - Name for the suite.

setUp

public void setUp()
           throws java.lang.Exception
The setup creates a Connection to the database, and also creates a table with one row. Then it creates an updatable ResultSet which is positioned on the row.

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception - any exception will cause test to fail with error.

testUpdateString

public void testUpdateString()
                      throws java.sql.SQLException
Tests calling updateString on all columns of the row.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

testUpdateInt

public void testUpdateInt()
                   throws java.sql.SQLException
Tests calling updateInt on all columns of the row.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

testUpdateLong

public void testUpdateLong()
                    throws java.sql.SQLException
Tests calling updateLong on all columns of the row.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

testUpdateShort

public void testUpdateShort()
                     throws java.sql.SQLException
Tests calling updateShort on all columns of the row.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

testUpdateFloat

public void testUpdateFloat()
                     throws java.sql.SQLException
Tests calling updateFloat on all columns of the row.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

testUpdateDouble

public void testUpdateDouble()
                      throws java.sql.SQLException
Tests calling updateDouble on all columns of the row.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

jdbc2testUpdateBigDecimal

public void jdbc2testUpdateBigDecimal()
                               throws java.sql.SQLException
Tests calling update on all columns of the row.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

testUpdateObjectWithNull

public void testUpdateObjectWithNull()
                              throws java.sql.SQLException
Tests calling updateObject with a null value on all columns.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

testUpdateNull

public void testUpdateNull()
                    throws java.sql.SQLException
Tests calling setNull on all columns

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

checkColumnsAreNull

private void checkColumnsAreNull()
                          throws java.sql.SQLException
Checks that the columns in the row are all SQL null.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

checkColumnsAreUpdated

private void checkColumnsAreUpdated()
                             throws java.sql.SQLException
Checks that the columns in the row are updated in the database. Using a new ResultSet to do this check.

Throws:
java.sql.SQLException - database access error. Causes test to fail with an error.

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.