Improve implementation and tests
Tries to improve the base lab implementation and the tests.
Changes:
- Update Gradle to 7.3
This also updated the Gradle Wrapper scripts and JARs. You can (and should) compare the scripts with the offical Gradle scripts https://github.com/gradle/gradle/blob/master/gradlew and https://github.com/gradle/gradle/blob/master/gradlew.bat to verify that they are legit. For the modifiedgradle-wrapper.jar
I highly encourage you to compare its checksum with the expected checksum for version 7.3 listed at https://gradle.org/release-checksums/#v7.3 to verify that it is legit (and that I am not adding malicious binaries). - Uses Gradle toolchains to specify usage of JDK 11. This will download a matching JDK if none is found locally, making sure that (at least when running Gradle from command line), students will get consistent results. IDE support for automatically detecting the version might vary. Students might still have to download a JDK manually.
- Updates dependencies and plugins
- Fix Controller not working when project has file path with special characters or spaces (caused by incorrect conversion from
URL
toFile
) - Improve Controller handling of incorrect student defined classes
- Simplify CsvDataReader implementation
- Improve Lab02EntityManager API to better handle closing of EntityManagerFactory
- Switches from JUnit 4 to JUnit 5
- Dynamically skips tests when students have not implemented the tasks for all labs yet. This allows them to perform a complete Gradle build (
./gradlew clean build
) even when they have not implemented the classes for lab 2 or lab 3 yet. - Run Lab01Test by CI. As mentioned in the point above this won't cause test failures when students have not implemented classes for this lab yet. Lab02Test and Lab03Test are not run because they require a database connection. (It might be possible to implement this with Testcontainers or GitLab services but it appears the usage of
javax.persistence.schema-generation.database.action
none
starting with lab 3 would not work well for this; unless a new PU for unit tests is added and Lab02EntityManager API is changed to take a PU name as argument.) - Perform more assertions in test classes avoiding some runtime exceptions caused by incorrect implementations by students
- Improve Gradle test output when run from command line, logging test executions on console (will hopefully be helpful for students new to Gradle); by default Gradle is not logging successful test executions.
These changes might require adjustments to the lab task PDFs.
Note that I have not completed all lab tasks, therefore I was not able to verify that all lab tasks still work as expected. Could you please test against your sample solution?
I hope these proposed changes are useful. Please let me know if you want anything changed. Any feedback is appreciated.
Also feel free to only incorporate parts of this merge request.
Sorry in case this merge request is too intrusive.
Edited by Markus Löwe