|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.derbyTesting.junit.BaseTestCase
org.apache.derbyTesting.junit.BaseJDBCTestCase
org.apache.derbyTesting.functionTests.tests.jdbcapi.StatementPoolingTest
public class StatementPoolingTest
A set of tests specifically targeted at connections that support statement pooling.
| Field Summary |
|---|
| Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE |
| Constructor Summary | |
|---|---|
StatementPoolingTest(java.lang.String name)
|
|
| Method Summary | |
|---|---|
private static void |
assertClassName(java.lang.Object obj,
java.lang.String expectedName)
Assert that the name of the class of the object is what is expected. |
private void |
cleanTableExceptedToBeEmpty()
Deletes row from a test table that is expected to be empty. |
private void |
doTestGetStatement(java.sql.PreparedStatement ps)
Make sure ResultSet.getStatement() returns the same object as the
one that created the result set. |
private void |
doTestHoldabilityIsReset(boolean closeConnection)
Test sequence for testing if the connection holdability is reset. |
private void |
doTestIsolationLevelIsReset(boolean closeConnection,
boolean executeQuery)
Tests if the connection isolation level is reset when a new connection is obtained. |
private void |
doTestResultSetCloseForHoldability(int holdability)
Tests if the holdability settings is taking effect, and also that the result set is closed when the connection is closed. |
void |
resTestCloseCursorsAtCommit()
|
void |
resTestCloseDoesNotAffectOtherStatement()
Checks if a reset of one statement affects other open statement on the connection. |
void |
resTestCommitOnReuse()
Tests that autocommit is working. |
void |
resTestHoldCursorsOverCommit()
|
void |
resTestLogicalConnectionCloseInvalidatesLogicalStatement()
Checks if closing the logical connection closes the logical statement. |
void |
resTestNoCommitOnReuse()
Tests that nothing is committed on the connection when autocommit is disabled. |
void |
resTestNoDataCommittedOnInvalidTransactionState()
Tests that nothing is committed on the connection when autocommit is disabled. |
static junit.framework.Test |
suite()
|
void |
testCacheOverflow()
Tests that the statement cache is able to throw out prepared statements when it reaches maximum capacity. |
void |
testCachingLogicalConnectionCloseLeavesPhysicalStatementsOpen()
Tests that closing the caching logical connection closes the logical prepared statement, but not the physical prepared statement. |
void |
testClosingPSClosesRS()
Tests that closing the prepared statement also closes the result set. |
void |
testDeleteReferringTableWhenInCache()
Tests that closing a logical prepared statement referring a non-existing table works. |
void |
testDeleteReferringTableWhenOpen()
Tests that closing a logical prepared statement referring a non-existing table works. |
void |
testGetStatementCallable()
Make sure ResultSet.getStatement() returns the same object as the
one that created the result set. |
void |
testGetStatementPrepared()
Make sure ResultSet.getStatement() returns the same object as the
one that created the result set. |
void |
testHoldabilityIsResetExplicitClose()
Tests that the connection holdability is reset, when it is first modified, the connection closed and a new logical connection obtained. |
void |
testHoldabilityIsResetNoExplicitClose()
Tests that the connection holdability is reset, when it is first modified, and a new logical connection obtained without first explicitly closing the previous one. |
void |
testIsolationLevelIsResetExplicitCloseNoQuery()
|
void |
testIsolationLevelIsResetExplicitCloseQuery()
|
void |
testIsolationLevelIsResetNoExplicitCloseNoQuery()
|
void |
testIsolationLevelIsResetNoExplicitCloseQuery()
|
void |
testPoolingEnabledByCheckingImplementationDetails()
Verifies that statement pooling is enabled by checking the names of the implementation classes in Derby. |
void |
testPrepareCallPath()
This test merley checks that creating a logical callable statement does not fail. |
void |
testPrepareCallWithNoCallPath()
This test merley checks that creating a logical callable statement, which is not really a call, does not fail. |
void |
testPrepareStatementPath()
This test merley checks that creating a logical prepared statement does not fail. |
void |
testTemporaryTablesAreDeletedInNewLogicalConnection()
Tests that a temporary table crated in one logical connection is gone in the next logical connection. |
| 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 |
| Constructor Detail |
|---|
public StatementPoolingTest(java.lang.String name)
| Method Detail |
|---|
public void testCacheOverflow()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
public void testPoolingEnabledByCheckingImplementationDetails()
throws java.sql.SQLException
java.sql.SQLException - if creating the JDBC objects fail
private static void assertClassName(java.lang.Object obj,
java.lang.String expectedName)
The assert does not consider package names, only the name passed in as
expectedName and the passed in name concatenated with "40".
WARNING: This method is not a general utility method. Please look at the implementation to determine if you can use it.
obj - object to checkexpectedName - the expected name of the class
AssertionFailedError - if the class name is not as expected
public void testPrepareStatementPath()
throws java.sql.SQLException
java.sql.SQLException - if creating the prepared statement fails
public void testPrepareCallPath()
throws java.sql.SQLException
java.sql.SQLException - if creating the callable statement fails
public void testPrepareCallWithNoCallPath()
throws java.sql.SQLException
java.sql.SQLException - if creating the callable statement fails
public void testClosingPSClosesRS()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
public void testHoldabilityIsResetExplicitClose()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
public void testHoldabilityIsResetNoExplicitClose()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
private void doTestHoldabilityIsReset(boolean closeConnection)
throws java.sql.SQLException
closeConnection - determines if the logical connection is
explicitly closed before a new one is obtained
java.sql.SQLException - if something goes wrong...
public void testIsolationLevelIsResetExplicitCloseQuery()
throws java.sql.SQLException
java.sql.SQLException
public void testIsolationLevelIsResetExplicitCloseNoQuery()
throws java.sql.SQLException
java.sql.SQLException
public void testIsolationLevelIsResetNoExplicitCloseNoQuery()
throws java.sql.SQLException
java.sql.SQLException
public void testIsolationLevelIsResetNoExplicitCloseQuery()
throws java.sql.SQLException
java.sql.SQLException
private void doTestIsolationLevelIsReset(boolean closeConnection,
boolean executeQuery)
throws java.sql.SQLException
The two arguments are introduced to test different scenarios; explicit and implicit connection closing, and session data caching (piggybacked information).
closeConnection - tells if the connection is explicitly closed
before a new one is obtainedexecuteQuery - tells if a query is executed on the connection before
a new connection is obtained.
java.sql.SQLException - if something goes wrong...
public void testCachingLogicalConnectionCloseLeavesPhysicalStatementsOpen()
throws java.sql.SQLException
Since there are no public interface methods to test this, the approach taken will be as follows:
java.sql.SQLException - if something goes wrong...
public void resTestCloseDoesNotAffectOtherStatement()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
public void testDeleteReferringTableWhenOpen()
throws java.sql.SQLException
In this test, the prepared statement that will be made invalid by the delete is held open by the user.
java.sql.SQLException - if something goes wrong...
public void testDeleteReferringTableWhenInCache()
throws java.sql.SQLException
In this test, the prepared statement that will be made invalid by the delete is in the statement cache when the delete happens.
java.sql.SQLException - if something goes wrong...
public void resTestCloseCursorsAtCommit()
throws java.sql.SQLException
java.sql.SQLException
public void resTestHoldCursorsOverCommit()
throws java.sql.SQLException
java.sql.SQLException
public void testTemporaryTablesAreDeletedInNewLogicalConnection()
throws java.sql.SQLException
java.sql.SQLException - if the test fails for some reason
private void doTestResultSetCloseForHoldability(int holdability)
throws java.sql.SQLException
holdability - result set holdability as specfied by
ResultSet
java.sql.SQLException - if something goes wrong...
public void testGetStatementCallable()
throws java.sql.SQLException
ResultSet.getStatement() returns the same object as the
one that created the result set.
java.sql.SQLException
public void testGetStatementPrepared()
throws java.sql.SQLException
ResultSet.getStatement() returns the same object as the
one that created the result set.
java.sql.SQLException
private void doTestGetStatement(java.sql.PreparedStatement ps)
throws java.sql.SQLException
ResultSet.getStatement() returns the same object as the
one that created the result set.
ps - prepared or callable statement to test with
java.sql.SQLException - if something goes wrong...
public void resTestLogicalConnectionCloseInvalidatesLogicalStatement()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
public void resTestNoCommitOnReuse()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
public void resTestCommitOnReuse()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
public void resTestNoDataCommittedOnInvalidTransactionState()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...
private void cleanTableExceptedToBeEmpty()
throws java.sql.SQLException
java.sql.SQLException - if a database operation failspublic static junit.framework.Test suite()
|
Built on Thu 2009-11-26 18:42:53-0800, from revision 884739 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||