Hi Amy,

There are a few options. You could create a separate persistence-unit for
your database and specify the connection information in the persistence unit
(this is better for embeddable dbs like Derby). If it's not something you
can assume other devs have you'll probably want to go with another route.

The junit test suite picks up the database configuration from jvm arguments
that you pass in on the command line or through a maven profile. To use one
of the built in profiles you could do something like this :
$ mvn -Ptest-derby -Dtest=${specific testcase name} test
$ mvn -Ptest-mysql -Dtest=${specific testcase name} test

Insert the testcase name for ${specific testcase name} and these examples
will run one specific test against derby or mysql respectively. Note that
you'll need to set a few other properties to indicate the location of your
mysql database, but it should get you started.

If we don't have a built in profile (check openjpa-persistence-jdbc/pom.xml
for the list) then you'll have to create one or set the properties manually.
For example (using oracle)  :
mvn test -Dtest=TestPersistence -Ptest-custom

-Dopenjpa.custom.driverjar=$(pwd)/drivers/jdbc-oracle-10_2_0_1_0.jar
          -Dopenjpa.custom.driverclass=oracle.jdbc.driver.OracleDriver
          -Dopenjpa.custom.url=jdbc:oracle:thin:@HOST:PORT:DBNAME
          -Dopenjpa.custom.username=USERNAME
          -Dopenjpa.custom.password=PASSWORD

The example runs the TestPersistence testcase against whatever database you
indicate in the openjpa-custom.xxx properties.

Hope this helps,
-mike



On Mon, Mar 30, 2009 at 8:20 PM, Amy Yang <milo...@gmail.com> wrote:

> Hi All,I found a Database specific problem recently.
> To run test for the fix, I think it would be good to run our test cases on
> a
> specific Database.
> Does anyone know if Oracle is available in Teamcity? Is it possible to
> target one test of the entire run to a specific database?
>
>
> Thanks,
> Amy
>

Reply via email to