forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from ibi-group/upstream-merge-2023-10-20
Upstream merge 2023-10-20
- Loading branch information
Showing
147 changed files
with
4,041 additions
and
1,593 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest a feature or improvement for OTP | ||
title: '' | ||
labels: new feature | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --> | ||
|
||
**Goal / high level use-case** | ||
<!-- Describe the the goal, high level use-case or epic this is is part of. Link to roadmap epic --> | ||
<!-- Roadmap: #1234 --> | ||
|
||
**Describe the solution you'd like** | ||
<!-- A clear and concise description of what you want to happen. --> | ||
|
||
**Describe alternatives you've considered** | ||
<!-- A clear and concise description of any alternative solutions or features you've considered. --> | ||
|
||
**Additional context** | ||
<!-- Add any other context or screenshots about the feature request here. --> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: Roadmap Epic | ||
about: Suggest an idea for the Roadmap | ||
title: '' | ||
labels: Roadmap | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Describe expected behavior: | ||
- What: <!-- Clearly state what the desired changes or new features could look like. --> | ||
- Why: <!-- Clearly state the effect/outcome of this change. --> | ||
- When: <!-- Provide a timeline or timeframe for when these changes should be implemented, preferably on a quarterly basis (e.g., Y24 Q3). --> | ||
|
||
### Linked issue(s) | ||
<!-- Add a checkbox by typing “- [] ”. Then, link to an issue by typing “#” and searching for the issue by text or issue number, or create a new issue. --> | ||
|
||
### OTP PO Discussion meeting details: | ||
- Date: <!-- Specify the date when the discussion meeting took place. --> | ||
- Link(s): <!-- Provide a link or location where the discussion notes or details can be found. This could be a meeting link or another document. --> | ||
|
||
### Extra Comments (Optional) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
98 changes: 98 additions & 0 deletions
98
src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package org.opentripplanner.ext.flex; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.opentripplanner.TestOtpModel; | ||
import org.opentripplanner.ext.flex.trip.FlexTrip; | ||
import org.opentripplanner.ext.flex.trip.UnscheduledTrip; | ||
import org.opentripplanner.routing.graphfinder.NearbyStop; | ||
import org.opentripplanner.standalone.config.sandbox.FlexConfig; | ||
import org.opentripplanner.transit.model.framework.FeedScopedId; | ||
import org.opentripplanner.transit.service.TransitModel; | ||
|
||
/** | ||
* This test makes sure that one of the example feeds in the GTFS-Flex repo works. It's the City of | ||
* Aspen Downtown taxi service which is a completely unscheduled trip that takes you door-to-door in | ||
* the city. | ||
* <p> | ||
* It only contains a single stop time which in GTFS static would not work but is valid in GTFS | ||
* Flex. | ||
*/ | ||
public class GtfsFlexTest extends FlexTest { | ||
|
||
private static TransitModel transitModel; | ||
|
||
@BeforeAll | ||
static void setup() { | ||
TestOtpModel model = FlexTest.buildFlexGraph(ASPEN_GTFS); | ||
transitModel = model.transitModel(); | ||
} | ||
|
||
@Test | ||
void parseAspenTaxiAsUnscheduledTrip() { | ||
var flexTrips = transitModel.getAllFlexTrips(); | ||
assertFalse(flexTrips.isEmpty()); | ||
assertEquals( | ||
Set.of("t_1289262_b_29084_tn_0", "t_1289257_b_28352_tn_0"), | ||
flexTrips.stream().map(FlexTrip::getId).map(FeedScopedId::getId).collect(Collectors.toSet()) | ||
); | ||
|
||
assertEquals( | ||
Set.of(UnscheduledTrip.class), | ||
flexTrips.stream().map(FlexTrip::getClass).collect(Collectors.toSet()) | ||
); | ||
} | ||
|
||
@Test | ||
void calculateAccessTemplate() { | ||
var trip = getFlexTrip(); | ||
var nearbyStop = getNearbyStop(trip); | ||
|
||
var accesses = trip | ||
.getFlexAccessTemplates(nearbyStop, flexDate, calculator, FlexConfig.DEFAULT) | ||
.toList(); | ||
|
||
assertEquals(1, accesses.size()); | ||
|
||
var access = accesses.get(0); | ||
assertEquals(0, access.fromStopIndex); | ||
assertEquals(0, access.toStopIndex); | ||
} | ||
|
||
@Test | ||
void calculateEgressTemplate() { | ||
var trip = getFlexTrip(); | ||
var nearbyStop = getNearbyStop(trip); | ||
var egresses = trip | ||
.getFlexEgressTemplates(nearbyStop, flexDate, calculator, FlexConfig.DEFAULT) | ||
.toList(); | ||
|
||
assertEquals(1, egresses.size()); | ||
|
||
var egress = egresses.get(0); | ||
assertEquals(0, egress.fromStopIndex); | ||
assertEquals(0, egress.toStopIndex); | ||
} | ||
|
||
@Test | ||
void shouldGeneratePatternForFlexTripWithSingleStop() { | ||
assertFalse(transitModel.getAllTripPatterns().isEmpty()); | ||
} | ||
|
||
private static NearbyStop getNearbyStop(FlexTrip<?, ?> trip) { | ||
assertEquals(1, trip.getStops().size()); | ||
var stopLocation = trip.getStops().iterator().next(); | ||
return new NearbyStop(stopLocation, 0, List.of(), null); | ||
} | ||
|
||
private static FlexTrip<?, ?> getFlexTrip() { | ||
var flexTrips = transitModel.getAllFlexTrips(); | ||
return flexTrips.iterator().next(); | ||
} | ||
} |
Oops, something went wrong.