public class LogicalStatementEntityTest extends BaseJDBCTestCase
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE| Constructor and Description |
|---|
LogicalStatementEntityTest(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
private org.apache.derby.client.am.LogicalStatementEntity |
createLogicalStatementEntity(java.lang.String sql,
boolean isCallable,
org.apache.derby.client.am.stmtcache.JDBCStatementCache cache)
Creates a logical statement entity.
|
private org.apache.derby.client.am.stmtcache.StatementKey |
insertStatementIntoCache(org.apache.derby.client.am.stmtcache.JDBCStatementCache cache,
java.sql.PreparedStatement ps,
java.lang.String sql)
Insers the statement into the cache.
|
static junit.framework.Test |
suite()
Returns a suite of tests running in a client-server environment.
|
void |
testCloseBehaviorExternalCs()
Verifies that the logical statement representing a callable statement
behaves correctly when it has been closed.
|
void |
testCloseBehaviorExternalPs()
Verifies that the logical statement representing a prepared statement
behaves correctly when it has been closed.
|
void |
testClosedUnderlyingStatement()
Tries to execute a method on a logical statement when the underlying
physical statement has been closed without the logical connection
knowing.
|
void |
testCloseOnDuplicateStatement()
Tests that a statement equal to one in the cache is not cached when
closing the logical statement, and that the physical statement is closed.
|
void |
testCloseWhenStatementShallBeCached()
Asserts that closing the logical statement and caching the physical one
does close the logical one but not the physical one.
|
void |
testEvictionFromCache()
Tests that the cache throws out the least frequently used statement when
it reaches its maximum capacity, and that the thrown out statement is
closed in the process.
|
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, tearDown, 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, setUp, toStringpublic LogicalStatementEntityTest(java.lang.String name)
public void testCloseBehaviorExternalPs()
throws java.sql.SQLException
java.sql.SQLException - if a JDBC operation failspublic void testCloseBehaviorExternalCs()
throws java.sql.SQLException
java.sql.SQLException - if a JDBC operation failspublic void testCloseOnDuplicateStatement()
throws java.sql.SQLException
java.sql.SQLException - if a JDBC operation failspublic void testCloseWhenStatementShallBeCached()
throws java.sql.SQLException
java.sql.SQLException - if a JDBC operation failspublic void testClosedUnderlyingStatement()
throws java.sql.SQLException
java.sql.SQLException - if something goes wrong...public void testEvictionFromCache()
throws java.sql.SQLException
Note: This test assumes things about the replacement policy.
java.sql.SQLException - if a JDBC operation failspublic static junit.framework.Test suite()
private org.apache.derby.client.am.LogicalStatementEntity createLogicalStatementEntity(java.lang.String sql,
boolean isCallable,
org.apache.derby.client.am.stmtcache.JDBCStatementCache cache)
throws java.sql.SQLException
The entity represents a prepared statement.
sql - the SQL textisCallable - whether the entity is a callable statement or notcache - the statement cache to interact with.java.sql.SQLException - if creating the entity failsprivate org.apache.derby.client.am.stmtcache.StatementKey insertStatementIntoCache(org.apache.derby.client.am.stmtcache.JDBCStatementCache cache,
java.sql.PreparedStatement ps,
java.lang.String sql)
throws java.sql.SQLException
cache - the to insert intops - the statement to insertsql - the SQL text of the statementjava.sql.SQLException - if getting the connection holdability failsApache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.