These days I have been involved in several issues about the old Java Server Faces (JSF) technology. Currently wildfly is using the former Oracle driven mojarra implementation that, as the rest of the JavaEE specification, now is controlled by the eclipse foundation. Working with the code the major issue I have faced has been launching the tests. Although it is explained in the project, I spent some time to fully understand the process, so better if I collect the commands here.
As the documentation says the glassfish javaee server is needed, but the version is specially important when testing the different branches. For example if you want to test branch 2.3 (2.3.14 right now) you can install glassfish 5.0, but if you want to test the master branch (future 3.0 version) you need glassfish 5.1 from the same eclipse project.
Let's assume we want to test the master branch. Then the glassfish 5.1 should be installed in your computer.
unzip glassfish-5.1.0.zip
mv glassfish5 glassfish5.1
Now just clone and compile the project (default maven usage).
mvn clone https://github.com/eclipse-ee4j/mojarra.git
cd mojarra
mvn clean install
In order to launch a specific app test the documentation can just be followed, using the properties to locate the glassfish instance. The test application test/javaee7/cdiInitDestroyEvent is used as example.
cd test/javaee7/cdiInitDestroyEvent
Copy the compiled JSF jar file into the glassfish.
mvn -N -Pglassfish-patch -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 validate
Start the domain with the new JSF version.
mvn -N -Pglassfish-cargo -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 cargo:start
Deploy the application for the test.
mvn -Pglassfish-cargo -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 cargo:redeploy
Launch the tests against the app just deployed.
mvn -Pintegration -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 verify
If everything goes OK you can stop the server.
mvn -N -Pglassfish-cargo -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 cargo:stop
The documentation also comments that all the tests inside a directory can be executed. To do that the same steps are done but in the upper directory. For example the javaee7 directory is used to run all the tests in that version of the JavaEE standard (the -fn parameter is passed to not stop tests on error, I want all of them executed even if there are errors):
cd test/javaee7
mvn -N -Pglassfish-patch -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 validate
mvn -N -Pglassfish-cargo -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 cargo:start
mvn -Pglassfish-cargo -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 cargo:redeploy
mvn -fn -Pintegration -Dglassfish.cargo.home=/home/rmartinc/glassfish5.1 -Dglassfish.patch.home=/home/rmartinc/glassfish5.1 verify
Finally there are some test directories that do not run OK. But then I realized that, in the automatic tests that are launched when a Pull Request is received, only the following folders are executed: htmlunitaware, javaee6, javaee6web, javaee7, javaee8, servlet31, servlet40. I can confirm that servlet30 also runs without any problem but all the others report an issue at some point (I think just because they are not used and therefore not maintained, except the cluster folder, that needs several instances and it is not explained how to test it, maybe it just needs a glassfish cluster deployed in some specific ports but I did not check it deeply).
And that's all. Very simple entry. The documentation also comments that the tests can be run with different options (different JSF configurations). Indeed my main problem was knowing what glassfish to use for the tests, because I initially tried with 5.0 and that does not work for the master branch (you need the new version 5.1 to be compatible). Maybe I'm just repeating the same statements that there are in the documentation, but I prefer to write a summary here with the exact commands I used, just in case I need to work again on the mojarra implementation.
Happy testing!
Comments