Repository navigation
Add validation for visit via locations with coordinates when attempting to link them to graph - #6704
optionsome wants to merge 33 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6704 +/- ##
=============================================
+ Coverage 72.08% 72.21% +0.12%
- Complexity 19512 19597 +85
=============================================
Files 2106 2108 +2
Lines 78936 79136 +200
Branches 8000 8012 +12
=============================================
+ Hits 56902 57147 +245
+ Misses 19220 19173 -47
- Partials 2814 2816 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| /** | ||
| * Utility class. If the from and to vertices are generated and lie along some of the same edges, | ||
| * Utility class. If the from, to or via vertices are generated and lie along some of the same edges, |
There was a problem hiding this comment.
This class is only used by TemporarVerticesContainerBuilder. We can move it into its package and make it package-private.
There was a problem hiding this comment.
It is used by TestHalfEdges but that's a pretty old and very unfocussed test. I would be ok if you deleted the two test cases that use it.
There was a problem hiding this comment.
However, I can also do it in one of my PRs.
There was a problem hiding this comment.
I'm a bit hesitant on removing the TestHalfEdges test because there probably isn't a test anywhere else that tests this functionality. I think we should create unit tests for the adjuster itself and remove the TestHalfEdges test, but I think this pr is big enough already so I'm not going to do this refactoring at least in this pr.
| public void locationNotFoundException() { | ||
| // Stops not found | ||
| try ( | ||
| var container = TemporaryVerticesContainer.of(g) |
There was a problem hiding this comment.
I think assertThrows is more appropriate here.
There was a problem hiding this comment.
There are a few more places in this class where this is the case.
There was a problem hiding this comment.
assertThrows doesn't call the close() on the AutoCloseable by default, but there is a workaround junit-team/junit-framework#2189 (comment). I'm not sure which solution is prettier.
There was a problem hiding this comment.
While thinking about this, I realized there was memory leak when the builder threw an exception. I ended up using assertThrows as suggested.
leonardehrenfried
left a comment
There was a problem hiding this comment.
I think this is a solid refactoring where lots of duplicate instantiation of the temp vertices container is removed. Nevertheless, I have a few requests.
| * This class is responsible for linking the RouteRequest origin, destination and visit via | ||
| * locations that contain coordinates to the Graph used in the A-Star search. This builder also | ||
| * validates that it was possible to link the locations to the graph. The responsibility of cleaning | ||
| * up the temporary vertices and edges is on the {@link TemporaryVerticesContainer}. | ||
| */ |
There was a problem hiding this comment.
This is looks like the responsibilities of the domain class, not the builder. We only document if a builder needs to do something none standard stuff on builders. All domain documentatio should be on the domain class.
There was a problem hiding this comment.
This class suddenly have to deal with a lot of detailed access/egress mode business logic. This does not belong in this class.
Creating and passing in a TemporaryVertexContainer is ok (there is not many better options), but the container should be clean - no routing/domain logic - pure framework. If we do that then the logic in createTemporaryVerticesContainer can be moved. Not sure where, but to a mapper or pushed down.
…cesContainer into LinkingContext
…rtices management
…rtices management
…xt for temporary vertices management
|
I'll close this and open another pr from upstream repo with these changes + more. |
Summary
Temporary vertex creation is moved to routing worker so we don't do it separately for access/egress and direct searches. TemporaryVerticesContainer is now used for coordinate visit via locations as well.
Functional changes:
Issue
Relates to #6501
Unit tests
Will add new tests and there is one existing test failing (haven't had time yet to figure out why).
Documentation
Not needed
Changelog
Skipped