CDI TCK Community Documentation

- Prev
- Next

## Chapter 7. Running the Signature Test

One of the requirements of an implementation passing the TCK is for it to pass the CDI signature test. This section describes how the signature file is generated and how to run it against your implementation.

## 7.1. Obtaining the sigtest tool

You can obtain the Sigtest tool (at the time of writing the TCK uses version 4.0) from the Sigtest home page at https://wiki.openjdk.java.net/display/CodeTools/sigtest. The user guide can be found at http://docs.oracle.com/javacomponents/sigtest.htm.

## 7.2. Running the signature test

To run the signature test simply change the execution command from `Setup` to `SignatureTest`:

    java -jar sigtestdev.jar SignatureTest -classpath "%JAVA_HOME%\jre\lib\rt.jar:lib/cdi-api.jar:lib/jakarta.inject.jar:lib/el-api.jar:lib/jboss-interceptor-api.jar" -Package jakarta.decorator -Package jakarta.enterprise -FileName artifacts/cdi-tck-impl-sigtest.sig -static

When running the signature test, you may get the following message:

`"The return type java.lang.reflect.Member can’t be resolved"`

This can safely be ignored - the important thing is to get the `"STATUS:Passed."` message.

## 7.3. Forcing a signature test failure

Just for fun (and to confirm that the signature test is working correctly), you can try the following:

1) Edit cdi-api.sig

2) Modify one of the class signatures - in the following example we change one of the constructors for `BusyConversationException` - here’s the original:

    CLSS public jakarta.enterprise.context.BusyConversationException
    cons public BusyConversationException()
    cons public BusyConversationException(java.lang.String)
    cons public BusyConversationException(java.lang.String,java.lang.Throwable)
    cons public BusyConversationException(java.lang.Throwable)
    supr jakarta.enterprise.context.ContextException
    hfds serialVersionUID

Let’s change the default (empty) constructor parameter to one with a `java.lang.Integer` parameter instead:

    CLSS public jakarta.enterprise.context.BusyConversationException
    cons public BusyConversationException(java.lang.Integer)
    cons public BusyConversationException(java.lang.String)
    cons public BusyConversationException(java.lang.String,java.lang.Throwable)
    cons public BusyConversationException(java.lang.Throwable)
    supr jakarta.enterprise.context.ContextException
    hfds serialVersionUID

3) Now when we run the signature test using the above command, we should get the following errors:

    Missing Constructors
    --------------------

    jakarta.enterprise.context.BusyConversationException:         constructor public jakarta.enterprise.context.BusyConversationException.BusyConversationException(java.lang.Integer)

    Added Constructors
    ------------------

    jakarta.enterprise.context.BusyConversationException:         constructor public jakarta.enterprise.context.BusyConversationException.BusyConversationException()

    STATUS:Failed.2 errors

- PrevPart II. Executing and Debugging Tests
- Top of page
- Front page
- NextChapter 8. Executing the Test Suite