SONARJAVA-6854 Externalize ruling test project definitions to JSON - #6041
SONARJAVA-6854 Externalize ruling test project definitions to JSON#6041romainbrenguier wants to merge 3 commits into
Conversation
- Add ruling-projects.json with project name-to-path mappings - Add RulingProject record for type-safe access - Add ProjectConfigLoader utility with requireProject() method - Update JavaRulingTest to use centralized project definitions - Add unit tests for ProjectConfigLoader
2e82f50 to
52d513b
Compare
This comment has been minimized.
This comment has been minimized.
Pass project.path() to the 3-arg test_project() in executeMavenBuild() so that projects with a path different from their name (e.g. sonar-server under sonarqube-6.5/server) resolve the correct pom.xml location. In ProjectConfigLoader.loadProjects(), replace Objects.requireNonNull with an explicit null check that throws IllegalStateException, and catch JsonParseException alongside IOException for consistent error handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ All code review findings resolved.
…te issue The test_project method was concatenating path + projectName, causing doubled paths (e.g. sources/guava/guava/pom.xml) when they are identical. Changed to use path as the full directory when provided. Updated sonar-server's JSON path to include the projectName subdirectory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review ✅ Approved 2 resolved / 2 findingsExternalizes ruling test project definitions to a JSON configuration file and introduces the RulingProject record for improved type safety. Addressed the wrong pom path resolution and outdated javadoc during the review. ✅ 2 resolved✅ Bug: sonarqube_server now resolves the wrong pom path, breaking the test
✅ Quality: loadProjects() javadoc contradicts the exceptions it actually throws
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|





Summary
This change externalizes the hardcoded project name-to-path mappings from JavaRulingTest into a JSON resource file.
Benefits
Changes
ruling-projects.jsonwith all 12 project configurationsRulingProjectrecord with Gson annotations for JSON serializationProjectConfigLoaderutility withfindByProjectName()andrequireProject()methodsJavaRulingTestto use the new loader