The Torque test project

The test project tests all aspects of the Torque main distribution and checks whether the different parts of Torque (runtime, generator, templates, maven-plugin) work together. The test project is almost a normal Torque project, with the following differences:

  • Instead of directly using the schema files from the src/main/schema directory, the schema files are copied to the directory target/torque/test/schema, and some tokens are replaced during copying. For the tests, the schema files from target/torque/test/schema with the replaced tokens are used.

Running the test project

In order to run the test project using maven 2, use the following procedure:

  • Check out the trunk containing the Torque modules from the svn repository.
  • Change into the each of the directories torque-runtime, torque-generator, torque-templates, torque-generator-maven-plugin and torque-ant-tasks and run the command mvn install in each of the directories (in the order above).
  • Change into the directory torque-test, and change one of the profiles in the file profiles.xml to match the database which you want to test against.
  • In the directory torque-test, run the command mvn -P${profile} clean test to run the test, replacing the variable ${profile} with the name of your chosen database profile.
    For example, if you want to test against mysql, run mvn -Pmysql clean test.

The standard database profiles do not generate managers and beans, nor do they execute the corresponding tests. For generating beans, activate the beans profile. This will generate the bean classes and run the corresponding test. For using manager classes, activate the managers profile. This will generate the manager classes and run the corresponding test.
For example, if you want to run the test against mysql and use beans and managers, run mvn -Pmysql,beans,managers clean test.

Running mvn eclipse:eclipse on the test project

Because dependency information is pulled from the profiles, you need to enable a profile from the profiles.xml for generating the eclipse files. Running mvn eclipse:eclipse without a profile will result in the following error:
org.apache.maven.reactor.MavenExecutionException: Failed to validate POM for project org.apache.torque:torque-test

The profile you choose will also pull the database driver from the profile into your eclipse project. E.G. if you want to use the mysql driver dependency in your eclipse project, run mvn -Pmysql eclipse:eclipse