diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java index f5ad2b471ab..74a54794461 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FaresIntegrationTest.java @@ -34,7 +34,7 @@ public void testBasic() { var feedId = timetableRepository.getFeedIds().iterator().next(); - var serverContext = TestServerContext.createServerContext(graph, timetableRepository); + var serverContext = TestServerContext.createServerContext(graph, timetableRepository, model.fareServiceFactory().makeFareService()); var start = LocalDateTime .of(2009, Month.AUGUST, 7, 12, 0, 0) @@ -56,7 +56,7 @@ public void testPortland() { TimetableRepository timetableRepository = model.timetableRepository(); var portlandId = timetableRepository.getFeedIds().iterator().next(); - var serverContext = TestServerContext.createServerContext(graph, timetableRepository); + var serverContext = TestServerContext.createServerContext(graph, timetableRepository, model.fareServiceFactory().makeFareService()); // from zone 3 to zone 2 var from = GenericLocation.fromStopId( diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java index fb19f1dff36..51143fb3a40 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java @@ -18,6 +18,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.TestOtpModel; import org.opentripplanner.TestServerContext; +import org.opentripplanner.ext.fares.impl.DefaultFareServiceFactory; import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.module.DirectTransferGenerator; @@ -32,6 +33,7 @@ import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.TimeAndCostPenalty; import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter; +import org.opentripplanner.routing.fares.FareServiceFactory; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.service.TimetableRepository; @@ -58,7 +60,6 @@ static void setup() { TestOtpModel model = FlexIntegrationTestData.cobbOsm(); graph = model.graph(); timetableRepository = model.timetableRepository(); - addGtfsToGraph( graph, timetableRepository, @@ -66,9 +67,10 @@ static void setup() { FlexIntegrationTestData.COBB_BUS_30_GTFS, FlexIntegrationTestData.MARTA_BUS_856_GTFS, FlexIntegrationTestData.COBB_FLEX_GTFS - ) + ), + new DefaultFareServiceFactory() ); - service = TestServerContext.createServerContext(graph, timetableRepository).routingService(); + service = TestServerContext.createServerContext(graph, timetableRepository, model.fareServiceFactory().makeFareService()).routingService(); } @Test @@ -179,7 +181,8 @@ static void teardown() { private static void addGtfsToGraph( Graph graph, TimetableRepository timetableRepository, - List gtfsFiles + List gtfsFiles, + FareServiceFactory fareServiceFactory ) { // GTFS var gtfsBundles = gtfsFiles.stream().map(GtfsBundle::new).toList(); @@ -187,7 +190,9 @@ private static void addGtfsToGraph( gtfsBundles, timetableRepository, graph, - ServiceDateInterval.unbounded() + DataImportIssueStore.NOOP, + ServiceDateInterval.unbounded(), + fareServiceFactory ); gtfsModule.buildGraph(); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java index 87106394708..76f10fa18d0 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java @@ -8,7 +8,9 @@ import java.util.Map; import org.opentripplanner.ConstantsForTests; import org.opentripplanner.TestOtpModel; +import org.opentripplanner.ext.fares.impl.DefaultFareServiceFactory; import org.opentripplanner.framework.application.OTPFeature; +import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.gtfs.graphbuilder.GtfsBundle; import org.opentripplanner.gtfs.graphbuilder.GtfsModule; import org.opentripplanner.model.calendar.ServiceDateInterval; @@ -49,7 +51,9 @@ private static TestOtpModel buildFlexGraph(File file) { List.of(gtfsBundle), timetableRepository, graph, - new ServiceDateInterval(LocalDate.of(2021, 1, 1), LocalDate.of(2022, 1, 1)) + DataImportIssueStore.NOOP, + new ServiceDateInterval(LocalDate.of(2021, 1, 1), LocalDate.of(2022, 1, 1)), + new DefaultFareServiceFactory() ); OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, true)); module.buildGraph(); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripIntegrationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripIntegrationTest.java index 3a8e33cfbf2..acfb2607fef 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripIntegrationTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripIntegrationTest.java @@ -6,24 +6,17 @@ import java.time.LocalDateTime; import java.time.Month; -import java.time.OffsetDateTime; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.TestOtpModel; import org.opentripplanner.TestServerContext; import org.opentripplanner._support.time.ZoneIds; -import org.opentripplanner.ext.fares.DecorateWithFare; +import org.opentripplanner.ext.fares.impl.DefaultFareService; import org.opentripplanner.ext.flex.FlexIntegrationTestData; -import org.opentripplanner.ext.flex.FlexParameters; -import org.opentripplanner.ext.flex.FlexRouter; -import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.framework.geometry.EncodedPolyline; -import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.graph_builder.module.ValidateAndInterpolateStopTimesForEachTrip; import org.opentripplanner.model.GenericLocation; import org.opentripplanner.model.StopTime; @@ -34,15 +27,9 @@ import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter; import org.opentripplanner.routing.framework.DebugTimingAggregator; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.routing.graphfinder.NearbyStop; import org.opentripplanner.standalone.api.OtpServerRequestContext; -import org.opentripplanner.street.model.vertex.StreetLocation; -import org.opentripplanner.street.search.request.StreetSearchRequest; -import org.opentripplanner.street.search.state.State; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.grouppriority.TransitGroupPriorityService; -import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.utils.time.ServiceDateUtils; @@ -92,41 +79,6 @@ void parseCobbCountyAsScheduledDeviatedTrip() { assertEquals(-84.63430143459385, flexZone.getLon(), delta); } - @Test - void calculateDirectFare() { - OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, true)); - var trip = getFlexTrip(); - - var from = getNearbyStop(trip, "from-stop"); - var to = getNearbyStop(trip, "to-stop"); - - var router = new FlexRouter( - graph, - new DefaultTransitService(timetableRepository), - FlexParameters.defaultValues(), - OffsetDateTime.parse("2021-11-12T10:15:24-05:00").toInstant(), - null, - 1, - 1, - List.of(from), - List.of(to) - ); - - var filter = new DecorateWithFare(graph.getFareService()); - - var itineraries = router - .createFlexOnlyItineraries(false) - .stream() - .peek(filter::decorate) - .toList(); - - var itinerary = itineraries.getFirst(); - - assertFalse(itinerary.getFares().getLegProducts().isEmpty()); - - OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, false)); - } - /** * Trips which consist of flex and fixed-schedule stops should work in transit mode. *

@@ -137,7 +89,7 @@ void calculateDirectFare() { void flexTripInTransitMode() { var feedId = timetableRepository.getFeedIds().iterator().next(); - var serverContext = TestServerContext.createServerContext(graph, timetableRepository); + var serverContext = TestServerContext.createServerContext(graph, timetableRepository, new DefaultFareService()); // from zone 3 to zone 2 var from = GenericLocation.fromStopId("Transfer Point for Route 30", feedId, "cujv"); @@ -223,27 +175,6 @@ private static List getItineraries( return result.getItineraries(); } - private static NearbyStop getNearbyStop(FlexTrip trip, String id) { - // getStops() returns a set of stops and the order doesn't correspond to the stop times - // of the trip - var stopLocation = trip - .getStops() - .stream() - .filter(s -> s instanceof AreaStop) - .findFirst() - .orElseThrow(); - - return new NearbyStop( - stopLocation, - 0, - List.of(), - new State( - new StreetLocation(id, new Coordinate(0, 0), I18NString.of(id)), - StreetSearchRequest.of().build() - ) - ); - } - private static FlexTrip getFlexTrip() { var feedId = timetableRepository.getFeedIds().iterator().next(); var tripId = new FeedScopedId(feedId, "a326c618-d42c-4bd1-9624-c314fbf8ecd8"); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java index be379fb6fa6..ad945bd2fa2 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/VectorTilesResourceTest.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.opentripplanner.TestServerContext; +import org.opentripplanner.ext.fares.impl.DefaultFareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.test.support.HttpForTest; import org.opentripplanner.transit.service.TimetableRepository; @@ -17,7 +18,7 @@ void tileJson() { // the Grizzly request is awful to instantiate, using Mockito var grizzlyRequest = Mockito.mock(Request.class); var resource = new VectorTilesResource( - TestServerContext.createServerContext(new Graph(), new TimetableRepository()), + TestServerContext.createServerContext(new Graph(), new TimetableRepository(), new DefaultFareService()), grizzlyRequest, "default" ); diff --git a/application/src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java b/application/src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java index a47392a3fbf..ada8db821fb 100644 --- a/application/src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java +++ b/application/src/ext/java/org/opentripplanner/ext/fares/DecorateWithFare.java @@ -6,10 +6,14 @@ /** * Computes the fares of an itinerary and adds them. - *

- * TODO: Convert to a class - exposing a service in a DTO is a risk. */ -public record DecorateWithFare(FareService fareService) implements ItineraryDecorator { +public final class DecorateWithFare implements ItineraryDecorator { + private final FareService fareService; + + public DecorateWithFare(FareService fareService) { + this.fareService = fareService; + } + @Override public void decorate(Itinerary itinerary) { var fare = fareService.calculateFares(itinerary); @@ -18,4 +22,5 @@ public void decorate(Itinerary itinerary) { FaresToItineraryMapper.addFaresToLegs(fare, itinerary); } } + } diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java b/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java index c3ca214b62f..76876b53e4a 100644 --- a/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/GraphQLRequestContext.java @@ -24,7 +24,7 @@ public static GraphQLRequestContext ofServerContext(OtpServerRequestContext cont return new GraphQLRequestContext( context.routingService(), context.transitService(), - context.graph().getFareService(), + context.fareService(), context.vehicleRentalService(), context.vehicleParkingService(), context.realtimeVehicleService(), diff --git a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java index 39f88f13281..98dc5df8b88 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java +++ b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java @@ -30,7 +30,6 @@ import org.onebusaway.gtfs.serialization.GtfsReader; import org.onebusaway.gtfs.services.GenericMutableDao; import org.onebusaway.gtfs.services.GtfsMutableRelationalDao; -import org.opentripplanner.ext.fares.impl.DefaultFareServiceFactory; import org.opentripplanner.ext.flex.FlexTripsMapper; import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; @@ -98,22 +97,6 @@ public GtfsModule( this.fareServiceFactory = fareServiceFactory; } - public GtfsModule( - List bundles, - TimetableRepository timetableRepository, - Graph graph, - ServiceDateInterval transitPeriodLimit - ) { - this( - bundles, - timetableRepository, - graph, - DataImportIssueStore.NOOP, - transitPeriodLimit, - new DefaultFareServiceFactory() - ); - } - @Override public void buildGraph() { CalendarServiceData calendarServiceData = new CalendarServiceData(); @@ -142,7 +125,7 @@ public void buildGraph() { mapper.mapStopTripAndRouteDataIntoBuilder(); OtpTransitServiceBuilder builder = mapper.getBuilder(); - var fareRulesService = mapper.getFareRulesService(); + var fareRulesData = mapper.fareRulesData(); builder.limitServiceDays(transitPeriodLimit); @@ -195,8 +178,7 @@ public void buildGraph() { .run(otpTransitService.getTripPatterns()); } - fareServiceFactory.processGtfs(fareRulesService, otpTransitService); - graph.setFareService(fareServiceFactory.makeFareService()); + fareServiceFactory.processGtfs(fareRulesData, otpTransitService); } } catch (IOException e) { throw new RuntimeException(e); diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java index 8e3718be4c6..e1f287027c2 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java @@ -138,12 +138,11 @@ public OtpTransitServiceBuilder getBuilder() { return builder; } - public FareRulesData getFareRulesService() { + public FareRulesData fareRulesData() { return fareRulesBuilder; } public void mapStopTripAndRouteDataIntoBuilder() { - var siteRepository = builder.siteRepository(); translationHelper.importTranslations(data.getAllTranslations(), data.getAllFeedInfos()); builder.getAgenciesById().addAll(agencyMapper.map(data.getAllAgencies())); diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java index 277efda3810..e4ebda2fd97 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RouteRequestToFilterChainMapper.java @@ -99,7 +99,7 @@ public static ItineraryListFilterChain createFilterChain( builder.withTransitGroupPriority(); } - var fareService = context.graph().getFareService(); + var fareService = context.fareService(); if (fareService != null) { builder.withFareDecorator(new DecorateWithFare(fareService)); } diff --git a/application/src/main/java/org/opentripplanner/routing/fares/FareService.java b/application/src/main/java/org/opentripplanner/routing/fares/FareService.java index af850a5c5a9..3c1ecc4f41e 100644 --- a/application/src/main/java/org/opentripplanner/routing/fares/FareService.java +++ b/application/src/main/java/org/opentripplanner/routing/fares/FareService.java @@ -5,7 +5,7 @@ import org.opentripplanner.model.plan.Itinerary; /** - * Computes a fare for a given sequence of Rides. The FareService is serialized as part of the + * Computes a fare for a given sequence of legs. The FareService is serialized as part of the * Graph; Hence it should be {@link Serializable}. */ public interface FareService extends Serializable { diff --git a/application/src/main/java/org/opentripplanner/routing/graph/Graph.java b/application/src/main/java/org/opentripplanner/routing/graph/Graph.java index 70ce563700c..658d32629e5 100644 --- a/application/src/main/java/org/opentripplanner/routing/graph/Graph.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/Graph.java @@ -18,7 +18,6 @@ import org.opentripplanner.framework.geometry.CompactElevationProfile; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.model.calendar.openinghours.OpeningHoursCalendarService; -import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.index.StreetIndex; import org.opentripplanner.routing.linking.VertexLinker; import org.opentripplanner.routing.services.notes.StreetNotesService; @@ -110,8 +109,6 @@ public class Graph implements Serializable { // static variable in CompactElevationProfile in SerializedGraphObject private double distanceBetweenElevationSamples; - private FareService fareService; - /** * Hack. I've tried three different ways of generating unique labels. Previously we were just * tolerating edge label collisions. For some reason we're repeatedly generating splits on the @@ -360,14 +357,6 @@ public void setDistanceBetweenElevationSamples(double distanceBetweenElevationSa CompactElevationProfile.setDistanceBetweenSamplesM(distanceBetweenElevationSamples); } - public FareService getFareService() { - return fareService; - } - - public void setFareService(FareService fareService) { - this.fareService = fareService; - } - private void indexIfNotIndexed(SiteRepository siteRepository) { if (streetIndex == null) { index(siteRepository); diff --git a/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java b/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java index a152b96682d..242d1ea9a0d 100644 --- a/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java @@ -24,6 +24,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueSummary; import org.opentripplanner.model.projectinfo.GraphFileHeader; import org.opentripplanner.model.projectinfo.OtpProjectInfo; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.kryosupport.KryoBuilder; import org.opentripplanner.service.vehicleparking.VehicleParkingRepository; import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository; @@ -79,6 +80,7 @@ public class SerializedGraphObject implements Serializable { public final StopConsolidationRepository stopConsolidationRepository; private final int routingTripPatternCounter; public final EmissionsDataModel emissionsDataModel; + public final FareService fareService; public final StreetLimitationParameters streetLimitationParameters; public final VehicleParkingRepository parkingRepository; @@ -92,7 +94,8 @@ public SerializedGraphObject( DataImportIssueSummary issueSummary, EmissionsDataModel emissionsDataModel, StopConsolidationRepository stopConsolidationRepository, - StreetLimitationParameters streetLimitationParameters + StreetLimitationParameters streetLimitationParameters, + FareService fareService ) { this.graph = graph; this.edges = graph.getEdges(); @@ -107,6 +110,7 @@ public SerializedGraphObject( this.routingTripPatternCounter = RoutingTripPattern.indexCounter(); this.stopConsolidationRepository = stopConsolidationRepository; this.streetLimitationParameters = streetLimitationParameters; + this.fareService = fareService; } public static void verifyTheOutputGraphIsWritableIfDataSourceExist(DataSource graphOutput) { diff --git a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java index ade5067a981..74d4da621d5 100644 --- a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java +++ b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java @@ -158,7 +158,8 @@ private static void startOTPServer(CommandLineParameters cli) { DataImportIssueSummary.combine(graphBuilder.issueSummary(), app.dataImportIssueSummary()), app.emissionsDataModel(), app.stopConsolidationRepository(), - app.streetLimitationParameters() + app.streetLimitationParameters(), + app.buildConfig().fareServiceFactory.makeFareService() ) .save(app.graphOutputDataSource()); // Log size info for the deduplicator diff --git a/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java b/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java index f088a3de60e..a6ac5f960ca 100644 --- a/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java +++ b/application/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java @@ -20,6 +20,7 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; import org.opentripplanner.routing.api.RoutingService; import org.opentripplanner.routing.api.request.RouteRequest; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.graphfinder.GraphFinder; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService; @@ -153,4 +154,6 @@ default DataOverlayContext dataOverlayContext(RouteRequest request) { @Nullable SorlandsbanenNorwayService sorlandsbanenService(); + + FareService fareService(); } diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java index b4edbb36299..da4be6d77e6 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java @@ -17,6 +17,7 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; import org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers.TransitLayerMapper; import org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers.TransitLayerUpdater; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleRepository; import org.opentripplanner.service.vehicleparking.VehicleParkingRepository; @@ -80,7 +81,8 @@ public class ConstructApplication { EmissionsDataModel emissionsDataModel, VehicleParkingRepository vehicleParkingRepository, @Nullable StopConsolidationRepository stopConsolidationRepository, - StreetLimitationParameters streetLimitationParameters + StreetLimitationParameters streetLimitationParameters, + FareService fareService ) { this.cli = cli; this.graphBuilderDataSources = graphBuilderDataSources; @@ -102,6 +104,7 @@ public class ConstructApplication { .dataImportIssueSummary(issueSummary) .stopConsolidationRepository(stopConsolidationRepository) .streetLimitationParameters(streetLimitationParameters) + .fareService(fareService) .build(); } diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java index d6310c0c616..efd732b057b 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java @@ -17,6 +17,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueSummary; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleRepository; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService; @@ -105,6 +106,8 @@ public interface ConstructApplicationFactory { @Nullable LuceneIndex luceneIndex(); + FareService fareService(); + @Component.Builder interface Builder { @BindsInstance @@ -139,6 +142,9 @@ Builder stopConsolidationRepository( @BindsInstance Builder streetLimitationParameters(StreetLimitationParameters streetLimitationParameters); + @BindsInstance + Builder fareService(FareService fareService); + ConstructApplicationFactory build(); } } diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java index 42bd8ee4d87..029fe80824a 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationModule.java @@ -14,6 +14,7 @@ import org.opentripplanner.ext.stopconsolidation.StopConsolidationService; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService; import org.opentripplanner.service.vehicleparking.VehicleParkingService; @@ -48,7 +49,8 @@ OtpServerRequestContext providesServerContext( EmissionsService emissionsService, @Nullable SorlandsbanenNorwayService sorlandsbanenService, LauncherRequestDecorator launcherRequestDecorator, - @Nullable LuceneIndex luceneIndex + @Nullable LuceneIndex luceneIndex, + FareService fareService ) { var defaultRequest = launcherRequestDecorator.intercept(routerConfig.routingRequestDefaults()); @@ -72,7 +74,8 @@ OtpServerRequestContext providesServerContext( streetLimitationParametersService, traverseVisitor, luceneIndex, - debugUiConfig + debugUiConfig, + fareService ); } diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java index 021af778345..48d7506cd32 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java @@ -3,9 +3,11 @@ import javax.annotation.Nullable; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.ext.emissions.EmissionsDataModel; +import org.opentripplanner.ext.fares.impl.DefaultFareService; import org.opentripplanner.ext.stopconsolidation.StopConsolidationRepository; import org.opentripplanner.graph_builder.GraphBuilderDataSources; import org.opentripplanner.graph_builder.issue.api.DataImportIssueSummary; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.graph.SerializedGraphObject; import org.opentripplanner.service.vehicleparking.VehicleParkingRepository; @@ -61,7 +63,8 @@ public ConstructApplication appConstruction(SerializedGraphObject obj) { obj.issueSummary, obj.emissionsDataModel, obj.stopConsolidationRepository, - obj.streetLimitationParameters + obj.streetLimitationParameters, + obj.fareService ); } @@ -75,7 +78,8 @@ public ConstructApplication appConstruction() { DataImportIssueSummary.empty(), factory.emptyEmissionsDataModel(), factory.emptyStopConsolidationRepository(), - factory.emptyStreetLimitationParameters() + factory.emptyStreetLimitationParameters(), + new DefaultFareService() ); } @@ -98,7 +102,8 @@ private ConstructApplication createAppConstruction( DataImportIssueSummary issueSummary, @Nullable EmissionsDataModel emissionsDataModel, @Nullable StopConsolidationRepository stopConsolidationRepository, - StreetLimitationParameters streetLimitationParameters + StreetLimitationParameters streetLimitationParameters, + FareService fareService ) { return new ConstructApplication( cli, @@ -111,7 +116,8 @@ private ConstructApplication createAppConstruction( emissionsDataModel, parkingRepository, stopConsolidationRepository, - streetLimitationParameters + streetLimitationParameters, + fareService ); } } diff --git a/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java b/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java index 450b6986cb5..30770a5be70 100644 --- a/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java +++ b/application/src/main/java/org/opentripplanner/standalone/server/DefaultServerRequestContext.java @@ -18,6 +18,7 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; import org.opentripplanner.routing.api.RoutingService; import org.opentripplanner.routing.api.request.RouteRequest; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.service.DefaultRoutingService; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService; @@ -59,6 +60,7 @@ public class DefaultServerRequestContext implements OtpServerRequestContext { private final StreetLimitationParametersService streetLimitationParametersService; private final LuceneIndex luceneIndex; private final DebugUiConfig debugUiConfig; + private final FareService fareService; private RouteRequest defaultRouteRequestWithTimeSet = null; @@ -86,7 +88,8 @@ private DefaultServerRequestContext( FlexParameters flexParameters, @Nullable TraverseVisitor traverseVisitor, @Nullable LuceneIndex luceneIndex, - DebugUiConfig debugUiConfig + DebugUiConfig debugUiConfig, + FareService fareService ) { this.graph = graph; this.transitService = transitService; @@ -109,6 +112,7 @@ private DefaultServerRequestContext( this.streetLimitationParametersService = streetLimitationParametersService; this.luceneIndex = luceneIndex; this.debugUiConfig = debugUiConfig; + this.fareService = fareService; } /** @@ -134,7 +138,8 @@ public static DefaultServerRequestContext create( StreetLimitationParametersService streetLimitationParametersService, @Nullable TraverseVisitor traverseVisitor, @Nullable LuceneIndex luceneIndex, - DebugUiConfig debugUiConfig + DebugUiConfig debugUiConfig, + FareService fareService ) { return new DefaultServerRequestContext( graph, @@ -157,7 +162,8 @@ public static DefaultServerRequestContext create( flexParameters, traverseVisitor, luceneIndex, - debugUiConfig + debugUiConfig, + fareService ); } @@ -288,4 +294,9 @@ public EmissionsService emissionsService() { public SorlandsbanenNorwayService sorlandsbanenService() { return sorlandsbanenService; } + + @Override + public FareService fareService() { + return fareService; + } } diff --git a/application/src/test/java/org/opentripplanner/ConstantsForTests.java b/application/src/test/java/org/opentripplanner/ConstantsForTests.java index e5ab48cee54..be2b4019b08 100644 --- a/application/src/test/java/org/opentripplanner/ConstantsForTests.java +++ b/application/src/test/java/org/opentripplanner/ConstantsForTests.java @@ -135,6 +135,7 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); + var fareFactory = new DefaultFareServiceFactory(); // Add street data from OSM { OsmProvider osmProvider = new OsmProvider(PORTLAND_CENTRAL_OSM, false); @@ -147,13 +148,7 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { } // Add transit data from GTFS { - addGtfsToGraph( - graph, - timetableRepository, - PORTLAND_GTFS, - new DefaultFareServiceFactory(), - "prt" - ); + addGtfsToGraph(graph, timetableRepository, PORTLAND_GTFS, fareFactory, "prt"); } // Link transit stops to streets TestStreetLinkerModule.link(graph, timetableRepository); @@ -182,7 +177,7 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { graph.index(timetableRepository.getSiteRepository()); - return new TestOtpModel(graph, timetableRepository); + return new TestOtpModel(graph, timetableRepository, fareFactory); } catch (Exception e) { throw new RuntimeException(e); } @@ -233,7 +228,7 @@ public static TestOtpModel buildGtfsGraph(File gtfsFile, FareServiceFactory fare var graph = new Graph(deduplicator); var timetableRepository = new TimetableRepository(siteRepository, deduplicator); addGtfsToGraph(graph, timetableRepository, gtfsFile, fareServiceFactory, null); - return new TestOtpModel(graph, timetableRepository); + return new TestOtpModel(graph, timetableRepository, fareServiceFactory); } public static TestOtpModel buildNewMinimalNetexGraph() { diff --git a/application/src/test/java/org/opentripplanner/GtfsTest.java b/application/src/test/java/org/opentripplanner/GtfsTest.java index 5d548e4012c..d59938ad7ed 100644 --- a/application/src/test/java/org/opentripplanner/GtfsTest.java +++ b/application/src/test/java/org/opentripplanner/GtfsTest.java @@ -21,6 +21,8 @@ import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.opentripplanner.api.common.LocationStringParser; +import org.opentripplanner.ext.fares.impl.DefaultFareServiceFactory; +import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.module.GtfsFeedId; import org.opentripplanner.gtfs.graphbuilder.GtfsBundle; import org.opentripplanner.gtfs.graphbuilder.GtfsModule; @@ -197,17 +199,25 @@ protected void setUp() throws Exception { graph = new Graph(deduplicator); timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); + var fareServiceFactory = new DefaultFareServiceFactory(); GtfsModule gtfsGraphBuilderImpl = new GtfsModule( gtfsBundleList, timetableRepository, graph, - ServiceDateInterval.unbounded() + DataImportIssueStore.NOOP, + ServiceDateInterval.unbounded(), + fareServiceFactory ); gtfsGraphBuilderImpl.buildGraph(); timetableRepository.index(); graph.index(timetableRepository.getSiteRepository()); - serverContext = TestServerContext.createServerContext(graph, timetableRepository); + serverContext = + TestServerContext.createServerContext( + graph, + timetableRepository, + fareServiceFactory.makeFareService() + ); timetableSnapshotSource = new TimetableSnapshotSource( TimetableSnapshotSourceParameters.DEFAULT diff --git a/application/src/test/java/org/opentripplanner/TestOtpModel.java b/application/src/test/java/org/opentripplanner/TestOtpModel.java index 62b5fce3416..55613e9f77c 100644 --- a/application/src/test/java/org/opentripplanner/TestOtpModel.java +++ b/application/src/test/java/org/opentripplanner/TestOtpModel.java @@ -1,9 +1,19 @@ package org.opentripplanner; +import org.opentripplanner.ext.fares.impl.DefaultFareServiceFactory; +import org.opentripplanner.routing.fares.FareServiceFactory; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.service.TimetableRepository; -public record TestOtpModel(Graph graph, TimetableRepository timetableRepository) { +public record TestOtpModel( + Graph graph, + TimetableRepository timetableRepository, + FareServiceFactory fareServiceFactory +) { + public TestOtpModel(Graph graph, TimetableRepository timetableRepository) { + this(graph, timetableRepository, new DefaultFareServiceFactory()); + } + public TestOtpModel index() { timetableRepository.index(); graph.index(timetableRepository.getSiteRepository()); diff --git a/application/src/test/java/org/opentripplanner/TestServerContext.java b/application/src/test/java/org/opentripplanner/TestServerContext.java index ca818a64a58..dc43200f29d 100644 --- a/application/src/test/java/org/opentripplanner/TestServerContext.java +++ b/application/src/test/java/org/opentripplanner/TestServerContext.java @@ -8,6 +8,7 @@ import org.opentripplanner.ext.emissions.EmissionsDataModel; import org.opentripplanner.ext.emissions.EmissionsService; import org.opentripplanner.raptor.configure.RaptorConfig; +import org.opentripplanner.routing.fares.FareService; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleService; import org.opentripplanner.service.realtimevehicles.internal.DefaultRealtimeVehicleService; @@ -39,7 +40,8 @@ private TestServerContext() {} /** Create a context for unit testing, using the default RouteRequest. */ public static OtpServerRequestContext createServerContext( Graph graph, - TimetableRepository timetableRepository + TimetableRepository timetableRepository, + FareService fareService ) { timetableRepository.index(); final RouterConfig routerConfig = RouterConfig.DEFAULT; @@ -67,7 +69,8 @@ public static OtpServerRequestContext createServerContext( createStreetLimitationParametersService(), null, null, - DebugUiConfig.DEFAULT + DebugUiConfig.DEFAULT, + fareService ); creatTransitLayerForRaptor(timetableRepository, routerConfig.transitTuningConfig()); return context; diff --git a/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java index dc96a094812..facea8956aa 100644 --- a/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java @@ -31,6 +31,7 @@ import org.opentripplanner.apis.transmodel.TransmodelRequestContext; import org.opentripplanner.ext.emissions.DefaultEmissionsService; import org.opentripplanner.ext.emissions.EmissionsDataModel; +import org.opentripplanner.ext.fares.impl.NoopFareServiceFactory; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.plan.Itinerary; @@ -156,7 +157,8 @@ void setup() { new DefaultStreetLimitationParametersService(new StreetLimitationParameters()), null, null, - DebugUiConfig.DEFAULT + DebugUiConfig.DEFAULT, + new NoopFareServiceFactory().makeFareService() ), null, transitService diff --git a/application/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java b/application/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java index dc924ac765a..621b40a0ac4 100644 --- a/application/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java +++ b/application/src/test/java/org/opentripplanner/ext/restapi/resources/PlannerResourceTest.java @@ -12,6 +12,7 @@ import org.opentripplanner.TestServerContext; import org.opentripplanner._support.time.ZoneIds; import org.opentripplanner.api.parameter.QualifiedModeSet; +import org.opentripplanner.ext.fares.impl.DefaultFareService; import org.opentripplanner.routing.api.request.RequestModes; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.api.OtpServerRequestContext; @@ -22,7 +23,11 @@ class PlannerResourceTest { static OtpServerRequestContext context() { var timetableRepository = new TimetableRepository(); timetableRepository.initTimeZone(ZoneIds.BERLIN); - return TestServerContext.createServerContext(new Graph(), timetableRepository); + return TestServerContext.createServerContext( + new Graph(), + timetableRepository, + new DefaultFareService() + ); } @Test diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java index 75f7077eb7d..c041c433b7e 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java @@ -12,6 +12,8 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.ConstantsForTests; +import org.opentripplanner.ext.fares.impl.DefaultFareServiceFactory; +import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.gtfs.graphbuilder.GtfsBundle; import org.opentripplanner.gtfs.graphbuilder.GtfsModule; import org.opentripplanner.model.calendar.ServiceDateInterval; @@ -32,7 +34,9 @@ void addShapesForFrequencyTrips() { List.of(bundle), model.timetableRepository, model.graph, - ServiceDateInterval.unbounded() + DataImportIssueStore.NOOP, + ServiceDateInterval.unbounded(), + new DefaultFareServiceFactory() ); module.buildGraph(); @@ -63,7 +67,9 @@ void duplicateFeedId() { bundles, model.timetableRepository, model.graph, - ServiceDateInterval.unbounded() + DataImportIssueStore.NOOP, + ServiceDateInterval.unbounded(), + new DefaultFareServiceFactory() ); assertThrows(IllegalArgumentException.class, module::buildGraph); } @@ -111,7 +117,9 @@ void interline(List bundles, int expectedTransfers) { bundles, model.timetableRepository, model.graph, - ServiceDateInterval.unbounded() + DataImportIssueStore.NOOP, + ServiceDateInterval.unbounded(), + new DefaultFareServiceFactory() ); module.buildGraph(); diff --git a/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java b/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java index 6c874c7108f..12da84a4bb2 100644 --- a/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java +++ b/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java @@ -8,6 +8,7 @@ import java.util.Locale; import org.junit.jupiter.api.Test; import org.opentripplanner.TestServerContext; +import org.opentripplanner.ext.fares.impl.DefaultFareService; import org.opentripplanner.inspector.vector.geofencing.GeofencingZonesLayerBuilder; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.api.OtpServerRequestContext; @@ -17,7 +18,8 @@ class VectorTileResponseFactoryTest { public static final OtpServerRequestContext SERVER_CONTEXT = TestServerContext.createServerContext( new Graph(), - new TimetableRepository() + new TimetableRepository(), + new DefaultFareService() ); enum LayerType { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java index cab308c092b..fee4515f2b9 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/SnapshotTestBase.java @@ -86,7 +86,11 @@ protected OtpServerRequestContext serverContext() { if (serverContext == null) { TestOtpModel model = getGraph(); serverContext = - TestServerContext.createServerContext(model.graph(), model.timetableRepository()); + TestServerContext.createServerContext( + model.graph(), + model.timetableRepository(), + model.fareServiceFactory().makeFareService() + ); } return serverContext; diff --git a/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java b/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java index 400a9eba2ba..cb2b9caaf65 100644 --- a/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java @@ -23,6 +23,7 @@ import org.opentripplanner.ext.emissions.EmissionsDataModel; import org.opentripplanner.framework.geometry.HashGridSpatialIndex; import org.opentripplanner.graph_builder.issue.api.DataImportIssueSummary; +import org.opentripplanner.routing.fares.FareServiceFactory; import org.opentripplanner.service.vehicleparking.VehicleParkingRepository; import org.opentripplanner.service.vehicleparking.internal.DefaultVehicleParkingRepository; import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository; @@ -75,7 +76,8 @@ public void testRoundTripSerializationForGTFSGraph() throws Exception { model.timetableRepository(), weRepo, parkingRepository, - emissionsDataModel + emissionsDataModel, + model.fareServiceFactory() ); } @@ -93,7 +95,8 @@ public void testRoundTripSerializationForNetexGraph() throws Exception { model.timetableRepository(), worldEnvelopeRepository, parkingRepository, - emissionsDataModel + emissionsDataModel, + model.fareServiceFactory() ); } @@ -194,7 +197,8 @@ private void testRoundTrip( TimetableRepository originalTimetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, VehicleParkingRepository vehicleParkingRepository, - EmissionsDataModel emissionsDataModel + EmissionsDataModel emissionsDataModel, + FareServiceFactory fareServiceFactory ) throws Exception { // Now round-trip the graph through serialization. File tempFile = TempFile.createTempFile("graph", "pdx"); @@ -210,7 +214,8 @@ private void testRoundTrip( DataImportIssueSummary.empty(), emissionsDataModel, null, - streetLimitationParameters + streetLimitationParameters, + fareServiceFactory.makeFareService() ); serializedObj.save(new FileDataSource(tempFile, FileType.GRAPH)); SerializedGraphObject deserializedGraph = SerializedGraphObject.load(tempFile); diff --git a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java index ca4e85eed84..b53c4c62ad3 100644 --- a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java +++ b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java @@ -15,6 +15,7 @@ import java.util.function.Predicate; import org.opentripplanner.TestServerContext; import org.opentripplanner.datastore.OtpDataStore; +import org.opentripplanner.ext.fares.impl.DefaultFareService; import org.opentripplanner.framework.application.OtpAppException; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.raptor.configure.RaptorConfig; @@ -132,7 +133,8 @@ public SpeedTest( TestServerContext.createStreetLimitationParametersService(), null, null, - DebugUiConfig.DEFAULT + DebugUiConfig.DEFAULT, + new DefaultFareService() ); // Creating transitLayerForRaptor should be integrated into the TimetableRepository, but for now // we do it manually here