public class J2EEDataSourceTest extends BaseJDBCTestCase
SecurityCheck
Modifier and Type | Field and Description |
---|---|
protected static java.util.Hashtable<java.lang.String,java.sql.Connection> |
conns
A hashtable of opened connections.
|
private static java.lang.String |
CONNSTRING_FORMAT
The expected format of a connection string.
|
private static java.lang.String |
dbName |
private java.lang.Object |
nogc
Hang onto the SecurityCheck class while running the
tests so that it is not garbage collected during the
test and lose the information it has collected,
in case it should get printed out.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
J2EEDataSourceTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private void |
assertConnectionOK(java.lang.Object[] expectedValues,
java.lang.String dsName,
java.sql.Connection conn) |
private void |
assertConnectionPreClose(java.lang.String dsName,
java.sql.Connection conn) |
private void |
assertConnectionState(int expectedHoldability,
int expectedIsolation,
boolean expectedCommitSetting,
boolean expectedReadOnly,
java.sql.Connection conn) |
private static void |
assertConnHoldability(java.sql.Connection conn,
int expectedHoldability)
Verify connection holdablity is expected holdability
|
private void |
assertIsoLocks(java.sql.Connection conn,
int expectedIsoLevel)
Checks locks for designated isolation level on the connection.
|
private static void |
assertLocks(int[] expectedValues,
java.sql.Connection conn) |
private static void |
assertMessageText(java.sql.Connection conn,
java.lang.String retrieveMessageTextValue)
Checks if retrieveMessageText takes effect.
|
private static void |
assertPooledConnAutoCommit(java.lang.String desc,
javax.sql.PooledConnection pc1)
Make sure autocommit gets reset on PooledConnection.getConnection()
|
private static void |
assertPooledConnHoldability(java.lang.String desc,
javax.sql.PooledConnection pc1)
Checks that Holdability gets reset on PooledConnection.getConnection()
|
private void |
assertPooledConnIso(java.lang.String pooledConnType,
javax.sql.PooledConnection pc)
Test that isolation is reset on PooledConnection.getConnection()
|
private void |
assertStatementOK(java.lang.String dsName,
java.sql.Connection conn,
java.sql.Statement s) |
private void |
assertStatementState(int[] parameterExpectedValues,
int[] expectedValues,
java.sql.Statement s) |
private static void |
assertStringFormat(java.sql.Connection conn)
Check the format of the connection string.
|
private static void |
assertStringFormat(javax.sql.PooledConnection pc)
Check the format of a pooled connection
|
private static java.lang.String |
assertStringPrefix(java.lang.Object conn)
Make sure the connection string starts with the right prefix, which
is the classname@hashcode.
|
private void |
assertTenConnectionsUnique()
Get connections using getConnection() and make sure
they're unique
|
private static void |
assertToString(java.sql.Connection conn)
Make sure this connection's string is unique (DERBY-243)
|
private static void |
assertToString(javax.sql.ConnectionPoolDataSource pds)
Check uniqueness of strings with a pooled data source.
|
private static void |
assertToString(javax.sql.DataSource ds)
Check uniqueness of connection strings coming from a
DataSouce
|
private static void |
assertToString(javax.sql.XADataSource xds)
Check uniqueness of strings for an XA data source
|
private static void |
assertTraceFilesExistAndCanBeDeleted()
Check that trace file exists in
|
protected void |
assertXAException(java.lang.String tag,
javax.transaction.xa.XAException xae) |
private static junit.framework.Test |
baseSuite(java.lang.String postfix)
Return a suite of tests that are run with both client and embedded
|
static void |
checkNesConn(java.lang.String dsName) |
private static void |
clearConnections()
Clear out and close connections in the connections
hashtable.
|
private java.sql.CallableStatement |
createFloatCallForStateChecking(int[] parameterExpectedValues,
int[] CallableStatementExpectedValues,
java.sql.Connection conn,
java.lang.String sql) |
private java.sql.Statement |
createFloatStatementForStateChecking(int[] StatementExpectedValues,
java.sql.Connection conn)
Create a statement with modified State.
|
private java.sql.PreparedStatement |
createFloatStatementForStateChecking(int[] parameterExpectedValues,
int[] PreparedStatementExpectedValues,
java.sql.Connection conn,
java.lang.String sql) |
private void |
doTestSchemaIsReset(javax.sql.PooledConnection pc,
java.lang.String userSchema)
Executes a test sequence to make sure the schema (and with DERBY-4551,
current user) is correctly reset between logical connections.
|
private static void |
dsConnectionRequest(java.lang.String expectedValue,
javax.sql.ConnectionPoolDataSource ds,
java.lang.String user,
java.lang.String ConnAttr) |
private static void |
dsConnectionRequest(java.lang.String expectedValue,
javax.sql.DataSource ds,
java.lang.String user,
java.lang.String ConnAttr) |
private static void |
dsConnectionRequest(java.lang.String expectedValue,
javax.sql.XADataSource ds,
java.lang.String user,
java.lang.String ConnAttr) |
private static void |
dsConnectionRequests(java.lang.String[] expectedValues,
javax.sql.DataSource ds) |
private static void |
dsCPConnectionRequests(java.lang.String[] expectedValues,
javax.sql.ConnectionPoolDataSource ds) |
private static void |
dsXAConnectionRequests(java.lang.String[] expectedValues,
javax.sql.XADataSource ds) |
private void |
endTranscation(java.sql.Connection con,
boolean isCommit,
int count)
Ends a transaction by invoking at least one commit or rollback.
|
private static junit.framework.Test |
getClientSuite()
Return a suite of tests that are run with client only
|
private static junit.framework.Test |
getEmbeddedSuite(java.lang.String postfix)
Return a suite of tests that are run with embedded only
|
private static java.lang.String |
getNestedMethodName()
Return the Java class and method for the procedure
for the nested connection test.
|
static java.lang.Object |
getPhysicalConnection(java.lang.Object ds)
Creates a physical connection from the given data source.
|
private static junit.framework.Test |
getTimeoutSuite(java.lang.String postfix)
Return a suite of tests that are run with a lower lock timeout.
|
private java.sql.CallableStatement |
internalCreateFloatCallForStateChecking(java.sql.Connection conn,
java.lang.String sql) |
private java.sql.Statement |
internalCreateFloatStatementForStateChecking(java.sql.Connection conn) |
private java.sql.PreparedStatement |
internalCreateFloatStatementForStateChecking(java.sql.Connection conn,
java.lang.String sql) |
private static void |
PoolReset(java.lang.String type,
javax.sql.PooledConnection pc)
When a connection is being pooled, the underlying JDBC embedded
connection object is re-used.
|
private static void |
PoolResetWork(java.lang.String expectedID,
java.lang.String tableAction,
java.sql.Connection conn) |
private static void |
queryOnStatement(java.lang.String expectedCursorName,
int[] expectedValues,
java.sql.Connection conn,
java.sql.Statement s) |
private static void |
resultSetQuery(java.lang.String expectedCursorName,
int[] expectedValues,
java.sql.ResultSet rs) |
private boolean |
selectTimesoutDuringUpdate(java.sql.Connection conn)
Determine if a select on this connection during update will timeout.
|
private static void |
setDatabaseProperty(java.lang.String property,
java.lang.String value) |
private void |
setHoldability(java.sql.Connection conn,
boolean hold) |
private static void |
setupDerby1144Table(java.sql.Connection conn)
insert two rows into the simple table for DERBY-1144 tests
|
private void |
subtestCloseEventWithNullListener(javax.sql.PooledConnection pc)
Test that notification of a close event doesn't fail when the
listener is null.
|
private void |
subTestDataSourceDescription(javax.sql.DataSource ds)
Utility method for testing setting and fetching the description
property on a data source.
|
private void |
subtestErrorEventWithNullListener(javax.sql.PooledConnection pc)
Test that notification of an error event doesn't fail when the
listener is null.
|
private void |
subtestPooledAddListenerOnClose(javax.sql.PooledConnection pc)
Tests that a listener of a pooled connection can successfully add
another listener when processing a close event.
|
private void |
subtestPooledCloseOnClose(javax.sql.PooledConnection pc)
Tests that a pooled connection can successfully be closed
during the processing of its close event by its listener.
|
private void |
subtestPooledRemoveListenerOnClose(javax.sql.PooledConnection pc)
Tests that a listener of a pooled connection can successfully
remove itself during the processing of its close event by its listener.
|
private void |
subtestPooledReuseOnClose(javax.sql.PooledConnection pc)
Tests that a pooled connection can successfully be reused
(a new connection obtained from it) during the processing
of its close event by its listener.
|
static junit.framework.Test |
suite() |
void |
tearDown()
Tear down this fixture, sub-classes should call
super.tearDown().
|
void |
testAllDataSources() |
void |
testAutoCommitOnXAResourceStart() |
void |
testBadConnectionAttributeSyntax() |
void |
testClientDSConnectionAttributes()
Check that database name set using setConnectionAttributes is not used
by ClientDataSource.
|
void |
testClientMessageTextConnectionAttribute()
Check that messageText connection attribute functions correctly.
|
void |
testClientTraceFileDSConnectionAttribute()
Check that traceFile connection attribute functions correctly.
|
void |
testCloseActiveConnection_CP()
Test that connections retrieved from
ConnectionPoolDataSource
behave as expected when close() is called and the transaction is
active. |
void |
testCloseActiveConnection_DS()
Test that connections retrieved from
DataSource behave as
expected when close() is called and the transaction is active. |
void |
testCloseActiveConnection_XA_global()
Test that connections retrieved from
XADataSource that are part
of a global XA transaction, behave as expected when close() is
called and the transaction is active. |
void |
testCloseActiveConnection_XA_local()
Test that connections retrieved from
XADataSource that are not
part of a global XA transaction, behave as expected when close()
is called and the transaction is active. |
private void |
testCloseActiveConnection(java.sql.Connection c,
boolean autoCommit,
boolean global)
Test that
Connection.close() behaves as expected when the
transaction is active (DERBY-3319). |
void |
testClosedCPDSConnection() |
void |
testClosedXADSConnection() |
void |
testConnectionErrorEvent()
Test case for DERBY-3172
When the Derby engine is shutdown or Network Server is brought down, any
api on JDBC Connection object should generate a Connection error event.
|
void |
testConnectionEventListenerIsNull()
Test that event notification doesn't fail when a null listener has
been registered (DERBY-3307).
|
void |
testConnectionFlowCommit()
check whether commit without statement will flow by checking its transaction id
on client.
|
void |
testConnectionFlowCommitAlt()
Alternative test for making sure "redundant" commits, i.e. commits
invoked when no transaction is in progress, don't result in a commit
command being flowed to the server.
|
private int |
testConnectionFlowCommitRollback(java.lang.Object ds,
boolean invokeExtra,
boolean isCommit)
Performs a test sequence accessing the server, then parses the client
connection trace file to obtain the number of commit or rollback
commands flowed from the client to the server.
|
private void |
testConnectionFlowCommitWork(java.sql.Connection conn)
Doing the work for test Connection.flowcommit() and Connection.flowrollback()
|
void |
testConnectionFlowRollbackAlt()
Alternative test for making sure "redundant" rollbacks, i.e. rollbacks
invoked when no transaction is in progress, don't result in a rollback
command being flowed to the server.
|
void |
testConnectionLeakInDatabaseMetaData()
Tests that DatabaseMetaData.getConnection does not leak references to
physical connections or other logical connections.
|
void |
testCreateInDatabaseName_DS()
Test that a connection to JDBCDataSource can be established
successfully while creating a database using setDatabaseName()
with create=true
|
void |
testCreateInDatabaseName_Pooled()
Test that a connection to PoolDataSource can be established
successfully while creating a database using setDatabaseName()
with create=true
|
void |
testCreateInDatabaseName_XA()
Test that a connection to XADataSource can be established
successfully while creating a database using setDatabaseName()
with create=true
|
void |
testDerby2026LoginTimeout()
DERBY-2026 - Make sure login timeout does not impact
queries.
|
void |
testDerby3799()
Regression test for a NullPointerException when trying to use the LOB
stored procedures after closing and then getting a new logical
connection.
|
void |
testDescriptionProperty()
Check that messageText connection attribute functions correctly.
|
void |
testDSRequestAuthentication() |
void |
testGlobalLocalInterleaf() |
void |
testIsolationWithFourConnections()
Check setTransactioIsolation and with four connection in connection pool
for DERBY-4343 case
|
void |
testJira95pds() |
void |
testJira95xads() |
void |
testPooledReuseOnClose()
Test that a PooledConnection can be reused and closed
(separately) during the close event raised by the
closing of its logical connection.
|
void |
testReadOnlyToWritableTran() |
void |
testReuseAcrossGlobalLocal() |
void |
testSchemaIsReset()
Verifies that the schema is reset when creating a new logical connection.
|
void |
testSchemaIsResetWhenDeleted()
Tests that deleting the current / default schema doesn't cause the next
logical connection to fail.
|
void |
testSetIsolationWithStatement() |
void |
testSetSchemaInXAConnection() |
void |
testXAHoldability() |
void |
timeoutTestDerby1144PooledDS()
Tests for DERBY-1144
This test tests that holdability, autocomit, and transactionIsolation
are reset on getConnection for PooledConnections obtaind from
connectionPoolDataSources
DERBY-1134 has been filed for more comprehensive testing of client
connection state.
|
void |
timeoutTestDerby1144XADS() |
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeast
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, toString
private static final java.lang.String dbName
protected static java.util.Hashtable<java.lang.String,java.sql.Connection> conns
private static final java.lang.String CONNSTRING_FORMAT
private final java.lang.Object nogc
private static junit.framework.Test getTimeoutSuite(java.lang.String postfix)
postfix
- suite name postfixprivate static junit.framework.Test baseSuite(java.lang.String postfix)
postfix
- suite name postfixprivate static junit.framework.Test getClientSuite()
private static junit.framework.Test getEmbeddedSuite(java.lang.String postfix)
postfix
- suite name postfixpublic static junit.framework.Test suite()
public void tearDown() throws java.lang.Exception
BaseJDBCTestCase
tearDown
in class BaseJDBCTestCase
java.lang.Exception
public void testConnectionErrorEvent() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void testConnectionEventListenerIsNull() throws java.sql.SQLException
java.sql.SQLException
private void subtestCloseEventWithNullListener(javax.sql.PooledConnection pc) throws java.sql.SQLException
java.sql.SQLException
private void subtestErrorEventWithNullListener(javax.sql.PooledConnection pc) throws java.sql.SQLException
java.sql.SQLException
private void testCloseActiveConnection(java.sql.Connection c, boolean autoCommit, boolean global) throws java.sql.SQLException
Connection.close()
behaves as expected when the
transaction is active (DERBY-3319).c
- the connection to testautoCommit
- the expected auto-commit value. When auto-commit is
on, close()
shouldn't fail when the transaction is active.global
- tells whether the connection is part of a global XA
transaction. If it is, close()
shouldn't fail, since the
transaction can be finished later without using the connection.java.sql.SQLException
public void testCloseActiveConnection_DS() throws java.sql.SQLException
DataSource
behave as
expected when close()
is called and the transaction is active.java.sql.SQLException
public void testCloseActiveConnection_CP() throws java.sql.SQLException
ConnectionPoolDataSource
behave as expected when close()
is called and the transaction is
active.java.sql.SQLException
public void testCloseActiveConnection_XA_local() throws java.sql.SQLException
XADataSource
that are not
part of a global XA transaction, behave as expected when close()
is called and the transaction is active.java.sql.SQLException
public void testCloseActiveConnection_XA_global() throws java.sql.SQLException, javax.transaction.xa.XAException
XADataSource
that are part
of a global XA transaction, behave as expected when close()
is
called and the transaction is active.java.sql.SQLException
javax.transaction.xa.XAException
public void testCreateInDatabaseName_XA() throws java.sql.SQLException, javax.transaction.xa.XAException
java.sql.SQLException
javax.transaction.xa.XAException
public void testCreateInDatabaseName_Pooled() throws java.sql.SQLException
java.sql.SQLException
public void testCreateInDatabaseName_DS() throws java.sql.SQLException
java.sql.SQLException
public void testPooledReuseOnClose() throws java.sql.SQLException
java.sql.SQLException
private void subtestPooledReuseOnClose(javax.sql.PooledConnection pc) throws java.sql.SQLException
java.sql.SQLException
private void subtestPooledCloseOnClose(javax.sql.PooledConnection pc) throws java.sql.SQLException
java.sql.SQLException
private void subtestPooledRemoveListenerOnClose(javax.sql.PooledConnection pc) throws java.sql.SQLException
java.sql.SQLException
private void subtestPooledAddListenerOnClose(javax.sql.PooledConnection pc) throws java.sql.SQLException
java.sql.SQLException
public void testAllDataSources() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void testClosedCPDSConnection() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void testClosedXADSConnection() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void testGlobalLocalInterleaf() throws java.sql.SQLException, javax.transaction.xa.XAException
java.sql.SQLException
javax.transaction.xa.XAException
public void testSetIsolationWithStatement() throws java.sql.SQLException, javax.transaction.xa.XAException
java.sql.SQLException
javax.transaction.xa.XAException
public void testReuseAcrossGlobalLocal() throws java.sql.SQLException, javax.transaction.xa.XAException
java.sql.SQLException
javax.transaction.xa.XAException
public void testSetSchemaInXAConnection() throws java.sql.SQLException
java.sql.SQLException
public void testSchemaIsReset() throws java.sql.SQLException
The test is run in a non-statement pooling configuration first, and then with statement pooling enabled if the environment supports it.
Relevant Jira issue: DERBY-3690.
The current role also needs to be reset, but can't be tested here since we need to run with SQL authorization.
java.sql.SQLException
- if something goes wrongRolesTest.testCurrentRoleIsReset()
private void doTestSchemaIsReset(javax.sql.PooledConnection pc, java.lang.String userSchema) throws java.sql.SQLException
pc
- pooled connection to get logical connections fromuserSchema
- name of the default schema for the connection (user)java.sql.SQLException
- if something goes wrong...public void testSchemaIsResetWhenDeleted() throws java.sql.SQLException
Relevant Jira issue: DERBY-3690.
java.sql.SQLException
- if something goes wrongpublic void testConnectionFlowCommit() throws java.sql.SQLException
java.sql.SQLException
public void testDerby2026LoginTimeout() throws java.sql.SQLException
java.sql.SQLException
private void testConnectionFlowCommitWork(java.sql.Connection conn) throws java.sql.SQLException
conn
- java.sql.SQLException
public void testConnectionFlowRollbackAlt() throws java.io.IOException, java.sql.SQLException
java.io.IOException
- if reading/parsing the trace file failsjava.sql.SQLException
- if something goes wrongpublic void testConnectionFlowCommitAlt() throws java.io.IOException, java.sql.SQLException
java.io.IOException
- if reading/parsing the trace file failsjava.sql.SQLException
- if something goes wrongprivate int testConnectionFlowCommitRollback(java.lang.Object ds, boolean invokeExtra, boolean isCommit) throws java.io.IOException, java.sql.SQLException
ds
- data source used to obtain a connection to the database
(must be using the test framework defaults)invokeExtra
- if true
extra invocations of either commit or
rollback are performed (depending on value of isCommit
)isCommit
- if true
, commits are invoked, otherwise
rollbacks are invokedisCommit
).java.io.IOException
- if reading/parsing the trace file failsjava.sql.SQLException
- if something goes wrongprivate void endTranscation(java.sql.Connection con, boolean isCommit, int count) throws java.sql.SQLException
con
- the connection to work onisCommit
- if true
commit is invoked, otherwise rollback
is invokedcount
- the number of extra commits or rollbacks to invokejava.sql.SQLException
- if a commit/rollback failspublic void testIsolationWithFourConnections() throws java.sql.SQLException
java.sql.SQLException
public void testAutoCommitOnXAResourceStart() throws java.sql.SQLException, javax.transaction.xa.XAException
java.sql.SQLException
javax.transaction.xa.XAException
public void testReadOnlyToWritableTran() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void testJira95pds() throws java.lang.Exception
java.lang.Exception
public void testJira95xads() throws java.sql.SQLException
java.sql.SQLException
public void testBadConnectionAttributeSyntax() throws java.sql.SQLException
java.sql.SQLException
public void testClientDSConnectionAttributes() throws java.sql.SQLException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
java.sql.SQLException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
public void testDSRequestAuthentication() throws java.lang.Exception
java.lang.Exception
public void testClientTraceFileDSConnectionAttribute() throws java.sql.SQLException
This is also a regression test for DERBY-4717.
java.sql.SQLException
private static void assertTraceFilesExistAndCanBeDeleted()
public void testClientMessageTextConnectionAttribute() throws java.sql.SQLException, java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
java.sql.SQLException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
private static void assertMessageText(java.sql.Connection conn, java.lang.String retrieveMessageTextValue) throws java.sql.SQLException
conn
- the connection to use, will be closedretrieveMessageTextValue
- the current valuejava.sql.SQLException
- if something goes wrongpublic void testDescriptionProperty() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
java.lang.Exception
private void subTestDataSourceDescription(javax.sql.DataSource ds) throws java.lang.Exception
java.lang.Exception
public void testXAHoldability() throws java.sql.SQLException, javax.transaction.xa.XAException
java.sql.SQLException
javax.transaction.xa.XAException
public void testConnectionLeakInDatabaseMetaData() throws java.sql.SQLException
java.sql.SQLException
- if something goes wrongpublic void testDerby3799() throws java.sql.SQLException
java.sql.SQLException
public void timeoutTestDerby1144PooledDS() throws java.sql.SQLException
java.sql.SQLException
public void timeoutTestDerby1144XADS() throws java.sql.SQLException
java.sql.SQLException
private static void assertPooledConnAutoCommit(java.lang.String desc, javax.sql.PooledConnection pc1) throws java.sql.SQLException
desc
- description of connectionpc1
- pooled connection to testjava.sql.SQLException
private static void assertPooledConnHoldability(java.lang.String desc, javax.sql.PooledConnection pc1) throws java.sql.SQLException
desc
- pc1
- java.sql.SQLException
private static void assertConnHoldability(java.sql.Connection conn, int expectedHoldability) throws java.sql.SQLException
conn
- expectedHoldability
- * @throws SQLExceptionjava.sql.SQLException
private void assertPooledConnIso(java.lang.String pooledConnType, javax.sql.PooledConnection pc) throws java.sql.SQLException
pooledConnType
- Descripiton of the type of pooled connectionpc
- PooledConnection or XAConnectionjava.sql.SQLException
private static void setupDerby1144Table(java.sql.Connection conn) throws java.sql.SQLException
conn
- java.sql.SQLException
private void assertIsoLocks(java.sql.Connection conn, int expectedIsoLevel) throws java.sql.SQLException
conn
- Connection to testexpectedIsoLevel
- expected isolation leveljava.sql.SQLException
private boolean selectTimesoutDuringUpdate(java.sql.Connection conn) throws java.sql.SQLException
Connection.TRANSACTION_READ_UNCOMMITTED
it will not
timeout. Otherwise it should.conn
- Connection to test.java.sql.SQLException
private void assertConnectionState(int expectedHoldability, int expectedIsolation, boolean expectedCommitSetting, boolean expectedReadOnly, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
private static void setDatabaseProperty(java.lang.String property, java.lang.String value) throws java.sql.SQLException
java.sql.SQLException
private void setHoldability(java.sql.Connection conn, boolean hold) throws java.sql.SQLException
java.sql.SQLException
private static void dsConnectionRequests(java.lang.String[] expectedValues, javax.sql.DataSource ds)
private static void dsConnectionRequest(java.lang.String expectedValue, javax.sql.DataSource ds, java.lang.String user, java.lang.String ConnAttr)
private static void dsCPConnectionRequests(java.lang.String[] expectedValues, javax.sql.ConnectionPoolDataSource ds)
private static void dsConnectionRequest(java.lang.String expectedValue, javax.sql.ConnectionPoolDataSource ds, java.lang.String user, java.lang.String ConnAttr)
private static void dsXAConnectionRequests(java.lang.String[] expectedValues, javax.sql.XADataSource ds)
private static void dsConnectionRequest(java.lang.String expectedValue, javax.sql.XADataSource ds, java.lang.String user, java.lang.String ConnAttr)
protected void assertXAException(java.lang.String tag, javax.transaction.xa.XAException xae)
private static void queryOnStatement(java.lang.String expectedCursorName, int[] expectedValues, java.sql.Connection conn, java.sql.Statement s) throws java.sql.SQLException
java.sql.SQLException
private static void resultSetQuery(java.lang.String expectedCursorName, int[] expectedValues, java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
private static void assertLocks(int[] expectedValues, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
private void assertStatementState(int[] parameterExpectedValues, int[] expectedValues, java.sql.Statement s) throws java.sql.SQLException
java.sql.SQLException
private java.sql.Statement createFloatStatementForStateChecking(int[] StatementExpectedValues, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
private java.sql.Statement internalCreateFloatStatementForStateChecking(java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
private java.sql.PreparedStatement createFloatStatementForStateChecking(int[] parameterExpectedValues, int[] PreparedStatementExpectedValues, java.sql.Connection conn, java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
private java.sql.PreparedStatement internalCreateFloatStatementForStateChecking(java.sql.Connection conn, java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
private java.sql.CallableStatement createFloatCallForStateChecking(int[] parameterExpectedValues, int[] CallableStatementExpectedValues, java.sql.Connection conn, java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
private java.sql.CallableStatement internalCreateFloatCallForStateChecking(java.sql.Connection conn, java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
private void assertConnectionOK(java.lang.Object[] expectedValues, java.lang.String dsName, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
private void assertConnectionPreClose(java.lang.String dsName, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
private void assertStatementOK(java.lang.String dsName, java.sql.Connection conn, java.sql.Statement s) throws java.sql.SQLException
java.sql.SQLException
private static void PoolReset(java.lang.String type, javax.sql.PooledConnection pc) throws java.sql.SQLException
java.sql.SQLException
private static void PoolResetWork(java.lang.String expectedID, java.lang.String tableAction, java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
private static void assertToString(java.sql.Connection conn) throws java.lang.Exception
java.lang.Exception
private static void assertStringFormat(javax.sql.PooledConnection pc) throws java.lang.Exception
java.lang.Exception
private static void assertStringFormat(java.sql.Connection conn)
private static java.lang.String assertStringPrefix(java.lang.Object conn)
private static void assertToString(javax.sql.DataSource ds) throws java.lang.Exception
java.lang.Exception
private static void clearConnections() throws java.sql.SQLException
java.sql.SQLException
private void assertTenConnectionsUnique() throws java.lang.Exception
java.lang.Exception
private static void assertToString(javax.sql.XADataSource xds) throws java.lang.Exception
java.lang.Exception
private static void assertToString(javax.sql.ConnectionPoolDataSource pds) throws java.lang.Exception
java.lang.Exception
private static java.lang.String getNestedMethodName()
public static void checkNesConn(java.lang.String dsName) throws java.sql.SQLException
java.sql.SQLException
public static java.lang.Object getPhysicalConnection(java.lang.Object ds) throws java.sql.SQLException
For a XADataSource, getXAConnection is invoked, for a ConnectionPoolDataSource getPooledConnection is invoked, and for a DataSource getConnection is invoked.
ds
- the data source to get the physical connection fromjava.sql.SQLException
- if getting a connection failsjava.lang.IllegalArgumentException
- if the object isn't a data sourceApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.