Wildbook
Wildbook copied to clipboard
Refactoring Shepherd for testing and maintainability
This is a multi-issue story with the goal of breaking the Shepherd class into sub-packages and new classes to facilitate testing and improve maintainability. This iteration will identify and migrate only high priority methods and provide an example for further refactoring as resources allow.
[Sub-issues will be linked as they are created.]
High level tasks include:
- Enumerate backwards dependencies of Shepherd, ShepherdPMF, and ShepherdProperties; mark orphaned code for removal;
- Create new directory structure / subpackages
Suggested directory structure with example files:
src/main/java/org/ecocean/shepherd/ core/ Shepherd.java (Coordinates operations between services and utilities) ShepherdPMF.java (Persistence Manager Factory, if not separated out) services/ EncounterService.java MediaAssetService.java ... utils/ MediaUtils.java QueryUtils.java ValidationUtils.java ... ``` - Migrate Shepherd and ShepherdPMF to core
- Identify util methods in Shepherd and prioritize for migration to new util classes based on usage in backwards dependency analysis; migrate high priority methods; add tests; prune code flagged for removal
- Identify entities and their CRUD methods in Shepherd and prioritize for migration to new service classes; migrate high priority entities (e.g. Encounter); add tests; prune code flagged for removal
- Identify transaction handling methods; add tests
Work done on this story for 10.7: #1074, #1079, #1080, #1083, #1084
Keeping alive as a parent story to track refactoring ... not just 10.7 work.