Skip to content

OpenRewrite

Scott Marlow edited this page Aug 16, 2024 · 12 revisions

Instructions to setup local test environment (with Java 17 JDK already configured and selected via JAVA_HOME/PATH). Note: You also need Java 21 JDK

  • Setup local copy of jakartaee-tck-tools:
  • Build snapshot build of tooling if the current release (version=1.0.0-M2, tag=tck-arquillian-1.0.0-M2) is out of date. Otherwise, just use the 1.0.0-M2 version of these artifacts in the next step.
    • cd tck-rewrite-ant
    • mvn clean install
    • cd ../tck-rewrite-fx
    • Now switch to Java 21
    • mvn clean install
    • Now switch back to Java 17
    • cd ../tck-rewrite
    • mvn clean install
  • 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 new_rewritejpa2
    • mvn clean install
    • cd ejb30
    • mvn -Dtcksourcepath=src/main/java -Dts.home=/home/smarlow/tck/tck10/jakartaeetck org.openrewrite.maven:rewrite-maven-plugin:runNoFork 2>&1 | tee /tmp/tck.log
    • grep TODO /tmp/tck.log | less
      • You likely will see something like WARNING: TODO: src/main/java/com/sun/ts/tests/ejb30/bb/async/singleton/annotated/ClientEjbliteservletTest.java was already previously generated which means we aren't handling something correctly. which needs to be looked at.

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.

You may also just use git status | grep .java | xargs rm to discard the output of transformation as git stash probably doesn't see the newly generated files.

Example ejb32 rewrite-pom.xml

The ejb32 modules has an example standalone pom https://github.com/jakartaee/platform-tck/blob/main/ejb32/rewrite-pom.xml showing setup of the openrewrite plugin with updated dependencies.

The code in the module was generated with:

mvn -f rewrite-pom.xml -Pstaging -Dtcksourcepath=src/main/java -Dts.home=//home/starksm/Dev/Jakarta/wildflytck/jakartaeetck org.openrewrite.maven:rewrite-maven-plugin:runNoFork 2>&1 | tee /tmp/tck.log

or to regenerate

mvn -f rewrite-pom.xml -Pstaging -DoverwriteExistingTests=true -Dtcksourcepath=src/main/java -Dts.home=//home/starksm/Dev/Jakarta/wildflytck/jakartaeetck org.openrewrite.maven:rewrite-maven-plugin:runNoFork 2>&1 | tee /tmp/tck.log

Updated instructions for jpa tests with rewrite-pom.xml

Follow ejb32 instructions above and run the following cleanup script after to remove ExpectedResult.class that gets added to more classes than it should.

function cleanup () {
  grep ExpectedResult $1
  sed -i '/ExpectedResult/d' $1
  grep ExpectedResult $1
}

cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client4Stateful3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client2Stateful3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client5Stateless3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client7AppmanagednotxTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client1PmservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client7PmservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client1AppmanagednotxTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client6PuservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client5AppmanagedTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client4AppmanagednotxTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client5PmservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client6Stateful3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client6AppmanagedTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client5AppmanagednotxTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client2PuservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client5PuservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client2AppmanagedTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client4Stateless3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client4PuservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client2AppmanagednotxTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client2Stateless3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client5Stateful3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client2PmservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client4PmservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client1AppmanagedTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client6PmservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client7Stateful3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client1Stateful3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client7PuservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client1Stateless3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client1PuservletTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client7AppmanagedTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client7Stateless3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client6Stateless3Test.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client6AppmanagednotxTest.java
cleanup jpa/platform-tests/src/main/java/ee/jakarta/tck/persistence/core/criteriaapi/CriteriaQuery/Client4AppmanagedTest.java
Clone this wiki locally