Hibernate.orgCommunity Documentation

Chapter 3. Installation

3.1. Obtaining the Software
3.2. The TCK Environment

This chapter explains how to obtain the TCK and supporting software and provides recommendations for how to install/extract it on your system.

You can obtain a release of the Bean Validation TCK project via the official Bean Validation home page. The Bean Validation TCK is distributed as a ZIP file, which contains the TCK artifacts (the test suite binary and source, the test suite descriptor, the audit source and report), the TCK library dependencies in /lib and documentation in /doc.

You can also download the current source code from Github - https://github.com/beanvalidation/beanvalidation-tck.

The TCK project is available in the JBoss Maven 2 repository as org.hibernate.jsr303.tck:org.hibernate.jsr303.tck; the POM defines all dependencies required to run the TCK.

Executing the TCK requires a Java EE 5 or better runtime environment (i.e., application server), to which the test artifacts are deployed and the individual tests are invoked. The TCK does not depend on any particular Java EE implementation.

The JSR-303: Bean Validation reference implementation (RI) project is named Hibernate Validator. You can obtain the latest Hibernate Validator release from the download page on Hibernate website.

Note

Hibernate Validator is not required for running the Bean Validation TCK, but it can be used as a reference for familiarizing yourself with the TCK before testing your own Bean Validation implementation.

The TCK requires the following two Java runtime environments:

You should refer to vendor instructions for how to install the runtime.

The rest of the TCK software can simply be extracted. It's recommended that you create a folder named jsr303 to hold all of the jsr303-related projects. Then, extract the TCK distribution into a subfolder named tck. You can also check out the full Hibernate Validator source into a subfolder ri. This will allow you to run the TCK against Hibernate Validator.

git clone git://github.com/hibernate/hibernate-validator.git ri
git checkout 4.2.0.Final

If you have downloaded the Hibernate Validator distribution, extract it into a sibling folder named hibernate-validator. The resulting folder structure is shown here:

jsr303/
   ri/
   tck/

Each test class is treated as an individual artifact (hence the @Artifact(artifactType = ArtifactType.JSR303) annotation on the class). All test methods (i.e., methods annotated with @Test) in the test class are run.

Running the TCK against the Bean Validation RI (Hibernate Validator) and JBoss AS 7

  • First, you should download the latest JBoss AS 7 release from the JBoss AS project page.

  • Set the JBOSS_HOME environment variable to the location of the JBoss AS software.

  • Change to the ri/hibernate-validator-tck-runner directory.

  • You need to install Maven. You can find documention on how to install Maven 2 in the Maven: The Definitive Guide book published by Sonatype. Web Beans bundles a copy of Maven in the lib/maven directory.

  • Next, instruct Maven to run the TCK:

    mvn test -Dincontainer
  • TestNG will report, via Maven, the outcome of the run, and report any failures on the console. Details can be found in target/surefire-reports/TestSuite.txt.