Skip to content

Commit d315867

Browse files
committed
Merge branch 'dev-2.x' into fix-update-stale-service
2 parents 21b3650 + 1ebc4f9 commit d315867

File tree

317 files changed

+11136
-3921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

317 files changed

+11136
-3921
lines changed

application/pom.xml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
<dependency>
173173
<groupId>org.mockito</groupId>
174174
<artifactId>mockito-core</artifactId>
175-
<version>5.17.0</version>
175+
<version>5.18.0</version>
176176
<scope>test</scope>
177177
</dependency>
178178
<dependency>
@@ -217,6 +217,12 @@
217217
<artifactId>jersey-media-json-jackson</artifactId>
218218
<version>${jersey.version}</version>
219219
</dependency>
220+
<!-- JAXB serialize Jersey response objects to XML. -->
221+
<dependency>
222+
<groupId>org.glassfish.jersey.media</groupId>
223+
<artifactId>jersey-media-jaxb</artifactId>
224+
<version>${jersey.version}</version>
225+
</dependency>
220226
<!-- HK2 dependency injection framework for injecting context -->
221227
<dependency>
222228
<groupId>org.glassfish.jersey.inject</groupId>
@@ -289,7 +295,7 @@
289295
<dependency>
290296
<groupId>org.onebusaway</groupId>
291297
<artifactId>onebusaway-gtfs</artifactId>
292-
<version>7.0.0</version>
298+
<version>7.0.4</version>
293299
</dependency>
294300
<!-- Processing is used for the debug GUI (though we could probably use just Java2D) -->
295301
<dependency>
@@ -359,7 +365,7 @@
359365
<dependency>
360366
<groupId>com.azure</groupId>
361367
<artifactId>azure-core</artifactId>
362-
<version>1.55.3</version>
368+
<version>1.55.4</version>
363369
</dependency>
364370
<dependency>
365371
<groupId>com.azure</groupId>
@@ -369,7 +375,7 @@
369375
<dependency>
370376
<groupId>com.azure</groupId>
371377
<artifactId>azure-identity</artifactId>
372-
<version>1.16.1</version>
378+
<version>1.16.2</version>
373379
<scope>compile</scope>
374380
</dependency>
375381
<dependency>
@@ -378,6 +384,12 @@
378384
<version>0.28.2</version>
379385
</dependency>
380386

387+
<dependency>
388+
<groupId>org.opentripplanner</groupId>
389+
<artifactId>ojp-java-model</artifactId>
390+
<version>2.0.1</version>
391+
</dependency>
392+
381393
<!-- create zip test files-->
382394
<dependency>
383395
<groupId>org.apache.commons</groupId>

application/src/client/graphiql/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
</script>
4242

4343
<script type="module">
44-
// Import React and ReactDOM
45-
import React from 'react';
46-
import ReactDOM from 'react-dom/client';
47-
// Import GraphiQL and the Explorer plugin
48-
import { GraphiQL } from 'graphiql';
44+
// Import React and ReactDOM
45+
import React from 'react';
46+
import ReactDOM from 'react-dom/client';
47+
// Import GraphiQL and the Explorer plugin
48+
import {GraphiQL} from 'graphiql';
4949

50-
const gtfsExampleQuery = `
50+
const gtfsExampleQuery = `
5151
# This is an example query for fetching all routes of your OTP deployment.
5252
# Click on the documentation icon on the left to read about the available types
5353
# or use autocomplete to explore the schema.

application/src/client/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>OTP Debug</title>
8-
<script type="module" crossorigin src="https://www.opentripplanner.org/debug-client-assets/2025/05/2025-05-28T10:50/assets/index-BSn29HI_.js"></script>
9-
<link rel="stylesheet" crossorigin href="https://www.opentripplanner.org/debug-client-assets/2025/05/2025-05-28T10:50/assets/index-BTWlQV4s.css">
8+
<script type="module" crossorigin src="https://www.opentripplanner.org/debug-client-assets/2025/06/2025-06-19T11:08/assets/index-CqboZTpM.js"></script>
9+
<link rel="stylesheet" crossorigin href="https://www.opentripplanner.org/debug-client-assets/2025/06/2025-06-19T11:08/assets/index-DD3qRJmG.css">
1010
</head>
1111
<body>
1212
<div id="root"></div>

