Refactor LineInfoCollector to use repository abstraction#827
Open
Refactor LineInfoCollector to use repository abstraction#827
Conversation
This commit introduces a repository pattern to encapsulate the Redisson API usage in LineInfoCollector, improving separation of concerns and testability. Changes: - Created LineInfoMemStoreRepository interface for line info storage - Implemented RedisLineInfoMemStoreRepository with distributed locking - Refactored LineInfoCollector to use the repository abstraction - Removed direct RedissonClient and cache dependencies from collector - Added null safety check for lineInfo before storing - Updated Spring configuration to wire repository Benefits: - Better separation of concerns (collector vs. repository) - Redisson API fully encapsulated behind clean interface - Easier to test with mock repositories - Consistent with existing TemporaryFileRepository pattern - Reduced LineInfoCollector from 82 to 58 lines (-29%) All existing tests pass without modification.
14084b2 to
0f7fb14
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Overview
This PR introduces a repository pattern to encapsulate the Redisson API usage in
LineInfoCollector, improving separation of concerns and testability.Changes
New Files
LineInfoMemStoreRepository.java- Interface defining the contract for line info storageRedisLineInfoMemStoreRepository.java- Redis-based implementation with distributed lockingModified Files
LineInfoCollector.javaRedissonClientdependencylineInfoCachedirect accessaddLineName()method (logic moved to repository)lineInfobefore storingNetexDataCollectorConfig.javaBenefits
TemporaryFileRepositorypatternLineInfoCollectorfrom 82 to 58 lines (-29%)Testing
✅ All existing tests pass without modification
✅ No test changes required
✅ All integration tests with Redis passed
✅ No performance regression detected
Future Work
This refactoring establishes a pattern that can be applied to other collectors:
ScheduledStopPointIdCollectorServiceJourneyInterchangeInfoCollectorServiceJourneyStopsCollectorServiceJourneyActiveDatesCollectorMigration Notes