Skip to content

Commit

Permalink
Merge branch 'dev-2.x' into fix-nextLeg-outOfBounds
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Oct 17, 2024
2 parents 0b1aea2 + 440498f commit c6688b3
Show file tree
Hide file tree
Showing 294 changed files with 3,236 additions and 2,111 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@

# reorder and reformat GTFS GraphQL API schema file with graphql-java
14051fab312a67cae9a460aaf0bbc77223bec624

# Make OTP a multi-module project
ead33ffe280dd7caf72cae5ff7a41542e8427636
4 changes: 2 additions & 2 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
if: github.event_name == 'pull_request'

- name: Install Python dependencies
run: pip install --break-system-packages -r doc/user/requirements.txt
run: pip install -r doc/user/requirements.txt


- name: Build main documentation
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 22
- name: Run code generator
working-directory: application/src/main/java/org/opentripplanner/apis/gtfs/generated
run: |
Expand Down
2 changes: 1 addition & 1 deletion application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.13.0</version>
<version>5.14.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions application/src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<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 Client</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-09T18:54/assets/index-C6b5LCY-.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-09T18:54/assets/index-BcsxnGE8.css">
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-17T07:45/assets/index-CZI6LO02.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/10/2024-10-17T07:45/assets/index-BqgnKsMX.css">
</head>
<body>
<div id="root"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.opentripplanner.model.plan.Itinerary.createScheduledTransitItinerary;
import static org.opentripplanner.transit.model._data.TransitModelForTest.id;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;

