CDI TCKCommunity Documentation

Chapter 4. Configuration

4.1. TCK Properties
4.2. Arquillian settings
4.3. The Porting Package
4.4. Using the CDI TCK with the Java EE Web Profile
4.5. Configuring TestNG to execute the TCK
4.6. Configuring your build environment to execute the TCK
4.7. Configuring your application server to execute the TCK

This chapter lays out how to configure the TCK Harness by specifying the SPI implementation classes, defining the target container connection information, and various other switches. You then learn how to setup a TCK runner project that executes the TCK test suite, putting these settings into practice.

System properties and/or the resource META-INF/cdi-tck.properties, a Java properties file, are used to configure the TCK.

You should set the following required properties:



The Arquillian testing platform will look for configuration settings in a file named arquillian.xml in the root of your classpath. If it exists it will be auto loaded, else default values will be used. This file is not a requirement however it’s very useful for container configuration. See an example configuration for JBoss TCK runner:

        weld/jboss-tck-runner/src/test/wildfly8/arquillian.xml

The CDI TCK relies on an implementation of the porting package to function. There are times when the tests need to tap directly into the CDI implementation to manipulate behavior or verify results. The porting package is Java package named "org.jboss.cdi.tck.spi" and includes a set of SPIs that provide the TCK with this level of access without tying the tests to a given implementation.

The SPI classes in the CDI TCK are as follows:

Please consult the JavaDoc for these interfaces for the implementation requirements.

You can configure the CDI TCK to just run tests appropriate to the Java EE Web Profile by excluding TestNG group javaee-full, e.g. via maven-surefire-plugin configuration:



      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <excludedGroups>javaee-full</excludedGroups>
            </configuration>
       </plugin>

The CDI TCK is built atop Arquillian and TestNG, and it’s TestNG that is responsible for selecting the tests to execute, the order of execution, and reporting the results. Detailed TestNG documentation can be found at testng.org.

Certain TestNG configuration file must be run by TestNG (described by the TestNG documentation as "with a testng.xml file") unmodified for an implementation to pass the TCK. The TCK distribution contains the configuration file accurate at the date of the release - artifacts/cdi-tck-impl-suite.xml. However this artifact may not be up to date due to unresolved challenges or pending releases. Therefore a canonical configuration file exists. This file is located in the CDI TCK source code repository at ${CORRESPONDING_BRANCH_ROOT}/impl/src/main/resources/tck-tests.xml.

Note

The canonical configuration file for CDI TCK is located at https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/resources/tck-tests.xml.

This file also allows tests to be excluded from a run:


<suite name="CDI TCK" verbose="0" configfailurepolicy="continue">
   <test name="CDI TCK">
      ...
      <classes>
         <class name="org.jboss.cdi.tck.tests.context.application.ApplicationContextTest">
            <methods>
               <exclude name="testApplicationScopeActiveDuringServiceMethod"/>
            </methods>
         </class>
      </classes>
      ...
   </test>
</suite>

Note

Additionally there is available canonical configuration file at https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/resources/tck-tests-previous.xml. Please note that this exclude list serves only for the previous micro version of TCK release! This means that if the latest version of TCK is e.g. 1.2.5.Final then this exclude list is valid only for the version 1.2.4.Final and invalid for any other version!

TestNG provides extensive reporting information. Depending on the build tool or IDE you use, the reporting will take a different format. Please consult the TestNG documentation and the tool documentation for more information.

It’s beyond the scope of this guide to describe in how to set up your build environment to run the TCK. The TestNG documentation provides extensive information on launching TestNG using the Java, Ant, Eclipse or IntelliJ IDEA.

The TCK makes use of the Java 1.4 keyword assert; you must ensure that the JVM used to run the application server is started with assertions enabled. See Programming With Assertions for more information on how to enable assertions.

Tests within the jms test group require some basic Java Message Service configuration. A connection factory, a queue destination for PTP messaging domain and a topic destination for pub/sub messaging domain must be available via JNDI lookup. The corresponding JNDI names are specified with configuration properties - see Section 4.1, “TCK Properties”.

Tests within the persistence test group require basic data source configuration. The data source has to be valid and JTA-based. The JNDI name of the DataSource is specified with configuration property - see Section 4.1, “TCK Properties”.

Tests within the installedLib test group require the CDI TCK cdi-tck-ext-lib artifact to be installed as a library (see also Java EE 6 specification, section EE.8.2.2 "Installed Libraries").

Tests within the systemProperties test group require the following system properties to be set:

NameValue

cdiTckExcludeDummy

true

Tests within the security test group require the following mapping of roles to principals:

PrincipalGroup

student

student

alarm

alarm, student

printer

printer

Tests within SE test groups require execution in a separate JVM instance with isolated classpath including all required dependencies.