SeamFramework.orgCommunity Documentation

Chapter 3. Installation

3.1. Obtaining the Software
3.2. The TCK Environment
3.3. Eclipse Plugins
3.3.1. TestNG Plugin
3.3.2. Maven 2 Plugin (m2eclipse)

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 CDI TCK project from the from the download page on Seam Framework website. The CDI TCK is distributed as a ZIP file, which contains the TCK artifacts (the test suite binary and source, porting package API binary and source, the test suite descriptor, the audit source and report) in /artifacts, the TCK library dependencies in /lib and documentation in /lib.

You can also download the current source code from JBoss SVN repository.

The TCK project is available in the JBoss Maven 2 repository as org.jboss.jsr299.tck:jsr299-tck-impl; 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-299: Contexts and Dependency Injection for Java EE 1.0 reference implementation (RI) project is named Weld. You can obtain the latest release from the download page on Seam Framework website.

Note

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

Naturally, to execute Java programs, you must have a Java SE runtime environment. The TCK requires Java 5 or better, which you can obtain from the Java Software website.

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 jsr299 to hold all of the jsr299-related projects. Then, extract the TCK distribution into a subfolder named tck. If you have downloaded the Weld distribution, extract it into a sibling folder named weld. The resulting folder structure is shown here:

jsr299/
   weld/
   tck/

Each test class is treated as an individual artifact (hence the @Artifact annotation on the class). All test methods (i.e., methods annotated with @Test) in the test class are run in the application, meaning bean discovery occurs exactly once per artifact and the same BeanManager is used by each test method in the class.

Running the TCK against the CDI RI (Weld) and JBoss AS

JBoss AS 6.0.0 M1 and above releases bundle Weld. To run the TCK with JBoss AS, you must use JBoss AS 6.0.0.M1 or above.

To install JBoss AS 6:

  • First, you should download JBoss AS 6 from the JBoss AS project page.

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

  • Change to the weld directory in the TCK.

  • Create a file called local.build.properties in weld/jboss-as and make sure the jboss.home property references a JBoss AS 6.0 installation:

    jboss.home=/path/to/jboss-as-6.0

The CDI TCK includes a TCK runner that executes the TCK using Weld as the CDI implementation and JBoss AS as the Java EE runtime. To run the tck:

  • You need to install Maven 2.0.10. You can find documention on how to install Maven 2 in the Maven: The Definitive Guide book published by Sonatype.

  • Next, instruct Maven to run the TCK:

    cd weld/jboss-tck-runner
    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.

Eclipse, or any other IDE, is not required to execute or pass the TCK. However an implementor may wish to execute tests in an IDE to aid debugging the tests. This section introduces two essential Eclipse plugins, TestNG and Maven 2, and points you to resources explaining how to install them.

Another useful plugin is m2eclipse. Both the TCK project and are use Maven 2. Therefore, to work with these projects in Eclipse, you may wish to have native support for Maven 2 projects, which the m2eclipse plugin provides. Instructions for using the m2eclipse update site to add the m2eclipse plugin to Eclipse are provided on the m2eclipse home page. For more, read the m2eclipse reference guide.

m2eclipse is still a rather young project dealing with a complex domain and you may run into problems using it. If that is the case, you can alternatively use the Eclipse plugin for Maven 2 to generate native Eclipse projects from Maven 2 projects.

If you have Maven 2 installed, you have everything you need. Just execute the following command from any Maven 2 project to produce the Eclipse project files.

mvn eclipse:eclipse

Again, the Eclipse plugins are not required to execute the TCK, but can be very helpful when validating an implementation against the TCK test suite and especially when using the modules from the project.