Skip to content

Running TckRewrite JavaFxApp

Scott M Stark edited this page Jul 25, 2024 · 4 revisions

The jakartaee-tck-tools repo has a JavaFX app that uses the tools/tck-rewrite-ant artifact to allow for an interactive browsing and conversion of the EE10 test class source into the EE11 platform-tck repository as Arquillian/Junit5 test classes, one per vehicle or one test for non-vehicle based tests.

Building the app dependencies

Right now there are several dependencies that are not available in Maven Central. These dependencies are built from source and installed into the local Maven repository. The following dependencies are built from source:

  • platform.tck: The TCK platform repo platform-tck main branch needs to be built to provide the test classes for the current TCK, 11.0.0-SNAPSHOT.
  • jakartaee-tck-tools/tools/tck-rewrite-ant module needs to be built to provide the Ant parser for the TCK source tree.

Building the platform-tck

git clone https://github.com/jakartaee/platform-tck/
cd platform-tck
mvn install

Building jakartaee-tck-tools/tools/tck-rewrite-ant

git clone https://github.com/eclipse-ee4j/jakartaee-tck-tools/
cd jakartaee-tck-tools/tools/tck-rewrite-ant
mvn install

Setting up the environment

You need both an EE10 TCK release and a GlassFish 7.x release unzipped locally for the application to have the EE10 source and classes to browse. The GlassFish 7.x release is used by the Ant build for the EE10 API jars. You can download the EE10 TCK from the Jakarta EE TCK page and the GlassFish 7.x release from the GlassFish GitHub releases page

Unpack the EE10 TCK and GlassFish 7.x releases into the same directory on your local machine. You will need to set the TS_HOME environment variable to the root of the EE10 TCK directory. The GlassFish jars will be picked up from ${TS_HOME}/../glassfish7/glassfish/modules.

You also need a Java SE 21 JDK to build and run the application.

Building the application

The application is in the same jakartaee-tck-tools repository you built the tck-rewrite-ant module from. The application is in the tools/tck-rewrite-fx module, and it needs Java SE 21+ to build and run.

To build the application, run the following commands:

cd jakartaee-tck-tools/tools/tck-rewrite-fx
mvn package

Running the application

mvn quarkus:run

There are two environment variables you will want to set to simplify usage of the app:

  • TS_HOME: The root directory of the EE10 TCK you have downloaded.
  • TESTS_REPO: The location of the current platform-tck repo.

You can set or change these at runtime using the application file menu, but it is easier to set them in the shell before starting the app.

The main window of the app looks like this:

You can use the TreeView browser to look through the EE10 sources, or type in a relative path to a test class in the text field above the TreeView. Skip past the com/sun/ts/tests portion of the source. For example to search for the com.sun.ts.tests.jms.core.bytesMsgTopic test directory, you would type in jms/core/bytesMsgTopic. Each matching subdirectory should be highlighted in the TreeView as you type.

After typing that in and opening the bytesMsgTopic node, you should see:

Click on the BytesMsgTopicTest.java file to see the test class source, and the generated Arquillian/Junit5 test source file(s). This may take a bit as the build.xml file in the test directory is parsed and the source generated. You will see the original EE10 source and the generated Arquillian/Junit5 source in the tabs to the left of the Original tab as shown here:

You can then save the generated source to the current platform-tck repo, or copy it to the clipboard to paste into the current platform-tck repo. To save all generated files, choose File-> Save...

This will place the source into the ${TESTS_REPO}/jms/src/main/java directory structure, specifically, the jms/src/main/java/com/sun/ts/tests/jms/core/bytesMsgTopic directory.

To copy one of the generated files to the clipboard, choose the tab of the file you want to copy, and then choose Edit->Copy.

If you look at the generated source in the ${TESTS_REPO}/jms module, and you have updated the pom.xml dependencies for Arquillian/Junit5 and the TCK arquillian protocols, you will see that the generated source has three errors, one in each of the overriden test methods.

The reson for this is that the EE11 TCK repository has updated the exception being thrown to java.lang.Exception rather than the com.sun.ts.lib.harness.EETest.Fault exception that was used in EE10. You can fix this by changing the exception type in the generated source to java.lang.Exception.

In the future we may to have a way to automatically fix this by looking at the EE11 test classes, but for now you will need to manually fix the exception type in the generated source. It is not clear how many tests have changed their exception type.

Questions and Problems

You can either email the [email protected] mailing list, or open an issue in the jakartaee-tck-tools repo.

Clone this wiki locally