Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-2.x' into upstream-merge-2…
Browse files Browse the repository at this point in the history
…025-02-03
  • Loading branch information
leonardehrenfried committed Feb 3, 2025
2 parents 13ad59b + 843c7f0 commit 778a1bf
Show file tree
Hide file tree
Showing 179 changed files with 5,735 additions and 1,538 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ ead33ffe280dd7caf72cae5ff7a41542e8427636

# json file reformatting with prettier
c287575df6798810a69fafc54c8c4e1867b71367

# prettier formatting for sandbox code
14f2d6bc7622649c817e9f45e4d1a9e6dd94847d
8 changes: 6 additions & 2 deletions .github/workflows/debug-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: Debug client

on:
push:
branches:
- dev-2.x
paths:
- 'client/**'
pull_request:
branches:
- dev-2.x
paths:
- 'client/**'

Expand Down Expand Up @@ -41,11 +45,11 @@ jobs:
working-directory: client
run: |
npm install
npm run build -- --base https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/${VERSION}/
npm run build -- --base https://www.opentripplanner.org/debug-client-assets/${VERSION}/
npm run coverage
- name: Deploy compiled assets to repo
if: github.event_name == 'push' && github.ref == 'refs/heads/dev-2.x'
if: github.event_name == 'push'
env:
REMOTE: debug-client
LOCAL_BRANCH: local-assets
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/schema-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validate schema changes

on:
pull_request:
branches:
- dev-2.x

jobs:
validate-gtfs:
if: github.repository_owner == 'opentripplanner'
name: Validate GraphQL schema changes
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: 'Fetch dev.2.x for diffing'
run: |
git fetch origin dev-2.x --depth 1
- uses: actions/setup-node@v4
with:
node-version: 22

- name: Install GraphQL Inspector
run: |
npm i --global @graphql-inspector/ci graphql @graphql-inspector/diff-command @graphql-inspector/graphql-loader @graphql-inspector/git-loader
- name: Validate GTFS GraphQL schema changes
run: |
graphql-inspector diff 'git:origin/dev-2.x:application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls' 'application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls'
- name: Validate Transmodel GraphQL schema changes
run: |
graphql-inspector diff 'git:origin/dev-2.x:application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql' 'application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ graph.obj
# IntelliJ creates these pid files when you attach the debugger to tests
.attach_pid*

# draw.io backup files
*.svg.bkp

smoke-tests/*.jar
smoke-tests/**/*.obj
smoke-tests/**/*.pbf
Expand Down
16 changes: 15 additions & 1 deletion application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs</artifactId>
<version>5.0.0</version>
<version>5.0.2</version>
</dependency>
<!-- Processing is used for the debug GUI (though we could probably use just Java2D) -->
<dependency>
Expand Down Expand Up @@ -485,6 +485,20 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.hubspot.maven.plugins</groupId>
<artifactId>prettier-maven-plugin</artifactId>
<configuration>
<inputGlobs>
<inputGlob>src/main/java/**/*.java</inputGlob>
<inputGlob>src/ext/java/**/*.java</inputGlob>
<inputGlob>src/test/java/**/*.java</inputGlob>
<inputGlob>src/ext-test/java/**/*.java</inputGlob>
<inputGlob>src/**/*.json</inputGlob>
<inputGlob>src/test/resources/org/opentripplanner/apis/**/*.graphql</inputGlob>
</inputGlobs>
</configuration>
</plugin>
</plugins>
</build>
</project>
6 changes: 3 additions & 3 deletions application/src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OTP Debug</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-20T08:56/assets/index-BKHYHPIc.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-20T08:56/assets/index-BDL0-veX.css">
<script type="module" crossorigin src="https://www.opentripplanner.org/debug-client-assets/2025/01/2025-01-28T11:22/assets/index-BHcP0Ndc.js"></script>
<link rel="stylesheet" crossorigin href="https://www.opentripplanner.org/debug-client-assets/2025/01/2025-01-28T11:22/assets/index-DjMJ6mws.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Set;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.opentripplanner.ext.fares.model.Distance;
import org.opentripplanner.ext.fares.model.FareDistance;
import org.opentripplanner.ext.fares.model.FareDistance.LinearDistance;
import org.opentripplanner.ext.fares.model.FareLegRule;
Expand All @@ -23,6 +22,7 @@
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.PlanTestConstants;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.Distance;
import org.opentripplanner.transit.model.basic.Money;
import org.opentripplanner.transit.model.framework.FeedScopedId;

