db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepa Remesh (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-950) Add information to testing/README.htm about how to get connections in tests
Date Thu, 30 Mar 2006 14:17:29 GMT
    [ http://issues.apache.org/jira/browse/DERBY-950?page=comments#action_12372446 ] 

Deepa Remesh commented on DERBY-950:

Please see if following content is okay to be added to the testing readme file:

How to get database connections in tests:

When getting database connections inside tests, it is recommended to use the following methods:

* ij.startJBMS:
This method gets a connection based on the  system properties and properties specified in
the test properties file (<test>_app.properties). If ij.dataSource property is set,
this method uses javax.sql.DataSource class to get the connection. If ij.dataSource property
is not set, this method uses java.sql.DriverManager for connection. Unless a test needs to
specifically test a particular method to get connection, it is recommended to use ij.startJBMS
method and specify the properties like database name, connection attributes etc in <test_name>_app.properties

NOTE: Use ij.database and ij.protocol properties instead of the deprecated database and protocol
properties to allow the test to run in J2ME/CDC/Foundation profile with JSR169. This is because
test harness removes ij.database and ij.protocol propeties when the test is launched with
ij.dataSource property and thus allows the test to run with JSR169. 

* TestUtil.getConnection:
If a test needs a connection (usually a subsequent connection) which needs to use a different
set of properties than what is specified in <test_name>_app.properties, the method TestUtil.getConnection
can be used. For e.g, this method can be used to shutdown a database or recover a database
by specifying the relevant connection atributes.

> Add information to testing/README.htm about how to get connections in tests
> ---------------------------------------------------------------------------
>          Key: DERBY-950
>          URL: http://issues.apache.org/jira/browse/DERBY-950
>      Project: Derby
>         Type: Test
>   Components: Test
>     Versions:
>     Reporter: Deepa Remesh
>     Priority: Minor
>      Fix For:

> Currently testing/README.htm has a section "Adding a new test". Add a sub-section to
describe how to get connections inside tests so that the test can run in different frameworks/environments.

> Also it would be good to describe use of properties like ij.database and ij.dataSource.
These are already documented/planned to be documented in Derby Tools and Utilities guide but
I think it would be useful to have an overview in the readme file about how to use these properties
when writing tests. 

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message