| org.apache.derbyTesting.junit.BaseTestCase org.apache.derbyTesting.junit.BaseJDBCTestCase
All known Subclasses: org.apache.derbyTesting.functionTests.tests.derbynet.ShutDownDBWhenNSShutsDownTest, org.apache.derbyTesting.functionTests.tests.perf.StartupNewDBTest, org.apache.derbyTesting.functionTests.tests.jdbc4.CallableStatementTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.DataSourcePropertiesTest, org.apache.derbyTesting.functionTests.tests.jdbc4.ParameterMetaDataWrapperTest, org.apache.derbyTesting.functionTests.tests.tools.sysinfo_api, org.apache.derbyTesting.functionTests.tests.jdbcapi.URCoveringIndexTest, org.apache.derbyTesting.functionTests.tests.jdbc4.RowIdNotImplementedTest, org.apache.derbyTesting.functionTests.tests.jdbc4.UnsupportedVetter, org.apache.derbyTesting.functionTests.tests.store.BootAllTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.ProcedureTest, org.apache.derbyTesting.functionTests.tests.jdbc4.AutoloadBooting, org.apache.derbyTesting.functionTests.tests.jdbc4.ClosedObjectTest, org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest, org.apache.derbyTesting.functionTests.tests.jdbc4.AutoloadTest, org.apache.derbyTesting.functionTests.util.CanonTestCase, org.apache.derbyTesting.functionTests.tests.jdbc4.PreparedStatementTest, org.apache.derbyTesting.functionTests.tests.tools.IJRunScriptTest, org.apache.derbyTesting.functionTests.tests.lang.VTITest, org.apache.derbyTesting.functionTests.tests.jdbc4.VerifySignatures, org.apache.derbyTesting.functionTests.tests.perf.StartupExistingDBTest, org.apache.derbyTesting.functionTests.tests.jdbc4.ResultSetTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.ScrollResultSetTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.UpdateXXXTest, org.apache.derbyTesting.functionTests.tests.jdbc4.SetObjectUnsupportedTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.BLOBTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.UpdatableResultSetTest, org.apache.derbyTesting.functionTests.tests.lang.GroupByExpressionTest, org.apache.derbyTesting.functionTests.tests.derbynet.SuicideOfStreaming, org.apache.derbyTesting.functionTests.tests.jdbc4.StatementTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.SURBaseTest, org.apache.derbyTesting.functionTests.tests.lang.MathTrigFunctionsTest, org.apache.derbyTesting.functionTests.tests.jdbc4.DataSourceTest, org.apache.derbyTesting.functionTests.tests.jdbc4.StatementEventsTest, org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen, org.apache.derbyTesting.functionTests.tests.lang.PrepareExecuteDDL, org.apache.derbyTesting.functionTests.tests.jdbc4.XA40Test, org.apache.derbyTesting.functionTests.tests.lang.SQLAuthorizationPropTest, org.apache.derbyTesting.functionTests.tests.jdbc4.ResultSetMetaDataTest, org.apache.derbyTesting.functionTests.tests.jdbc4.ConnectionTest, org.apache.derbyTesting.functionTests.tests.jdbcapi.ResultSetCloseTest,
BaseJDBCTestCase | abstract public class BaseJDBCTestCase extends BaseTestCase (Code) | | Base class for JDBC JUnit tests.
A method for getting a default connection is provided, along with methods
for telling if a specific JDBC client is used.
|
Method Summary | |
public void | assertCompileError(String sqlState, String query) Assert that the query does not compile and throws
a SQLException with the expected state. | public static void | assertEquals(Blob b1, Blob b2) Assert equality between two Blob objects.
If both input references are null , they are considered
equal. | public static void | assertEquals(Clob c1, Clob c2) Assert equality between two Clob objects.
If both input references are null , they are considered
equal. | public static void | assertSQLState(String message, String expected, SQLException exception) Assert that SQLState is as expected. | public static void | assertSQLState(String expected, SQLException exception) Assert that SQLState is as expected. | public void | commit() Utility method to commit using the connection
returned by getConnection. | public Statement | createStatement() Utility method to create a Statement using the connection
returned by getConnection. | public Statement | createStatement(int resultSetType, int resultSetConcurrency) Utility method to create a Statement using the connection
returned by getConnection. | public Connection | getConnection() Obtain the connection to the default database.
This class maintains a single connection returned
by this class, it is opened on the first call to
this method. | public Connection | getConnection(String databaseName, String connAttrs) Get a connection to a database using the specified connection
attributes. | public Connection | getDefaultConnection(String connAttrs) Get a connection to the default database using the specified connection
attributes. | protected void | initializeConnection(Connection conn) Allow a sub-class to initialize a connection to provide
consistent connection state for its tests. | public Connection | openConnection(String databaseName) | public Connection | openDefaultConnection() Open a connection to the default database. | public CallableStatement | prepareCall(String sql) Utility method to create a CallableStatement using the connection
returned by getConnection. | public PreparedStatement | prepareStatement(String sql) Utility method to create a PreparedStatement using the connection
returned by getConnection. | public void | rollback() Utility method to rollback using the connection
returned by getConnection. | public int | runSQLCommands(String sqlCommands) Run a set of SQL commands from a String discarding the output.
Commands are separated by a semi-colon. | public int | runScript(InputStream script, String encoding) Run a SQL script through ij discarding the output
using this object's default connection. | protected void | tearDown() Tear down this fixture, sub-classes should call
super.tearDown(). | public static boolean | usingDerbyNet() Tell if the client is DerbyNet. | public static boolean | usingDerbyNetClient() Tell if the client is DerbyNetClient. | public static boolean | usingEmbedded() Tell if the client is embedded. |
BaseJDBCTestCase | public BaseJDBCTestCase(String name)(Code) | | Create a test case with the given name.
Parameters: name - of the test case. |
assertCompileError | public void assertCompileError(String sqlState, String query)(Code) | | Assert that the query does not compile and throws
a SQLException with the expected state.
Parameters: sqlstate - expected sql state. Parameters: query - the query to compile. |
assertEquals | public static void assertEquals(Blob b1, Blob b2) throws IOException, SQLException(Code) | | Assert equality between two Blob objects.
If both input references are null , they are considered
equal. The same is true if both blobs have null -streams.
Parameters: b1 - first Blob . Parameters: b2 - second Blob . throws: AssertionFailedError - if blobs are not equal. throws: IOException - if reading or closing a stream fails throws: SQLException - if obtaining a stream fails |
assertEquals | public static void assertEquals(Clob c1, Clob c2) throws IOException, SQLException(Code) | | Assert equality between two Clob objects.
If both input references are null , they are considered
equal. The same is true if both clobs have null -streams.
Parameters: c1 - first Clob . Parameters: c2 - second Clob . throws: AssertionFailedError - if clobs are not equal. throws: IOException - if reading or closing a stream fails throws: SQLException - if obtaining a stream fails |
assertSQLState | public static void assertSQLState(String message, String expected, SQLException exception)(Code) | | Assert that SQLState is as expected.
Parameters: message - message to print on failure. Parameters: expected - the expected SQLState. Parameters: exception - the exception to check the SQLState of. |
assertSQLState | public static void assertSQLState(String expected, SQLException exception)(Code) | | Assert that SQLState is as expected.
Parameters: expected - the expected SQLState. Parameters: exception - the exception to check the SQLState of. |
createStatement | public Statement createStatement() throws SQLException(Code) | | Utility method to create a Statement using the connection
returned by getConnection.
Statement object from getConnection.createStatement() throws: SQLException - |
createStatement | public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException(Code) | | Utility method to create a Statement using the connection
returned by getConnection.
Statement object fromgetConnection.createStatement(resultSetType, resultSetConcurrency) throws: SQLException - |
getConnection | public Connection getConnection() throws SQLException(Code) | | Obtain the connection to the default database.
This class maintains a single connection returned
by this class, it is opened on the first call to
this method. Subsequent calls will return the same
connection object unless it has been closed. In that
case a new connection object will be returned.
The tearDown method will close the connection if
it is open.
See Also: TestConfiguration.openDefaultConnection |
getConnection | public Connection getConnection(String databaseName, String connAttrs) throws SQLException(Code) | | Get a connection to a database using the specified connection
attributes.
Parameters: databaseName - database to connect to Parameters: connAttrs - connection attributes connection to database throws: SQLException - |
getDefaultConnection | public Connection getDefaultConnection(String connAttrs) throws SQLException(Code) | | Get a connection to the default database using the specified connection
attributes.
Parameters: connAttrs - connection attributes connection to default database. throws: SQLException - |
initializeConnection | protected void initializeConnection(Connection conn) throws SQLException(Code) | | Allow a sub-class to initialize a connection to provide
consistent connection state for its tests. Called once
for each time these method calls open a connection:
- getConnection()
- openDefaultConnection()
- openConnection(database)
- getDefaultConnection(String connAttrs)
- getConnection(String databaseName, String connAttrs)
when getConnection() opens a new connection. Default
action is to not modify the connection's state from
the initialization provided by the data source.
Parameters: conn - Connection to be intialized throws: SQLException - Error setting the initial state. |
prepareStatement | public PreparedStatement prepareStatement(String sql) throws SQLException(Code) | | Utility method to create a PreparedStatement using the connection
returned by getConnection.
Statement object fromgetConnection.prepareStatement(sql) throws: SQLException - |
rollback | public void rollback() throws SQLException(Code) | | Utility method to rollback using the connection
returned by getConnection.
throws: SQLException - |
tearDown | protected void tearDown() throws java.lang.Exception(Code) | | Tear down this fixture, sub-classes should call
super.tearDown(). This cleanups & closes the connection
if it is open.
|
usingDerbyNet | public static boolean usingDerbyNet()(Code) | | Tell if the client is DerbyNet.
true if using the DerbyNet clientfalse otherwise. |
usingDerbyNetClient | public static boolean usingDerbyNetClient()(Code) | | Tell if the client is DerbyNetClient.
true if using the DerbyNetClient clientfalse otherwise. |
usingEmbedded | public static boolean usingEmbedded()(Code) | | Tell if the client is embedded.
true if using the embedded clientfalse otherwise. |
|
|