public class DataSourceTest 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 |
---|
DataSourceTest(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 static void |
assertMessageText(java.sql.Connection conn,
java.lang.String retrieveMessageTextValue) |
private void |
assertStatementOK(java.lang.String dsName,
java.sql.Connection conn,
java.sql.Statement s) |
private static void |
assertStringFormat(java.sql.Connection conn)
Check the format of the connection string.
|
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.DataSource ds)
Check uniqueness of connection strings coming from a
DataSouce
|
private static void |
assertTraceFilesExist()
Check that trace file exists in
|
private static junit.framework.Test |
baseSuite(java.lang.String postfix)
Return a suite of tests that are run with both client and embedded
|
private static void |
clearConnections()
Clear out and close connections in the connections
hashtable.
|
private static void |
dsConnectionRequest(java.lang.String expectedValue,
javax.sql.DataSource ds,
java.lang.String user,
java.lang.String ConnAttr) |
private static void |
dsConnectionRequests(java.lang.String[] expectedValues,
javax.sql.DataSource ds) |
private static void |
dsGetBadConnection(javax.sql.DataSource ds) |
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 void |
setDatabaseProperty(java.lang.String property,
java.lang.String value) |
private void |
subTestDataSourceDescription(javax.sql.DataSource ds)
Utility method for testing setting and fetching the description
property on a data source.
|
static junit.framework.Test |
suite() |
void |
tearDown()
Tear down this fixture, sub-classes should call
super.tearDown().
|
void |
testAllDataSources() |
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 |
testDescriptionProperty()
Check that messageText connection attribute functions correctly.
|
void |
testDSRequestAuthentication() |
void |
testJira95ds() |
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 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 testAllDataSources() throws java.sql.SQLException, java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void testJira95ds() throws java.sql.SQLException
java.sql.SQLException
public void testBadConnectionAttributeSyntax() throws java.sql.SQLException
java.sql.SQLException
public void testClientDSConnectionAttributes() throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void testDSRequestAuthentication() throws java.sql.SQLException
java.sql.SQLException
public void testClientTraceFileDSConnectionAttribute() throws java.sql.SQLException
java.sql.SQLException
private static void dsGetBadConnection(javax.sql.DataSource ds)
private static void assertTraceFilesExist()
public void testClientMessageTextConnectionAttribute() throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
private static void assertMessageText(java.sql.Connection conn, java.lang.String retrieveMessageTextValue) throws java.sql.SQLException
java.sql.SQLException
public 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
private static void setDatabaseProperty(java.lang.String property, java.lang.String value) 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 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 assertToString(java.sql.Connection conn) 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
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.