The db-setup.sql script can be executed by simply calling build.sh
tests.
Before executing this build target you have to ensure that the
specified JDBC driver is added to the classpath property in the
build.xml file.
Some Jdbc drivers throw exception if "drop table" is
executed for non existing tables. Thus it is recommended to execute
build.sh tests twice to be
sure that there are no problems with the specific RDBMS and driver
setting.
repository.xml
Now that the necessary tables are added to your database we have
to prepare the OJB runtime environment to run against this rdbms.
This is done in the metadata repository
src/test/ojb/repository.xml.
By default it contains an active JdbcConnectionDescriptor for the
internal HSQLDB database:
<JdbcConnectionDescriptor id="default">
<dbms.name>hsql</dbms.name>
<driver.name>org.hsqldb.jdbcDriver</driver.name>
<url.protocol>jdbc</url.protocol>
<url.subprotocol>hsqldb</url.subprotocol>
<!--url.dbalias>../OJB</url.dbalias-->
<url.dbalias>ojb/build/test/OJB</url.dbalias>
<user.name>sa</user.name>
<user.passwd></user.passwd>
</JdbcConnectionDescriptor>
The repository contains outcommented entries for a variety of
other RDBMS. To activate the above mentioned MS Access database you
have to:
- comment out the hsqldb entry (using xml comments:
<!--
--> ).
- uncomment the MS Access entry and edit it to point to the
specific DSN:
<JdbcConnectionDescriptor id="default">
<dbms.name>MS ACCESS</dbms.name>
<jdbc.level>1.0</jdbc.level>
<driver.name>sun.jdbc.odbc.JdbcOdbcDriver</driver.name>
<url.protocol>jdbc</url.protocol>
<url.subprotocol>odbc</url.subprotocol>
<url.dbalias>MY_DB</url.dbalias>
</JdbcConnectionDescriptor>
check the installation
Now everything is setup to run the junit regression tests against
your target database.
Execute build.sh junit to if everything works as expected. You
should see a console output as follows:
junit:
[junit] .[BOOT]INFO: OJB.properties:file:/home/tom/ojb/build/test/ojb/OJB.properties
[junit]........................................
[junit] .
[junit] Time: 4,29
[junit]
[junit] OK (42 tests)
[junit]
[junit] [BOOT] INFO: OJB.properties:file:/home/tom/ojb/build/test/ojb/OJB.properties
[junit].........................................
[junit].........................................
[junit] .......
[junit] Time: 7,159
[junit]
[junit] OK (89 tests)
[junit]
BUILD SUCCESSFUL
If the Junit tests report errors or failures something does not
work properly!
In such a case please check again if you followed all the above
steps. If you still have problems you might place a support request
at the OJB projects page at SourceForge
(http://sourceforge.net/tracker/?group_id=13647&atid=213647).