Skip to content

OpenRewrite

Scott Marlow edited this page Jun 6, 2024 · 5 revisions

To setup local test environment (with Java 17 JDK already configured and selected via JAVA_HOME/PATH):

  • Setup local clone of jakartaee-tck-tools from scottmarlow (or fetch the branch):
  • Still in jakartaee-tck-tools folder, build the jar2shrinkwrap + tck-rewrite tools
    • cd jar2shrinkwrap
    • mvn clean install
    • cd ../tck-rewrite
    • mvn clean install
    • You shouldn't get any build failures
  • Setup local clone of jakartaee-tck from scottmarlow (you can also just fetch the rewritejpa branch as an alternative):
    • git clone https://github.com/scottmarlow/jakartaee-tck
    • cd jakartaee-tck
    • git checkout rewritejpa
    • mvn clean install
    • export MAVEN_OPTS="-Xmx3054m -XX:-UseGCOverheadLimit"
    • cd jpa
    • mvn -Djar2shrinkwrap.technology=jpa org.openrewrite.maven:rewrite-maven-plugin:runNoFork 2>&1 | tee /tmp/tck.log

Note that the MAVEN_OPTS setting should help avoid an Out Of Memory problem as OpenRewrite Maven plugin keeps all test changes in memory until all changes are complete. For that reason, we likely will use the -Djar2shrinkwrap.technology= setting to only transform a subset of tests at a time. Note that the -Djar2shrinkwrap.technology setting is also hacked to just see if the specified technology is in each of the TCK test packages and if yes, the test will be transformed.

After you run the above commands, you might want to save the output of transformation, something like git diff > jpa.patch and then you can do a git stash to discard the changes made. If you make changes to any of the 3 mentioned projects, you can build and test again.

Note that currently we need to do more magic to map some EE 10 TCK test names to their equivalent EE 11 names as we get a small number of compile errors as you can see in at the end of gist

May 29, 2024 update

We restructured some of the internals to have the tck-rewrite artifact deal with the actual code generation using the jar2shrinkwrap interfaces to facilitate via the tck.jakarta.platform.rewrite.shrinkwrap.TestGenerator class. The reason is to have more flexibility in tck-rewrite artifact to influence custom test code changes.

Next we will update the tck.jakarta.platform.rewrite.shrinkwrap.TestGenerator to determine the TCK test vehicles that were used for each test under EE 10 and generate code appropriate EE 11 for such code.

June 3, 2024

https://github.com/jakartaee/platform-tck/issues/1141 Tracking issue for OpenRewrite automation of EE 11 TCK refactoring https://github.com/jakartaee/platform-tck/issues/1126 EE 11 Platform TCK refactoring roadmap

June 6, 2024

Output from running mvn -Djar2shrinkwrap.technology=com.sun.ts.tests.servlet org.openrewrite.maven:rewrite-maven-plugin:runNoFork is at https://gist.github.com/scottmarlow/3dd660a473e69acc667ada579b39327c (note that .jsp + .html files are included).

Notice that servlet is an example of tests that need more (per test method) rewriting then the JPA tests which already are using junit for the Persistence component TCK.

Perhaps we can control which approach is used internally based on the jar2shrinkwrap.technology system property passed in.

Clone this wiki locally