Skip to content

Commit

Permalink
Apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Jun 2, 2024
1 parent 19b9ab9 commit 22aa4b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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 {

Expand All @@ -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();
Expand Down Expand Up @@ -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);
}
Expand All @@ -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();
Expand All @@ -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);
}

Expand Down Expand Up @@ -254,7 +260,7 @@ private UpdateResult applyEstimatedTimetable(
}

private Trip createTrip(String id, Route route, List<Stop> 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())
Expand Down

0 comments on commit 22aa4b1

Please sign in to comment.