PrashantBhanage opened a new pull request, #13695:
URL: https://github.com/apache/cloudstack/pull/13695

   **Note: This is the 4.22 LTS backport of PR #13490 as requested by 
@DaanHoogland.**
   
   ### Description
   This PR addresses the technical debt in 
`ApiResponseHelper#createUsageResponse(Usage)` by modularizing the 530-line 
method.
   
   - Extracted the 500+ line switch/if-else block into a main dispatcher method 
`populateUsageTypeSpecificDetails`.
   - Created 18 individual private helper methods for each specific `UsageType` 
to improve maintainability and readability.
   - Introduced a `UsageResourceDetails` container class to safely manage and 
return `resourceId` and `resourceType` state for tag lookups.
   - Verified zero business logic changes; strictly structural refactoring.
   - *Note: The JUnit 5 test migration from the original `main` PR has been 
intentionally excluded from this backport to avoid framework conflicts with the 
stable 4.22 LTS testing architecture.*
   
   ### Types of changes
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [x] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [ ] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   #### Feature/Enhancement Scale
   - [ ] Major
   - [x] Minor
   
   #### Bug Severity
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   N/A (Pure backend refactoring)
   
   ### How Has This Been Tested?
   - Verified structural integrity locally.
   - Fixed `.toString()` type mismatch in usage entity lookups to ensure 
`Simulator CI` passes cleanly on the LTS branch.
   
   #### How did you try to break this feature and the system with this change?
   This is a pure structural refactor. Carefully verified that no business 
logic, string formatting, or calculations were altered.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to