We plan to eventually migrate from Jetty 12 EE 8 to Jetty 12 EE 9, but the test harness only supports cores with Jetty 12 EE 8.
Solution
Bundle both the Jetty 12 EE 8 and EE 9 modules into the test harness, and dynamically select the module to load at runtime based on the Jenkins core in use.
This change does not increase the minimum core version supported by the test harness. To detect newer cores with EE 9 support and invoke the appropriate methods, reflection is used.
Implementation
This plugin finds any places where we invoked EE 8 functionality in Jenkins core and turns them into an if statement. The existing code is in the else block, and the if block contains new code that invokes the relevant EE 9 functionality through reflection.
JavaNetReverseProxy2 and NoListenerConfiguration2 classes have been created that duplicate the existing classes but with EE 9 imports instead.
Testing done
Core and plugin test suites have been executed successfully with this PR, with no known failures.
Notes for reviewers
This change is somewhat challenging to review. The changes to JenkinsRule and HudsonTestCase look confusing, because the imports have changed, and it looks like a lot of new code has been added, but that new code is really preserving the existing code but with the old imports. The "existing" code has now been changed to add a 2 to the method names and referring to the new imports. So the existing code looks the same but means something different, and the "new" code is actually the existing code, but for compatibility.
Deployment
This change requires Java 17 or newer, so it will not be backported to the 2225.x branch of the test harness or released in a plugin parent POM until such a time that we require Java 17 or newer for Jenkins plugin development.
It will be used in the core release that adopts Jetty 12 EE 9.
Future work
Once we drop support for EE 8 in the test harness, the code in this change can be simplified. The EE 8 branches of if statements can all be deleted, and the reflection-based code can be transformed to directly invoke the relevant methods, much like the EE 8 code does today.
Problem
We plan to eventually migrate from Jetty 12 EE 8 to Jetty 12 EE 9, but the test harness only supports cores with Jetty 12 EE 8.
Solution
Bundle both the Jetty 12 EE 8 and EE 9 modules into the test harness, and dynamically select the module to load at runtime based on the Jenkins core in use.
This change does not increase the minimum core version supported by the test harness. To detect newer cores with EE 9 support and invoke the appropriate methods, reflection is used.
Implementation
This plugin finds any places where we invoked EE 8 functionality in Jenkins core and turns them into an
if
statement. The existing code is in theelse
block, and theif
block contains new code that invokes the relevant EE 9 functionality through reflection.JavaNetReverseProxy2
andNoListenerConfiguration2
classes have been created that duplicate the existing classes but with EE 9 imports instead.Testing done
Core and plugin test suites have been executed successfully with this PR, with no known failures.
Notes for reviewers
This change is somewhat challenging to review. The changes to
JenkinsRule
andHudsonTestCase
look confusing, because the imports have changed, and it looks like a lot of new code has been added, but that new code is really preserving the existing code but with the old imports. The "existing" code has now been changed to add a 2 to the method names and referring to the new imports. So the existing code looks the same but means something different, and the "new" code is actually the existing code, but for compatibility.Deployment
This change requires Java 17 or newer, so it will not be backported to the 2225.x branch of the test harness or released in a plugin parent POM until such a time that we require Java 17 or newer for Jenkins plugin development.
It will be used in the core release that adopts Jetty 12 EE 9.
Future work
Once we drop support for EE 8 in the test harness, the code in this change can be simplified. The EE 8 branches of
if
statements can all be deleted, and the reflection-based code can be transformed to directly invoke the relevant methods, much like the EE 8 code does today.