From 22aa4b1cd8e7f0fe04f36340e5d72668fd66ac2c Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Sun, 2 Jun 2024 22:07:46 +0200 Subject: [PATCH] Apply review feedback --- .../transit/model/timetable/TripTimes.java | 2 +- .../updater/trip/RealtimeTestEnvironment.java | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java b/src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java index 7bf1a826c1c..7ff66f0b90e 100644 --- a/src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java +++ b/src/main/java/org/opentripplanner/transit/model/timetable/TripTimes.java @@ -12,7 +12,7 @@ /** * A TripTimes represents the arrival and departure times for a single trip in a timetable. It is - * one of the core class used for transit routing. This interface allow different kind of trip + * one of the core class used for transit routing. This interface allows different kind of trip * to implement their own trip times. Scheduled/planned trips should be immutable, real-time * trip times should allow updates and more info, frequency-based trips can use a more compact * implementation, and Flex may expose part of the trip as a "scheduled/regular" stop-to-stop diff --git a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java b/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java index d32cee09359..88076a3bdce 100644 --- a/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java +++ b/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java @@ -41,7 +41,7 @@ * Since it's not possible to add a Siri and GTFS updater to the transit model at the same time, * they each have their own test environment. *

- * It is however a goal to change that and then these two can be combined together. + * It is however a goal to change that and then these two can be combined. */ public final class RealtimeTestEnvironment { @@ -50,7 +50,7 @@ public final class RealtimeTestEnvironment { false ); public static final LocalDate SERVICE_DATE = LocalDate.of(2024, 5, 8); - public static final FeedScopedId CAL_ID = TransitModelForTest.id("CAL_1"); + public static final FeedScopedId SERVICE_ID = TransitModelForTest.id("CAL_1"); private final TransitModelForTest testModel = TransitModelForTest.of(); public final ZoneId timeZone = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); public final Station stationA = testModel.station("A").build(); @@ -84,10 +84,16 @@ private enum SourceType { SIRI, } + /** + * Siri and GTFS-RT cannot be run at the same time, so you need to decide. + */ public static RealtimeTestEnvironment siri() { return new RealtimeTestEnvironment(SourceType.SIRI); } + /** + * Siri and GTFS-RT cannot be run at the same time, so you need to decide. + */ public static RealtimeTestEnvironment gtfs() { return new RealtimeTestEnvironment(SourceType.GTFS_RT); } @@ -110,10 +116,10 @@ private RealtimeTestEnvironment(SourceType sourceType) { CalendarServiceData calendarServiceData = new CalendarServiceData(); calendarServiceData.putServiceDatesForServiceId( - CAL_ID, + SERVICE_ID, List.of(SERVICE_DATE.minusDays(1), SERVICE_DATE, SERVICE_DATE.plusDays(1)) ); - transitModel.getServiceCodes().put(CAL_ID, 0); + transitModel.getServiceCodes().put(SERVICE_ID, 0); transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); transitModel.index(); @@ -131,7 +137,7 @@ private RealtimeTestEnvironment(SourceType sourceType) { dateTimeHelper = new DateTimeHelper(timeZone, RealtimeTestEnvironment.SERVICE_DATE); } - public FeedScopedId id(String id) { + public static FeedScopedId id(String id) { return TransitModelForTest.id(id); } @@ -254,7 +260,7 @@ private UpdateResult applyEstimatedTimetable( } private Trip createTrip(String id, Route route, List stops) { - var trip = Trip.of(id(id)).withRoute(route).withServiceId(CAL_ID).build(); + var trip = Trip.of(id(id)).withRoute(route).withServiceId(SERVICE_ID).build(); var tripOnServiceDate = TripOnServiceDate .of(trip.getId())