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

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
                      extended by org.apache.derbyTesting.functionTests.tests.jdbcapi.ConcurrencyTest
All Implemented Interfaces:
junit.framework.Test

public class ConcurrencyTest
extends SURBaseTest

Testing concurrency behaviour in derby when creating the resultsets with different parameters.


Field Summary
 
Fields inherited from class org.apache.derbyTesting.functionTests.tests.jdbcapi.SURBaseTest
CURSOR_NOT_POSITIONED_ON_INSERT_ROW, CURSOR_NOT_UPDATABLE_SQL_STATE, CURSOR_OPERATION_CONFLICT, FOR_UPDATE_NOT_PERMITTED_SQL_STATE, INVALID_CURSOR_STATE_NO_CURRENT_ROW, LOCK_TIMEOUT_EXPRESSION_SQL_STATE, LOCK_TIMEOUT_SQL_STATE, QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET, recordCount, RESULTSET_NOT_UPDATABLE_SQL_STATE
 
Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
 
Constructor Summary
ConcurrencyTest(java.lang.String name)
          Creates a new instance of ConcurrencyTest
 
Method Summary
private static junit.framework.Test baseSuite(java.lang.String name, boolean embedded)
           
 void setUp()
          Sets up the connection, then create the data model
static junit.framework.Test suite()
          Run in embedded and client.
 void tearDown()
          Tear down this fixture, sub-classes should call super.tearDown().
 void testAquireUpdateLock1()
          Test that we can aquire a update lock even if the row is locked with a shared lock.
private  void testCompressDuringScan(boolean testDefragment, boolean testTruncate)
          Test that the system does not purge any records as long as we do either a defragment, or truncate
 void testDefragmentDuringScan()
          Test that the system cannot defragment any records as long as an updatable result set is open against the table.
 void testSharedAndUpdateLocks1()
           
 void testSharedAndUpdateLocks2()
           
 void testSharedLocks1()
           
 void testSharedLocks2()
           
 void testTableIntentLock1()
          Tests that a ResultSet opened even in read uncommitted, gets a table intent lock, and that another transaction then cannot compress the table while the ResultSet is open.
 void testTruncateDuringScan()
          Test that the system cannot truncate any records as long as an updatable result set is open against the table.
 void testUpdateLockDownGrade1()
          Test that update locks are downgraded to shared locks after repositioning.
 void testUpdateLockInReadUncommitted()
          Test that Derby set updatelock on current row when using read-uncommitted
 void testUpdateModifiedTuple1()
          Test what happens if you update a tuple which has been modified by another transaction.
 void testUpdateModifiedTuple2()
          Test what happens if you update a tuple which has been modified by another transaction (in this case the same column)
 void testUpdatePurgedTuple1()
          Test what happens if you update a deleted + purged tuple.
 void testUpdatePurgedTuple2()
          Test what happens if you update a deleted tuple using positioned update (same as testUpdatePurgedTuple1, except here we use positioned updates)
 void testUpdatePurgedTuple3()
          Test what happens if you update a tuple which is deleted, purged and reinserted
 void testUpdatePurgedTuple4()
          Test what happens if you update a tuple which is deleted, purged and then reinserted with the exact same values
 
Methods inherited from class org.apache.derbyTesting.functionTests.tests.jdbcapi.SURBaseTest
assertFailOnUpdate, assertWarning, initializeConnection, scrollBackward, scrollBackwardAndUpdate, scrollBackwardAndUpdatePositioned, scrollForward, scrollForwardAndUpdate, scrollForwardAndUpdatePositioned, updateTuple, updateTuplePositioned, verifyTuple
 
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, 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
 

Constructor Detail

ConcurrencyTest

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

Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Sets up the connection, then create the data model

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Description copied from class: BaseJDBCTestCase
Tear down this fixture, sub-classes should call super.tearDown(). This cleanups & closes the connection if it is open and any statement objects returned through the utility methods.

Overrides:
tearDown in class BaseJDBCTestCase
Throws:
java.lang.Exception

testUpdateLockDownGrade1

public void testUpdateLockDownGrade1()
                              throws java.sql.SQLException
Test that update locks are downgraded to shared locks after repositioning. This test fails with Derby

Throws:
java.sql.SQLException

testAquireUpdateLock1

public void testAquireUpdateLock1()
                           throws java.sql.SQLException
Test that we can aquire a update lock even if the row is locked with a shared lock.

Throws:
java.sql.SQLException

testSharedLocks1

public void testSharedLocks1()
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

testSharedLocks2

public void testSharedLocks2()
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

testSharedAndUpdateLocks1

public void testSharedAndUpdateLocks1()
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

testSharedAndUpdateLocks2

public void testSharedAndUpdateLocks2()
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

testUpdatePurgedTuple1

public void testUpdatePurgedTuple1()
                            throws java.sql.SQLException
Test what happens if you update a deleted + purged tuple. The transaction which deletes the tuple, will also ensure that the tuple is purged from the table, not only marked as deleted.

Throws:
java.sql.SQLException

testUpdatePurgedTuple2

public void testUpdatePurgedTuple2()
                            throws java.sql.SQLException
Test what happens if you update a deleted tuple using positioned update (same as testUpdatePurgedTuple1, except here we use positioned updates)

Throws:
java.sql.SQLException

testUpdatePurgedTuple3

public void testUpdatePurgedTuple3()
                            throws java.sql.SQLException
Test what happens if you update a tuple which is deleted, purged and reinserted

Throws:
java.sql.SQLException

testUpdatePurgedTuple4

public void testUpdatePurgedTuple4()
                            throws java.sql.SQLException
Test what happens if you update a tuple which is deleted, purged and then reinserted with the exact same values

Throws:
java.sql.SQLException

testUpdateModifiedTuple1

public void testUpdateModifiedTuple1()
                              throws java.sql.SQLException
Test what happens if you update a tuple which has been modified by another transaction.

Throws:
java.sql.SQLException

testUpdateModifiedTuple2

public void testUpdateModifiedTuple2()
                              throws java.sql.SQLException
Test what happens if you update a tuple which has been modified by another transaction (in this case the same column)

Throws:
java.sql.SQLException

testTableIntentLock1

public void testTableIntentLock1()
                          throws java.sql.SQLException
Tests that a ResultSet opened even in read uncommitted, gets a table intent lock, and that another transaction then cannot compress the table while the ResultSet is open.

Throws:
java.sql.SQLException

testUpdateLockInReadUncommitted

public void testUpdateLockInReadUncommitted()
                                     throws java.sql.SQLException
Test that Derby set updatelock on current row when using read-uncommitted

Throws:
java.sql.SQLException

testDefragmentDuringScan

public void testDefragmentDuringScan()
                              throws java.sql.SQLException
Test that the system cannot defragment any records as long as an updatable result set is open against the table.

Throws:
java.sql.SQLException

testTruncateDuringScan

public void testTruncateDuringScan()
                            throws java.sql.SQLException
Test that the system cannot truncate any records as long as an updatable result set is open against the table.

Throws:
java.sql.SQLException

testCompressDuringScan

private void testCompressDuringScan(boolean testDefragment,
                                    boolean testTruncate)
                             throws java.sql.SQLException
Test that the system does not purge any records as long as we do either a defragment, or truncate

Throws:
java.sql.SQLException

suite

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


baseSuite

private static junit.framework.Test baseSuite(java.lang.String name,
                                              boolean embedded)

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.