-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify timetable snapshot handling for GTFS-RT and Siri #5853
Unify timetable snapshot handling for GTFS-RT and Siri #5853
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5853 +/- ##
=============================================
+ Coverage 68.47% 68.49% +0.01%
- Complexity 16698 16703 +5
=============================================
Files 1914 1915 +1
Lines 72673 72652 -21
Branches 7454 7447 -7
=============================================
- Hits 49763 49760 -3
+ Misses 20340 20326 -14
+ Partials 2570 2566 -4 ☔ View full report in Codecov by Sentry. |
80d3573
to
497a830
Compare
src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java
Outdated
Show resolved
Hide resolved
497a830
to
d9a68d5
Compare
I've now rebased onto dev-2.x which contains @habrahamsson-skanetrafiken's Siri tests and they all still pass. |
0a2d47c
to
e888149
Compare
f7a9ccd
to
3bc32bb
Compare
3bc32bb
to
c1ea7a2
Compare
26ed663
to
3c58564
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this as easy to review as possible! It looks like a good first step in unifying the snapshot stuff.
src/ext/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSource.java
Outdated
Show resolved
Hide resolved
src/ext/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSource.java
Show resolved
Hide resolved
src/main/java/org/opentripplanner/updater/trip/AbstractTimetableSnapshotSource.java
Show resolved
Hide resolved
src/main/java/org/opentripplanner/updater/trip/AbstractTimetableSnapshotSource.java
Show resolved
Hide resolved
src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java
Outdated
Show resolved
Hide resolved
7ec3ad2
to
619e7cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Just a few typos.
Summary
We discussed in one of the realtime meetings that the GTFS-RT and Siri code needs to be unified. This PR makes one step into that direction by introducing an abstract base class for handling the timetable snaphots. This is then used by both the Siri and GTFS-RT updaters.
Previously their handling of the snapshot was very similar, but not identical: Siri would always initialise a snapshot in the constructor but GTFS-RT would not. This meant that I had to modify the tests ever so slightly to make them pass, reflecting the fact that GTFS-RT now also initialises a snapshot during instantiation.
Further work
While using a base class has improved encapsulation and the separation of input mapping code from "framework code" (many fields are now private to the base class), the buffer is still very much exposed. In further work I would like to improve this further by totally encapsulating the buffer.
In the end I see design like the following:
Unit tests
Unit tests were updated. Slight modifications were necessary.
Other work
#5852 and #5726 also touch on very similar code and I will wait until they are merged before requesting a code review.