Skip to content

Commit

Permalink
Merge pull request #190 from ibi-group/seattle-flex
Browse files Browse the repository at this point in the history
Add assertions for complex CCSWW flex zones
  • Loading branch information
miles-grant-ibigroup authored Nov 1, 2023
2 parents ff6c6bd + 3d9582e commit 1b9505a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 13 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ jobs:
uses: actions/cache@v3
with:
path: smoke-tests/**/*.pbf
key: osm-${{ matrix.locations.name }}-2023-02-22
restore-keys: |
osm-${{ matrix.locations.name }}
key: osm-${{ matrix.locations.name }}-2023-10-31

- name: Build graph
working-directory: smoke-tests
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@
<dependency>
<groupId>org.opentripplanner</groupId>
<artifactId>otp-client</artifactId>
<version>0.0.16</version>
<version>0.0.20</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion smoke-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ portland/osm.pbf:
${CURL} http://osm.ibi-transit.com/vex/45.424388,-122.885443,45.684746,-122.44084.pbf -o $@

seattle/osm.pbf:
${CURL} http://osm.ibi-transit.com/vex/47.481002,-122.459681,47.734124,-122.224433.pbf -o $@
${CURL} http://osm.ibi-transit.com/vex/47.50925,-122.47458,47.786105,-122.224433.pbf -o $@

build-%: otp.jar %/osm.pbf
java -Xmx6G -jar otp.jar --build --save $*
Expand Down
5 changes: 5 additions & 0 deletions smoke-tests/seattle/build-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"feedId" : "volunteer",
"source" : "https://data.trilliumtransit.com/gtfs/soundgenerations-wa-us/soundgenerations-wa-us-volunteer--flex-v2.zip"
},
{
"type" : "gtfs",
"feedId" : "ccsww-nw",
"source" : "https://data.trilliumtransit.com/gtfs/catholiccommunity-wa-us/catholiccommunity-wa-us-northwest--flex-v2.zip"
},
{
"type" : "gtfs",
"feedId" : "payyourpal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void flexRouteFromCentralAtlantaToPowderSprings() {

var usesZone1Route = transitLegs
.stream()
.map(l -> l.route().shortName())
.map(l -> l.route().name())
.anyMatch(name -> name.equals("Zone 1"));

assertTrue(usesZone1Route);
Expand Down
42 changes: 38 additions & 4 deletions src/test/java/org/opentripplanner/smoketest/SeattleSmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.opentripplanner.client.model.Coordinate;
import org.opentripplanner.client.model.LegMode;
import org.opentripplanner.client.model.Route;
import org.opentripplanner.smoketest.util.SmokeTestRequest;

@Tag("smoke-test")
@Tag("seattle")
public class SeattleSmokeTest {

private static final String CCSWW_ROUTE = "Volunteer Services: Northwest";
Coordinate sodo = new Coordinate(47.5811, -122.3290);
Coordinate clydeHill = new Coordinate(47.6316, -122.2173);

Coordinate boeingCreekPark = new Coordinate(47.755872, -122.361645);
Coordinate ronaldBogPark = new Coordinate(47.75601664, -122.33141);

Coordinate esperance = new Coordinate(47.7957, -122.3470);
Coordinate shoreline = new Coordinate(47.7568, -122.3483);

@Test
public void acrossTheCity() {
var modes = Set.of(TRANSIT, WALK);
Expand All @@ -43,14 +47,44 @@ public void acrossTheCity() {
@Test
public void flexAndTransit() {
var modes = Set.of(WALK, BUS, FLEX_DIRECT, FLEX_EGRESS, FLEX_ACCESS);
SmokeTest.basicRouteTest(
new SmokeTestRequest(boeingCreekPark, ronaldBogPark, modes),
SmokeTest.basicRouteTest(new SmokeTestRequest(shoreline, ronaldBogPark, modes), List.of("BUS"));
}

@Test
public void ccswwIntoKingCounty() {
var modes = Set.of(WALK, FLEX_DIRECT);
var plan = SmokeTest.basicRouteTest(
new SmokeTestRequest(esperance, shoreline, modes),
List.of("BUS")
);
var itin = plan.itineraries().get(0);
var flexLeg = itin.transitLegs().get(0);
assertEquals(CCSWW_ROUTE, flexLeg.route().name());
assertEquals(CCSWW_ROUTE, flexLeg.route().agency().name());
}

@Test
public void ccswwIntoSnohomishCounty() {
var modes = Set.of(WALK, FLEX_DIRECT);
var plan = SmokeTest.basicRouteTest(
new SmokeTestRequest(shoreline, esperance, modes),
List.of("BUS", "WALK")
);
var walkAndFlex = plan
.transitItineraries()
.stream()
.filter(i -> i.transitLegs().stream().anyMatch(l -> l.route().name().equals(CCSWW_ROUTE)))
.findFirst()
.get();
assertEquals(2, walkAndFlex.legs().size());
// walk to the border of King County
assertEquals(LegMode.WALK, walkAndFlex.legs().get(0).mode());
// and take flex inside Snohomish County to the destination
assertEquals(LegMode.BUS, walkAndFlex.legs().get(1).mode());
}

@Test
public void monorailRoute() throws IOException, InterruptedException {
public void monorailRoute() throws IOException {
Set<Object> modes = SmokeTest.API_CLIENT
.routes()
.stream()
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/opentripplanner/smoketest/SmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void assertThatThereAreVehicleRentalStations() {
try {
List<VehicleRentalStation> stations = API_CLIENT.vehicleRentalStations();
assertFalse(stations.isEmpty(), "Found no vehicle rental stations.");
} catch (IOException | InterruptedException e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Expand Down Expand Up @@ -96,7 +96,7 @@ static TripPlan basicRouteTest(SmokeTestRequest req, List<String> expectedModes)

assertThatItineraryHasModes(itineraries, expectedModes);
return plan;
} catch (InterruptedException | IOException e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Expand All @@ -110,7 +110,7 @@ static void assertThereArePatternsWithVehiclePositions() {
vehiclePositions.isEmpty(),
"Found no patterns that have realtime vehicle positions."
);
} catch (IOException | InterruptedException e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Expand Down

0 comments on commit 1b9505a

Please sign in to comment.