application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.opentripplanner.model.plan.Itinerary;
1919
import org.opentripplanner.routing.api.request.RouteRequest;
2020
import org.opentripplanner.routing.api.request.preference.ItineraryFilterDebugProfile;
21-
import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter;
2221
import org.opentripplanner.routing.graph.Graph;
2322
import org.opentripplanner.standalone.api.OtpServerRequestContext;
2423
import org.opentripplanner.transit.model.basic.Money;
@@ -132,14 +131,14 @@ private static List<Itinerary> getItineraries(
132131
Instant time,
133132
OtpServerRequestContext serverContext
134133
) {
135-
RouteRequest request = new RouteRequest();
136-
request.journey().transit().setFilters(List.of(AllowAllTransitFilter.of()));
137-
request.setDateTime(time);
138-
request.setFrom(from);
139-
request.setTo(to);
140-
request.withPreferences(p ->
141-
p.withItineraryFilter(it -> it.withDebug(ItineraryFilterDebugProfile.LIST_ALL))
142-
);
134+
RouteRequest request = RouteRequest.of()
135+
.withDateTime(time)
136+
.withFrom(from)
137+
.withTo(to)
138+
.withPreferences(p ->
139+
p.withItineraryFilter(it -> it.withDebug(ItineraryFilterDebugProfile.LIST_ALL))
140+
)
141+
.buildRequest();
143142

144143
var result = serverContext.routingService().route(request);
145144

application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.opentripplanner.routing.api.request.RouteRequest;
3232
import org.opentripplanner.routing.api.request.StreetMode;
3333
import org.opentripplanner.routing.api.request.framework.TimeAndCostPenalty;
34-
import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter;
34+
import org.opentripplanner.routing.api.request.request.JourneyRequest;
3535
import org.opentripplanner.routing.graph.Graph;
3636
import org.opentripplanner.transit.service.TimetableRepository;
3737

@@ -40,8 +40,14 @@
4040
*/
4141
public class FlexIntegrationTest {
4242

43-
public static final GenericLocation OUTSIDE_FLEX_ZONE = new GenericLocation(33.7552, -84.4631);
44-
public static final GenericLocation INSIDE_FLEX_ZONE = new GenericLocation(33.8694, -84.6233);
43+
public static final GenericLocation OUTSIDE_FLEX_ZONE = GenericLocation.fromCoordinate(
44+
33.7552,
45+
-84.4631
46+
);
47+
public static final GenericLocation INSIDE_FLEX_ZONE = GenericLocation.fromCoordinate(
48+
33.8694,
49+
-84.6233
50+
);
4551
static Instant dateTime = ZonedDateTime.parse(
4652
"2021-12-02T12:00:00-05:00[America/New_York]"
4753
).toInstant();
@@ -111,7 +117,7 @@ void shouldReturnARouteTransferringFromBusToFlex() {
111117
@Test
112118
void shouldReturnARouteWithTwoTransfers() {
113119
var from = GenericLocation.fromStopId("ALEX DR@ALEX WAY", "MARTA", "97266");
114-
var to = new GenericLocation(33.86701256815635, -84.61787939071655);
120+
var to = GenericLocation.fromCoordinate(33.86701256815635, -84.61787939071655);
115121

116122
var itin = getItinerary(from, to, 3);
117123

@@ -142,9 +148,9 @@ void shouldReturnARouteWithTwoTransfers() {
142148
@Test
143149
void flexDirect() {
144150
// near flex zone
145-
var from = new GenericLocation(33.85281, -84.60271);
151+
var from = GenericLocation.fromCoordinate(33.85281, -84.60271);
146152
// in the middle of flex zone
147-
var to = new GenericLocation(33.86701256815635, -84.61787939071655);
153+
var to = GenericLocation.fromCoordinate(33.86701256815635, -84.61787939071655);
148154

149155
List<Itinerary> itineraries = getItineraries(from, to, true);
150156

@@ -201,7 +207,7 @@ private static void addGtfsToGraph(
201207
new AreaStopsToVerticesMapper(graph, timetableRepository).buildGraph();
202208

203209
// generate direct transfers
204-
var req = new RouteRequest();
210+
var req = RouteRequest.defaultValue();
205211

206212
// we don't have a complete coverage of the entire area so use straight lines for transfers
207213
new DirectTransferGenerator(
@@ -226,33 +232,33 @@ private static List<Itinerary> getItineraries(
226232
GenericLocation to,
227233
boolean onlyDirect
228234
) {
229-
RouteRequest request = new RouteRequest();
230-
request.setDateTime(dateTime);
231-
request.setFrom(from);
232-
request.setTo(to);
233-
request.setNumItineraries(10);
234-
request.setSearchWindow(Duration.ofHours(2));
235-
request.withPreferences(p ->
236-
p.withStreet(s ->
237-
s.withAccessEgress(ae -> ae.withPenalty(Map.of(FLEXIBLE, TimeAndCostPenalty.ZERO)))
235+
RouteRequest request = RouteRequest.of()
236+
.withDateTime(dateTime)
237+
.withFrom(from)
238+
.withTo(to)
239+
.withNumItineraries(10)
240+
.withSearchWindow(Duration.ofHours(2))
241+
.withPreferences(p ->
242+
p.withStreet(s ->
243+
s.withAccessEgress(ae -> ae.withPenalty(Map.of(FLEXIBLE, TimeAndCostPenalty.ZERO)))
244+
)
238245
)
239-
);
240-
241-
var modes = request.journey().modes().copyOf();
242-
243-
if (onlyDirect) {
244-
modes
245-
.withDirectMode(FLEXIBLE)
246-
.withAccessMode(StreetMode.WALK)
247-
.withEgressMode(StreetMode.WALK);
248-
request.journey().transit().setFilters(List.of(AllowAllTransitFilter.of()));
249-
request.journey().transit().disable();
250-
} else {
251-
modes.withEgressMode(FLEXIBLE);
252-
request.journey().transit().setFilters(List.of(AllowAllTransitFilter.of()));
253-
}
254-
255-
request.journey().setModes(modes.build());
246+
.withJourney(journeyBuilder -> {
247+
var modes = JourneyRequest.DEFAULT.modes().copyOf();
248+
249+
if (onlyDirect) {
250+
modes
251+
.withDirectMode(FLEXIBLE)
252+
.withAccessMode(StreetMode.WALK)
253+
.withEgressMode(StreetMode.WALK);
254+
journeyBuilder.withTransit(b -> b.disable());
255+
} else {
256+
modes.withEgressMode(FLEXIBLE);
257+
}
258+
259+
journeyBuilder.setModes(modes.build());
260+
})
261+
.buildRequest();
256262

257263
var result = service.route(request);
258264
var itineraries = result.getTripPlan().itineraries;

application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripIntegrationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.opentripplanner.routing.algorithm.raptoradapter.router.AdditionalSearchDays;
2525
import org.opentripplanner.routing.algorithm.raptoradapter.router.TransitRouter;
2626
import org.opentripplanner.routing.api.request.RouteRequest;
27-
import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter;
2827
import org.opentripplanner.routing.framework.DebugTimingAggregator;
2928
import org.opentripplanner.routing.graph.Graph;
3029
import org.opentripplanner.standalone.api.OtpServerRequestContext;
@@ -158,12 +157,13 @@ private static List<Itinerary> getItineraries(
158157
OtpServerRequestContext serverContext
159158
) {
160159
var zoneId = ZoneIds.NEW_YORK;
161-
RouteRequest request = new RouteRequest();
162-
request.journey().transit().setFilters(List.of(AllowAllTransitFilter.of()));
163160
var dateTime = LocalDateTime.of(2021, Month.DECEMBER, 16, 12, 0).atZone(zoneId);
164-
request.setDateTime(dateTime.toInstant());
165-
request.setFrom(from);
166-
request.setTo(to);
161+
162+
RouteRequest request = RouteRequest.of()
163+
.withDateTime(dateTime.toInstant())
164+
.withFrom(from)
165+
.withTo(to)
166+
.buildRequest();
167167

168168
var transitStartOfTime = ServiceDateUtils.asStartOfService(request.dateTime(), zoneId);
169169
var additionalSearchDays = AdditionalSearchDays.defaults(dateTime);

application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ private static TripPattern delay(TripPattern pattern1, int seconds) {
143143
}
144144

145145
private static TripTimes delay(TripTimes tt, int seconds) {
146-
var delayed = tt.copyScheduledTimes();
147-
IntStream.range(0, delayed.getNumStops()).forEach(i -> {
148-
delayed.updateArrivalDelay(i, seconds);
149-
delayed.updateDepartureDelay(i, seconds);
146+
var builder = tt.createRealTimeFromScheduledTimes();
147+
IntStream.range(0, tt.getNumStops()).forEach(i -> {
148+
builder.withArrivalDelay(i, seconds);
149+
builder.withDepartureDelay(i, seconds);
150150
});
151-
return delayed;
151+
return builder.build();
152152
}
153153

154154
private static List<TripPattern> itineraryPatterns(Itinerary itinerary) {

application/src/ext-test/java/org/opentripplanner/ext/ridehailing/RideHailingAccessShifterTest.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
class RideHailingAccessShifterTest {
3030

3131
private static final Instant TIME = OffsetDateTime.parse("2023-03-23T17:00:00+01:00").toInstant();
32-
private static final GenericLocation FROM = new GenericLocation(0d, 0d);
33-
private static final GenericLocation TO = new GenericLocation(1d, 1d);
32+
private static final GenericLocation FROM = GenericLocation.fromCoordinate(0d, 0d);
33+
private static final GenericLocation TO = GenericLocation.fromCoordinate(1d, 1d);
3434
private static final State DRIVING_STATE = TestStateBuilder.ofDriving()
3535
.streetEdge()
3636
.streetEdge()
@@ -59,11 +59,14 @@ static Stream<Arguments> testCases() {
5959
@ParameterizedTest
6060
@MethodSource("testCases")
6161
void testArrivalDelay(Instant searchTime, Duration expectedArrival) {
62-
var req = new RouteRequest();
63-
req.setTo(FROM);
64-
req.setFrom(TO);
65-
req.setDateTime(searchTime);
66-
req.journey().setModes(RequestModes.of().withAccessMode(StreetMode.CAR_HAILING).build());
62+
var req = RouteRequest.of()
63+
.withTo(FROM)
64+
.withFrom(TO)
65+
.withDateTime(searchTime)
66+
.withJourney(jb ->
67+
jb.setModes(RequestModes.of().withAccessMode(StreetMode.CAR_HAILING).build())
68+
)
69+
.buildRequest();
6770

6871
var result = arrivalDelay(req, List.of(service), TIME);
6972

@@ -126,11 +129,13 @@ void failingService() {
126129
}
127130

128131
private static RouteRequest routeRequest(Instant time) {
129-
var req = new RouteRequest();
130-
req.setDateTime(time);
131-
req.setFrom(FROM);
132-
req.setFrom(TO);
133-
req.journey().setModes(RequestModes.of().withAccessMode(StreetMode.CAR_HAILING).build());
134-
return req;
132+
return RouteRequest.of()
133+
.withDateTime(time)
134+
.withFrom(FROM)
135+
.withTo(TO)
136+
.withJourney(jb ->
137+
jb.setModes(RequestModes.of().withAccessMode(StreetMode.CAR_HAILING).build())
138+
)
139+
.buildRequest();
135140
}
136141
}

0 commit comments

Comments
 (0)