Skip to content

Commit

Permalink
fix test conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Dec 17, 2024
1 parent 15ea30a commit f72b9a4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.locationtech.jts.geom.Coordinate;
import org.opentripplanner._support.text.I18NStrings;
import org.opentripplanner._support.time.ZoneIds;
import org.opentripplanner.ext.fares.FaresToItineraryMapper;
import org.opentripplanner.ext.fares.impl.DefaultFareService;
import org.opentripplanner.framework.geometry.WgsCoordinate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,6 @@ class DefaultTransitServiceTest {

private static final FeedScopedId SERVICE_ID = new FeedScopedId("FEED", "SERVICE");
private static final int SERVICE_CODE = 0;
private static final Trip TRIP = TimetableRepositoryForTest.trip("REAL_TIME_TRIP").build();
private static final Trip ADDED_TRIP = TimetableRepositoryForTest
.trip("REAL_TIME_ADDED_TRIP")
.withServiceId(SERVICE_ID)
.build();
private static final ScheduledTripTimes SCHEDULED_TRIP_TIMES = ScheduledTripTimes
.of()
.withTrip(TRIP)
.withArrivalTimes(new int[] { 0, 1 })
.withDepartureTimes(new int[] { 0, 1 })
.withServiceCode(SERVICE_CODE)
.build();

private static final TripPattern RAIL_PATTERN = TEST_MODEL
.pattern(RAIL)
.withScheduledTimeTableBuilder(builder -> builder.addTripTimes(SCHEDULED_TRIP_TIMES))
.build();
private static final TripPattern FERRY_PATTERN = TEST_MODEL.pattern(FERRY).build();
private static final TripPattern BUS_PATTERN = TEST_MODEL.pattern(BUS).build();

Expand All @@ -86,6 +69,23 @@ class DefaultTransitServiceTest {
.withHeadsign(I18NString.of("Trip Headsign"))
.withServiceId(CALENDAR_ID)
.build();
private static final Trip ADDED_TRIP = TimetableRepositoryForTest
.trip("REAL_TIME_ADDED_TRIP")
.withServiceId(CALENDAR_ID)
.build();
private static final ScheduledTripTimes SCHEDULED_TRIP_TIMES = ScheduledTripTimes
.of()
.withTrip(TRIP)
.withArrivalTimes(new int[] { 0, 1 })
.withDepartureTimes(new int[] { 0, 1 })
.withServiceCode(SERVICE_CODE)
.build();

private static final TripPattern RAIL_PATTERN = TEST_MODEL
.pattern(RAIL)
.withScheduledTimeTableBuilder(builder -> builder.addTripTimes(SCHEDULED_TRIP_TIMES))
.build();

private static final int DELAY = 120;
private static final RealTimeTripTimes REALTIME_TRIP_TIMES = SCHEDULED_TRIP_TIMES.copyScheduledTimes();
private static final RealTimeTripTimes ADDED_TRIP_TIMES = RealTimeTripTimes.of(
Expand Down Expand Up @@ -128,7 +128,10 @@ static void setup() {
CalendarServiceData calendarServiceData = new CalendarServiceData();
var firstDate = LocalDate.of(2024, 8, 8);
var secondDate = LocalDate.of(2024, 8, 9);
calendarServiceData.putServiceDatesForServiceId(CALENDAR_ID, List.of(firstDate, secondDate));
calendarServiceData.putServiceDatesForServiceId(
CALENDAR_ID,
List.of(firstDate, secondDate, SERVICE_DATE)
);
transitModel.getServiceCodes().put(CALENDAR_ID, 0);
transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP);

Expand All @@ -146,7 +149,7 @@ static void setup() {
RealTimeTripTimes tripTimes = RealTimeTripTimes.of(
ScheduledTripTimes
.of()
.withTrip(TimetableRepositoryForTest.trip("REAL_TIME_TRIP").build())
.withTrip(TimetableRepositoryForTest.trip("123").build())
.withDepartureTimes(new int[] { 0, 1 })
.build()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
},
{
"gtfsId": "F:321Canceled",
"gtfsId": "F:REPLACEMENT_TRIP",
"stoptimes": [
{
"stop": {
Expand All @@ -68,9 +68,9 @@
"scheduledDeparture": 41400,
"stopPosition": 10,
"stopPositionInPattern": 0,
"realtimeState": "CANCELED",
"pickupType": null,
"dropoffType": null
"realtimeState": "SCHEDULED",
"pickupType": "SCHEDULED",
"dropoffType": "SCHEDULED"
},
{
"stop": {
Expand All @@ -82,9 +82,9 @@
"scheduledDeparture": 41700,
"stopPosition": 20,
"stopPositionInPattern": 1,
"realtimeState": "CANCELED",
"pickupType": null,
"dropoffType": null
"realtimeState": "SCHEDULED",
"pickupType": "SCHEDULED",
"dropoffType": "SCHEDULED"
},
{
"stop": {
Expand All @@ -96,17 +96,17 @@
"scheduledDeparture": 42000,
"stopPosition": 30,
"stopPositionInPattern": 2,
"realtimeState": "CANCELED",
"pickupType": null,
"dropoffType": null
"realtimeState": "SCHEDULED",
"pickupType": "SCHEDULED",
"dropoffType": "SCHEDULED"
}
],
"occupancy": {
"occupancyStatus": "NO_DATA_AVAILABLE"
}
},
{
"gtfsId": "F:REPLACEMENT_TRIP",
"gtfsId": "F:321Canceled",
"stoptimes": [
{
"stop": {
Expand All @@ -118,9 +118,9 @@
"scheduledDeparture": 41400,
"stopPosition": 10,
"stopPositionInPattern": 0,
"realtimeState": "SCHEDULED",
"pickupType": "SCHEDULED",
"dropoffType": "SCHEDULED"
"realtimeState": "CANCELED",
"pickupType": null,
"dropoffType": null
},
{
"stop": {
Expand All @@ -132,9 +132,9 @@
"scheduledDeparture": 41700,
"stopPosition": 20,
"stopPositionInPattern": 1,
"realtimeState": "SCHEDULED",
"pickupType": "SCHEDULED",
"dropoffType": "SCHEDULED"
"realtimeState": "CANCELED",
"pickupType": null,
"dropoffType": null
},
{
"stop": {
Expand All @@ -146,9 +146,9 @@
"scheduledDeparture": 42000,
"stopPosition": 30,
"stopPositionInPattern": 2,
"realtimeState": "SCHEDULED",
"pickupType": "SCHEDULED",
"dropoffType": "SCHEDULED"
"realtimeState": "CANCELED",
"pickupType": null,
"dropoffType": null
}
],
"occupancy": {
Expand Down

0 comments on commit f72b9a4

Please sign in to comment.