Skip to content

Commit

Permalink
feat(plan query): add request modes
Browse files Browse the repository at this point in the history
add car, park and ride, bike and ride as request modes
  • Loading branch information
tobsesHub committed Jun 11, 2024
1 parent c32faab commit 7289a0d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ public enum RequestMode {
SUBWAY("SUBWAY"),
TRAM("TRAM"),
FERRY("FERRY"),
CAR("CAR"),
CAR_PARK("CAR", "PARK"),
SCOOTER_RENT("SCOOTER", "RENT"),
BICYCLE("BICYCLE"),
BICYCLE_PARK("BICYCLE", "PARK"),
BICYCLE_RENT("BICYCLE", "RENT"),
FLEX_DIRECT("FLEX", "DIRECT"),
FLEX_ACCESS("FLEX", "ACCESS"),
Expand Down
51 changes: 51 additions & 0 deletions src/test/java/org/opentripplanner/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,57 @@ public void bikePlan() throws IOException {
assertNotNull(result.itineraries().get(0).legs().get(0).startTime());
}

@Test
public void bikeAndParkPlan() throws IOException {

var result =
client.plan(
TripPlanParameters.builder()
.withFrom(OSLO_WEST)
.withTo(OSLO_EAST)
.withTime(LocalDateTime.now())
.withModes(Set.of(RequestMode.BICYCLE_PARK, RequestMode.TRANSIT))
.build());

LOG.info("Received {} itineraries", result.itineraries().size());

assertNotNull(result.itineraries().get(0).legs().get(0).startTime());
}

@Test
public void carPlan() throws IOException {

var result =
client.plan(
TripPlanParameters.builder()
.withFrom(OSLO_WEST)
.withTo(OSLO_EAST)
.withTime(LocalDateTime.now())
.withModes(Set.of(RequestMode.CAR))
.build());

LOG.info("Received {} itineraries", result.itineraries().size());

assertNotNull(result.itineraries().get(0).legs().get(0).startTime());
}

@Test
public void carAndParkPlan() throws IOException {

var result =
client.plan(
TripPlanParameters.builder()
.withFrom(OSLO_WEST)
.withTo(OSLO_EAST)
.withTime(LocalDateTime.now())
.withModes(Set.of(RequestMode.CAR_PARK, RequestMode.TRANSIT))
.build());

LOG.info("Received {} itineraries", result.itineraries().size());

assertNotNull(result.itineraries().get(0).legs().get(0).startTime());
}

@Test
public void rentalStations() throws IOException {

Expand Down

0 comments on commit 7289a0d

Please sign in to comment.