import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
Expand All @@ -21,7 +21,7 @@
import org.opentripplanner.model.plan.ScheduledTransitLegBuilder;
import org.opentripplanner.model.plan.StreetLeg;
import org.opentripplanner.street.search.TraverseMode;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.TransitMode;
import org.opentripplanner.transit.model.framework.Deduplicator;
import org.opentripplanner.transit.model.framework.FeedScopedId;
Expand All @@ -46,9 +46,13 @@ class EmissionsTest {
.withEndTime(TIME.plusHours(1))
.build();

private static final Route ROUTE_WITH_EMISSIONS = TransitModelForTest.route(id("1")).build();
private static final Route ROUTE_WITH_ZERO_EMISSIONS = TransitModelForTest.route(id("2")).build();
private static final Route ROUTE_WITHOUT_EMISSIONS_CONFIGURED = TransitModelForTest
private static final Route ROUTE_WITH_EMISSIONS = TimetableRepositoryForTest
.route(id("1"))
.build();
private static final Route ROUTE_WITH_ZERO_EMISSIONS = TimetableRepositoryForTest
.route(id("2"))
.build();
private static final Route ROUTE_WITHOUT_EMISSIONS_CONFIGURED = TimetableRepositoryForTest
.route(id("3"))
.build();

Expand Down Expand Up @@ -119,12 +123,15 @@ private ScheduledTransitLeg createTransitLeg(Route route) {
var stoptime = new StopTime();
var stopTimes = new ArrayList<StopTime>();
stopTimes.add(stoptime);
var testModel = TransitModelForTest.of();
var testModel = TimetableRepositoryForTest.of();
var stopOne = testModel.stop("1:stop1", 60, 25).build();
var stopTwo = testModel.stop("1:stop1", 61, 25).build();
var stopThree = testModel.stop("1:stop1", 62, 25).build();
var stopPattern = TransitModelForTest.stopPattern(stopOne, stopTwo, stopThree);
var pattern = TransitModelForTest.tripPattern("1", route).withStopPattern(stopPattern).build();
var stopPattern = TimetableRepositoryForTest.stopPattern(stopOne, stopTwo, stopThree);
var pattern = TimetableRepositoryForTest
.tripPattern("1", route)
.withStopPattern(stopPattern)
.build();
var trip = Trip
.of(FeedScopedId.parse("FOO:BAR"))
.withMode(TransitMode.BUS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary;
import static org.opentripplanner.transit.model._data.TransitModelForTest.id;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;

import java.util.List;
import org.junit.jupiter.api.Test;
Expand All @@ -13,12 +13,12 @@
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.PlanTestConstants;
import org.opentripplanner.routing.fares.FareService;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.Money;

public class FaresFilterTest implements PlanTestConstants {

private final TransitModelForTest testModel = TransitModelForTest.of();
private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of();

@Test
void shouldAddFare() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.PlanTestConstants;
import org.opentripplanner.routing.core.FareType;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.Money;
import org.opentripplanner.transit.model.network.Route;

class CombinedInterlinedLegsFareServiceTest implements PlanTestConstants {

static final Route route = TransitModelForTest.route("route-1").build();
static final Route route = TimetableRepositoryForTest.route("route-1").build();
static final Itinerary interlinedWithDifferentRoute = newItinerary(
Place.forStop(AIRPORT_STOP),
T11_00
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.PlanTestConstants;
import org.opentripplanner.routing.core.FareType;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.Money;

class DefaultFareServiceTest implements PlanTestConstants {
Expand Down Expand Up @@ -116,7 +116,7 @@ void shouldNotCombineInterlinedLegs() {
var itin = newItinerary(Place.forStop(AIRPORT_STOP), T11_00)
.bus(1, T11_05, T11_12, Place.forStop(CITY_CENTER_A_STOP))
.staySeatedBus(
TransitModelForTest.route("123").build(),
TimetableRepositoryForTest.route("123").build(),
2,
T11_12,
T11_16,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package org.opentripplanner.ext.fares.impl;

import static org.opentripplanner.transit.model._data.TransitModelForTest.OTHER_FEED_AGENCY;
import static org.opentripplanner.transit.model._data.TransitModelForTest.id;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.OTHER_FEED_AGENCY;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;

import org.opentripplanner.ext.fares.model.FareAttribute;
import org.opentripplanner.ext.fares.model.FareRuleSet;
import org.opentripplanner.framework.geometry.WgsCoordinate;
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.framework.i18n.NonLocalizedString;
import org.opentripplanner.transit.model.basic.Money;
import org.opentripplanner.transit.model.basic.TransitMode;
import org.opentripplanner.transit.model.framework.FeedScopedId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.standalone.api.OtpServerRequestContext;
import org.opentripplanner.transit.model.basic.Money;
import org.opentripplanner.transit.service.TransitModel;
import org.opentripplanner.transit.service.TimetableRepository;

public class FaresIntegrationTest {

@Test
public void testBasic() {
TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.CALTRAIN_GTFS);
var graph = model.graph();
var transitModel = model.transitModel();
var timetableRepository = model.timetableRepository();

var feedId = transitModel.getFeedIds().iterator().next();
var feedId = timetableRepository.getFeedIds().iterator().next();

var serverContext = TestServerContext.createServerContext(graph, transitModel);
var serverContext = TestServerContext.createServerContext(graph, timetableRepository);

var start = LocalDateTime
.of(2009, Month.AUGUST, 7, 12, 0, 0)
Expand All @@ -53,10 +53,10 @@ public void testBasic() {
public void testPortland() {
TestOtpModel model = ConstantsForTests.getInstance().getCachedPortlandGraph();
Graph graph = model.graph();
TransitModel transitModel = model.transitModel();
var portlandId = transitModel.getFeedIds().iterator().next();
TimetableRepository timetableRepository = model.timetableRepository();
var portlandId = timetableRepository.getFeedIds().iterator().next();

var serverContext = TestServerContext.createServerContext(graph, transitModel);
var serverContext = TestServerContext.createServerContext(graph, timetableRepository);

// from zone 3 to zone 2
var from = GenericLocation.fromStopId(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary;
import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID;
import static org.opentripplanner.transit.model._data.TransitModelForTest.id;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;

import com.google.common.collect.Multimaps;
import java.time.Duration;
Expand All @@ -22,13 +22,13 @@
import org.opentripplanner.model.plan.Itinerary;
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.PlanTestConstants;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.Money;
import org.opentripplanner.transit.model.framework.FeedScopedId;

class GtfsFaresV2ServiceTest implements PlanTestConstants {

private final TransitModelForTest testModel = TransitModelForTest.of();
private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of();

FeedScopedId LEG_GROUP1 = id("leg-group1");
FeedScopedId LEG_GROUP2 = id("leg-group2");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.opentripplanner.ext.fares.impl;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary;
import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID;
import static org.opentripplanner.transit.model.basic.Money.euros;

import java.util.LinkedList;
Expand All @@ -21,7 +20,7 @@
import org.opentripplanner.model.plan.PlanTestConstants;
import org.opentripplanner.routing.core.FareType;
import org.opentripplanner.routing.fares.FareService;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.basic.Money;
import org.opentripplanner.transit.model.basic.TransitMode;
import org.opentripplanner.transit.model.framework.FeedScopedId;
Expand Down Expand Up @@ -76,7 +75,7 @@ private static List<Arguments> createTestCases() {
FareZone C = FareZone.of(new FeedScopedId(FEED_ID, "C")).build();
FareZone D = FareZone.of(new FeedScopedId(FEED_ID, "D")).build();

var testModel = TransitModelForTest.of();
var testModel = TimetableRepositoryForTest.of();
Place A1 = testModel.place("A1", sb -> sb.withCoordinate(10.0, 12.0).addFareZones(A));
Place A2 = testModel.place("A2", sb -> sb.withCoordinate(10.0, 12.0).addFareZones(A));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary;
import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID;
import static org.opentripplanner.transit.model._data.TransitModelForTest.id;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID;
import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id;

import java.time.Duration;
import java.util.LinkedList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.street.model.StreetTraversalPermission;
import org.opentripplanner.street.model._data.StreetModelForTest;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.framework.Deduplicator;
import org.opentripplanner.transit.model.site.AreaStop;
import org.opentripplanner.transit.service.StopModel;
import org.opentripplanner.transit.service.TransitModel;
import org.opentripplanner.transit.service.TimetableRepository;

class AreaStopsToVerticesMapperTest {

private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of();
private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of();

private static final AreaStop BERLIN_AREA_STOP = TEST_MODEL
.areaStop("berlin")
Expand All @@ -38,7 +38,10 @@ class AreaStopsToVerticesMapperTest {
.withAreaStop(AreaStopsToVerticesMapperTest.BERLIN_AREA_STOP)
.build();

public static final TransitModel TRANSIT_MODEL = new TransitModel(STOP_MODEL, new Deduplicator());
public static final TimetableRepository TRANSIT_MODEL = new TimetableRepository(
STOP_MODEL,
new Deduplicator()
);

static List<TestCase> testCases() {
return List.of(
Expand Down
Loading

0 comments on commit c6688b3

Please sign in to comment.