Expand Down Expand Up @@ -331,15 +331,30 @@ class DistanceFares {
List<FareLegRule> distanceRules = List.of(
FareLegRule
.of(DISTANCE_ID, tenKmProduct)
.withFareDistance(new LinearDistance(Distance.ofKilometers(7), Distance.ofKilometers(10)))
.withFareDistance(
new LinearDistance(
Distance.ofKilometersBoxed(7d, ignore -> {}).orElse(null),
Distance.ofKilometersBoxed(10d, ignore -> {}).orElse(null)
)
)
.build(),
FareLegRule
.of(DISTANCE_ID, threeKmProduct)
.withFareDistance(new LinearDistance(Distance.ofKilometers(3), Distance.ofKilometers(6)))
.withFareDistance(
new LinearDistance(
Distance.ofKilometersBoxed(3d, ignore -> {}).orElse(null),
Distance.ofKilometersBoxed(6d, ignore -> {}).orElse(null)
)
)
.build(),
FareLegRule
.of(DISTANCE_ID, twoKmProduct)
.withFareDistance(new LinearDistance(Distance.ofMeters(0), Distance.ofMeters(2000)))
.withFareDistance(
new LinearDistance(
Distance.ofMetersBoxed(0d, ignore -> {}).orElse(null),
Distance.ofMetersBoxed(2000d, ignore -> {}).orElse(null)
)
)
.build()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ void calculateFareThatIncludesNoFreeTransfers() {
);
calculateFare(rides, FareType.youth, Money.ZERO_USD);
// We don't get any fares for the skagit transit leg below here because they don't accept ORCA (electronic)
calculateFare(rides, FareType.electronicSpecial, ONE_DOLLAR.plus(ONE_DOLLAR).plus(DEFAULT_TEST_RIDE_PRICE.times(2)));
calculateFare(
rides,
FareType.electronicRegular,
DEFAULT_TEST_RIDE_PRICE.times(4)
FareType.electronicSpecial,
ONE_DOLLAR.plus(ONE_DOLLAR).plus(DEFAULT_TEST_RIDE_PRICE.times(2))
);
calculateFare(rides, FareType.electronicRegular, DEFAULT_TEST_RIDE_PRICE.times(4));
calculateFare(
rides,
FareType.electronicSenior,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,4 @@ public static StopTime regularStop(int arrivalTime, int departureTime) {
stopTime.setTrip(TRIP);
return stopTime;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ private static List<List<StopTime>> isNotScheduledDeviatedTripCases() {
areaWithContinuousStopping("10:40"),
regularStop("10:50", "11:00")
),
List.of(
regularStop("10:10"),
regularStop("10:20")
)
List.of(regularStop("10:10"), regularStop("10:20"))
);
}

Expand All @@ -57,6 +54,4 @@ private static List<List<StopTime>> isNotScheduledDeviatedTripCases() {
void isNotScheduledDeviatedTrip(List<StopTime> stopTimes) {
assertFalse(ScheduledDeviatedTrip.isScheduledDeviatedFlexTrip(stopTimes));
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,20 @@ class IsUnscheduledTrip {

private static final StopTime SCHEDULED_STOP = FlexStopTimesForTest.regularStop("10:00");
private static final StopTime UNSCHEDULED_STOP = FlexStopTimesForTest.area("10:10", "10:20");
private static final StopTime CONTINUOUS_PICKUP_STOP = FlexStopTimesForTest.regularStopWithContinuousPickup("10:30");
private static final StopTime CONTINUOUS_DROP_OFF_STOP = FlexStopTimesForTest.regularStopWithContinuousDropOff("10:40");
private static final StopTime CONTINUOUS_PICKUP_STOP = FlexStopTimesForTest.regularStopWithContinuousPickup(
"10:30"
);
private static final StopTime CONTINUOUS_DROP_OFF_STOP = FlexStopTimesForTest.regularStopWithContinuousDropOff(
"10:40"
);

// disallowed by the GTFS spec
private static final StopTime FLEX_AND_CONTINUOUS_PICKUP_STOP = FlexStopTimesForTest.areaWithContinuousPickup("10:50");
private static final StopTime FLEX_AND_CONTINUOUS_DROP_OFF_STOP = FlexStopTimesForTest.areaWithContinuousDropOff("11:00");
private static final StopTime FLEX_AND_CONTINUOUS_PICKUP_STOP = FlexStopTimesForTest.areaWithContinuousPickup(
"10:50"
);
private static final StopTime FLEX_AND_CONTINUOUS_DROP_OFF_STOP = FlexStopTimesForTest.areaWithContinuousDropOff(
"11:00"
);

static List<List<StopTime>> notUnscheduled() {
return List.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class StopClusterMapperTest {
.siteRepositoryBuilder()
.withRegularStops(STOPS)
.build();
private static final TimetableRepository TRANSIT_MODEL = new TimetableRepository(
private static final TimetableRepository TIMETABLE_REPOSITORY = new TimetableRepository(
SITE_REPOSITORY,
new Deduplicator()
);
Expand All @@ -40,8 +40,8 @@ void clusterConsolidatedStops() {
var repo = new DefaultStopConsolidationRepository();
repo.addGroups(List.of(new ConsolidatedStopGroup(STOP_A.getId(), List.of(STOP_B.getId()))));

var service = new DefaultStopConsolidationService(repo, TRANSIT_MODEL);
var mapper = new StopClusterMapper(new DefaultTransitService(TRANSIT_MODEL), service);
var service = new DefaultStopConsolidationService(repo, TIMETABLE_REPOSITORY);
var mapper = new StopClusterMapper(new DefaultTransitService(TIMETABLE_REPOSITORY), service);

var clusters = mapper.generateStopClusters(LOCATIONS, List.of());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ private <D extends Enum<?>, A extends Enum<?>> void verifyExplicitMatch(
}
assertTrue(rest.isEmpty());
}

}
Loading

0 comments on commit 778a1bf

Please sign in to comment.