From 929b3229e9be7d3f2a0909652fc241e873baeb06 Mon Sep 17 00:00:00 2001 From: Vincent Paturet Date: Fri, 11 Oct 2024 15:52:05 +0200 Subject: [PATCH 1/3] Make OTP a multi-module project --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 875f4fb67b8..bed6a5ba84b 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -9,3 +9,6 @@ # reorder and reformat GTFS GraphQL API schema file with graphql-java 14051fab312a67cae9a460aaf0bbc77223bec624 + +# Make OTP a multi-module project +ead33ffe280dd7caf72cae5ff7a41542e8427636 From a8a1730f73df91794295f1db89e5dfd27735a730 Mon Sep 17 00:00:00 2001 From: Vincent Paturet Date: Fri, 11 Oct 2024 15:52:05 +0200 Subject: [PATCH 2/3] Rename TransitModel to TimetableRepository --- .../ext/emissions/EmissionsTest.java | 23 ++- .../ext/fares/FaresFilterTest.java | 6 +- ...CombinedInterlinedLegsFareServiceTest.java | 4 +- .../fares/impl/DefaultFareServiceTest.java | 4 +- .../ext/fares/impl/FareModelForTest.java | 5 +- .../ext/fares/impl/FaresIntegrationTest.java | 14 +- .../fares/impl/GtfsFaresV2ServiceTest.java | 8 +- .../ext/fares/impl/HSLFareServiceTest.java | 7 +- ...reInFreeTransferWindowFareServiceTest.java | 4 +- .../flex/AreaStopsToVerticesMapperTest.java | 11 +- .../ext/flex/FlexIntegrationTest.java | 30 ++-- .../ext/flex/FlexIntegrationTestData.java | 14 +- .../ext/flex/FlexStopTimesForTest.java | 4 +- .../ext/flex/GtfsFlexTest.java | 10 +- .../ScheduledFlexPathCalculatorTest.java | 2 +- .../template/FlexTemplateFactoryTest.java | 6 +- .../ext/flex/trip/FlexTripsMapperTest.java | 4 +- .../flex/trip/ScheduledDeviatedTripTest.java | 22 +-- .../trip/UnscheduledDrivingDurationTest.java | 2 +- .../ext/flex/trip/UnscheduledTripTest.java | 13 +- .../ext/geocoder/LuceneIndexTest.java | 18 +- .../ext/geocoder/StopClusterMapperTest.java | 8 +- .../mapping/TransmodelMappingUtilTest.java | 4 +- .../RealtimeResolverTest.java | 30 ++-- .../DecorateConsolidatedStopNamesTest.java | 6 +- .../StopConsolidationModuleTest.java | 10 +- .../TestStopConsolidationModel.java | 18 +- ...efaultStopConsolidationRepositoryTest.java | 2 +- .../DefaultStopConsolidationServiceTest.java | 4 +- .../vectortiles/VectorTilesResourceTest.java | 4 +- .../vectortiles/layers/LayerFiltersTest.java | 4 +- .../layers/TestTransitService.java | 10 +- .../areastops/AreaStopPropertyMapperTest.java | 10 +- .../areastops/AreaStopsLayerBuilderTest.java | 8 +- .../DigitransitStationPropertyMapperTest.java | 14 +- .../layers/stops/RealtimeStopsLayerTest.java | 16 +- .../layers/stops/StopsLayerTest.java | 16 +- .../VehicleParkingGroupsLayerTest.java | 4 +- .../VehicleParkingsLayerTest.java | 4 +- .../ext/flex/AreaStopsToVerticesMapper.java | 16 +- .../opentripplanner/ext/flex/FlexIndex.java | 8 +- .../ext/geocoder/LuceneIndex.java | 9 +- .../geocoder/configure/GeocoderModule.java | 6 +- .../updater/azure/SiriAzureSXUpdater.java | 9 +- .../StopConsolidationModule.java | 18 +- .../StopConsolidationServiceModule.java | 7 +- .../DefaultStopConsolidationService.java | 14 +- .../DirectTransferAnalyzer.java | 12 +- .../layers/stations/StationsLayerBuilder.java | 6 +- .../apis/transmodel/TransmodelAPI.java | 8 +- .../graph_builder/GraphBuilder.java | 34 ++-- .../graph_builder/GraphStats.java | 8 +- .../model/GraphBuilderModule.java | 2 +- ...ph.java => AddTransitEntitiesToGraph.java} | 64 +++---- .../module/DirectTransferGenerator.java | 16 +- .../module/OsmBoardingLocationsModule.java | 10 +- .../RouteToCentroidStationIdsValidator.java | 10 +- .../module/StreetLinkerModule.java | 18 +- .../module/TimeZoneAdjusterModule.java | 18 +- .../module/TripPatternNamer.java | 10 +- .../module/configure/GraphBuilderFactory.java | 4 +- .../module/configure/GraphBuilderModules.java | 36 ++-- .../CalculateWorldEnvelopeModule.java | 10 +- .../module/islandpruning/PruneIslands.java | 14 +- .../gtfs/graphbuilder/GtfsModule.java | 44 ++--- .../model/TimetableSnapshot.java | 2 +- .../opentripplanner/netex/NetexBundle.java | 8 +- .../opentripplanner/netex/NetexModule.java | 30 ++-- .../netex/configure/NetexConfigure.java | 8 +- .../netex/mapping/TripMapper.java | 2 +- .../raptoradapter/transit/TransitLayer.java | 6 +- .../transit/mappers/TransitLayerMapper.java | 16 +- .../transit/mappers/TransitLayerUpdater.java | 2 +- .../opentripplanner/routing/graph/Graph.java | 4 +- .../routing/graph/SerializedGraphObject.java | 25 +-- .../DelegatingTransitAlertServiceImpl.java | 10 +- .../routing/impl/TransitAlertServiceImpl.java | 12 +- .../opentripplanner/standalone/OTPMain.java | 14 +- .../configure/ConstructApplication.java | 40 +++-- .../ConstructApplicationFactory.java | 6 +- .../standalone/configure/LoadApplication.java | 10 +- .../configure/LoadApplicationFactory.java | 4 +- .../standalone/server/MetricsLogging.java | 16 +- .../service/DefaultTransitService.java | 160 ++++++++--------- ...sitModel.java => TimetableRepository.java} | 36 ++-- ...dex.java => TimetableRepositoryIndex.java} | 24 +-- .../transit/service/TransitService.java | 8 +- .../updater/DefaultRealTimeUpdateContext.java | 10 +- .../alert/GtfsRealtimeAlertsUpdater.java | 6 +- .../configure/UpdaterConfigurator.java | 33 ++-- .../updater/siri/AddedTripBuilder.java | 2 +- .../siri/SiriTimetableSnapshotSource.java | 14 +- .../updater/siri/SiriTripPatternCache.java | 2 +- .../updater/siri/updater/SiriSXUpdater.java | 10 +- .../updater/trip/TimetableSnapshotSource.java | 24 +-- .../opentripplanner/ConstantsForTests.java | 50 +++--- .../java/org/opentripplanner/GtfsTest.java | 18 +- .../org/opentripplanner/TestOtpModel.java | 8 +- .../opentripplanner/TestServerContext.java | 12 +- .../apis/gtfs/GraphQLIntegrationTest.java | 37 ++-- .../LegacyRouteRequestMapperTest.java | 8 +- .../routerequest/RouteRequestMapperTest.java | 8 +- .../mapping/TripRequestMapperTest.java | 28 +-- .../plan/TripPlanTimePenaltyDtoTest.java | 4 +- .../resources/PlannerResourceTest.java | 8 +- .../module/DirectTransferGeneratorTest.java | 56 +++--- .../graph_builder/module/GtfsModuleTest.java | 23 +-- .../OsmBoardingLocationsModuleTest.java | 14 +- .../module/StreetLinkerModuleTest.java | 16 +- .../module/TestStreetLinkerModule.java | 4 +- .../module/VehicleParkingLinkingTest.java | 18 +- .../CalculateWorldEnvelopeModuleTest.java | 4 +- .../islandpruning/IslandPruningUtils.java | 10 +- .../islandpruning/SubgraphOnlyFerryTest.java | 4 +- .../module/linking/LinkingTest.java | 14 +- .../module/linking/TestGraph.java | 12 +- .../module/osm/UnconnectedAreasTest.java | 6 +- .../GenerateTripPatternsOperationTest.java | 24 +-- .../interlining/InterlineProcessorTest.java | 8 +- .../gtfs/mapping/AgencyMapperTest.java | 6 +- .../gtfs/mapping/BoardingAreaMapperTest.java | 4 +- .../gtfs/mapping/RouteMapperTest.java | 4 +- .../vector/VectorTileResponseFactoryTest.java | 4 +- .../model/ShapeGeometryTest.java | 6 +- .../model/TimetableSnapshotTest.java | 8 +- .../opentripplanner/model/TimetableTest.java | 8 +- .../model/TripPatternTest.java | 6 +- .../model/TripTimeOnDateTest.java | 6 +- .../CalendarServiceDataFactoryImplTest.java | 8 +- ...pTransitServiceBuilderLimitPeriodTest.java | 20 +-- .../impl/OtpTransitServiceBuilderTest.java | 6 +- .../model/impl/OtpTransitServiceImplTest.java | 12 +- .../model/plan/ItineraryTest.java | 6 +- .../opentripplanner/model/plan/PlaceTest.java | 4 +- .../model/plan/PlanTestConstants.java | 22 +-- .../plan/ScheduledTransitLegBuilderTest.java | 4 +- .../model/plan/ScheduledTransitLegTest.java | 12 +- .../model/plan/TestItineraryBuilder.java | 10 +- .../LegReferenceSerializerTest.java | 8 +- .../ScheduledTransitLegReferenceTest.java | 43 +++-- .../plan/paging/cursor/PageCursorTest.java | 4 +- .../model/transfer/TransferTestData.java | 18 +- .../netex/mapping/FlexStopsMapperTest.java | 4 +- .../mapping/MultiModalStationMapperTest.java | 9 +- .../netex/mapping/NetexTestDataSample.java | 6 +- .../mapping/NoticeAssignmentMapperTest.java | 6 +- .../netex/mapping/RouteMapperTest.java | 10 +- .../netex/mapping/StopTimesMapperTest.java | 4 +- .../netex/mapping/TripMapperTest.java | 10 +- .../netex/mapping/TripPatternMapperTest.java | 4 +- .../calendar/CalendarServiceBuilderTest.java | 14 +- .../moduletests/D03_UnpreferredRouteTest.java | 16 +- .../routing/TestHalfEdges.java | 20 ++- .../routing/algorithm/FilterTest.java | 162 +++++++++--------- .../routing/algorithm/GraphRoutingTest.java | 38 ++-- .../algorithm/StreetModeLinkingTest.java | 12 +- .../routing/algorithm/TestBanning.java | 30 ++-- .../ItineraryListFilterChainTest.java | 4 +- .../filters/system/PagingFilterTest.java | 4 +- .../system/SingleCriteriaComparatorTest.java | 4 +- .../filters/system/mcmax/ItemTest.java | 4 +- .../system/mcmax/McMaxLimitFilterTest.java | 4 +- .../transit/TransitAlertFilterTest.java | 4 +- .../groupids/GroupByAllSameStationsTest.java | 4 +- .../GroupBySameRoutesAndStopsTest.java | 6 +- .../RaptorPathToItineraryMapperTest.java | 14 +- .../algorithm/mapping/SnapshotTestBase.java | 3 +- .../transit/TransitLayerTest.java | 10 +- .../transit/TripPatternForDateTest.java | 10 +- .../ConstrainedBoardingSearchTest.java | 4 +- .../cost/PatternCostCalculatorTest.java | 8 +- .../GeneralizedCostParametersMapperTest.java | 6 +- .../mappers/RaptorRequestMapperTest.java | 4 +- .../mappers/TransitLayerMapperTest.java | 4 +- .../mappers/TripPatternForDateMapperTest.java | 6 +- ...rRoutingRequestTransitDataCreatorTest.java | 10 +- ...eRequestTransitDataProviderFilterTest.java | 35 ++-- .../transit/request/TestRouteData.java | 13 +- .../transit/request/TestTransitCaseData.java | 4 +- .../services/TestTransferBuilder.java | 4 +- .../algorithm/via/ViaRoutingWorkerTest.java | 4 +- .../routing/core/ItineraryFaresTest.java | 2 +- .../graph/DefaultRoutingServiceTest.java | 2 +- .../routing/graph/GraphSerializationTest.java | 31 ++-- .../graphfinder/DirectGraphFinderTest.java | 2 +- .../routing/graphfinder/NearbyStopTest.java | 4 +- .../PlaceFinderTraverseVisitorTest.java | 14 +- .../StopFinderTraverseVisitorTest.java | 4 +- .../graphfinder/StreetGraphFinderTest.java | 10 +- .../linking/LinkStopToPlatformTest.java | 12 +- .../stoptimes/AlternativeLegsTest.java | 8 +- .../stoptimes/StopTimesHelperTest.java | 14 +- .../trippattern/FrequencyEntryTest.java | 8 +- .../VehicleParkingTestGraphData.java | 10 +- .../service/paging/TestPagingModel.java | 4 +- .../DefaultRealtimeVehicleServiceTest.java | 20 ++- .../integration/BarrierRoutingTest.java | 2 +- .../integration/BicycleRoutingTest.java | 4 +- .../street/integration/WalkRoutingTest.java | 4 +- .../model/_data/StreetModelForTest.java | 2 +- .../edge/StreetTransitEntityLinkTest.java | 4 +- .../edge/StreetVehicleParkingLinkTest.java | 2 +- .../model/edge/VehicleParkingEdgeTest.java | 6 +- .../street/model/vertex/OsmVertexTest.java | 4 +- .../StreetSearchRequestMapperTest.java | 6 +- .../street/search/state/TestStateBuilder.java | 4 +- ... TimetableRepositoryArchitectureTest.java} | 2 +- .../transit/model/_data/PatternTestModel.java | 17 +- ...t.java => TimetableRepositoryForTest.java} | 8 +- .../transit/model/basic/NoticeTest.java | 6 +- .../model/framework/EntityByIdTest.java | 6 +- .../model/network/GroupOfRoutesTest.java | 6 +- .../transit/model/network/RouteTest.java | 12 +- .../model/network/StopPatternTest.java | 8 +- .../model/network/TripPatternTest.java | 12 +- .../grouppriority/TripAdapterTest.java | 4 +- .../model/organization/AgencyTest.java | 6 +- .../model/organization/BrandingTest.java | 6 +- .../model/organization/OperatorTest.java | 6 +- .../transit/model/site/AreaStopTest.java | 8 +- .../transit/model/site/BoardingAreaTest.java | 11 +- .../transit/model/site/EntranceTest.java | 8 +- .../transit/model/site/FareZoneTest.java | 6 +- .../model/site/GroupOfStationsTest.java | 8 +- .../transit/model/site/GroupStopTest.java | 17 +- .../model/site/MultiModalStationTest.java | 8 +- .../transit/model/site/PathwayNodeTest.java | 8 +- .../transit/model/site/PathwayTest.java | 10 +- .../transit/model/site/RegularStopTest.java | 15 +- .../transit/model/site/StationTest.java | 15 +- .../timetable/RealTimeTripTimesTest.java | 18 +- .../timetable/ScheduledTripTimesTest.java | 6 +- .../model/timetable/StopTimeKeyTest.java | 6 +- .../TimetableValidationErrorTest.java | 4 +- .../timetable/TripOnServiceDateTest.java | 14 +- .../transit/model/timetable/TripTest.java | 12 +- .../service/DefaultTransitServiceTest.java | 21 ++- .../transit/service/StopModelTest.java | 4 +- ...Test.java => TimetableRepositoryTest.java} | 38 ++-- .../speed_test/SpeedIntegrationTest.java | 2 +- .../transit/speed_test/SpeedTest.java | 46 ++--- .../support/AssertSpeedTestSetup.java | 6 +- .../GtfsRealtimeFuzzyTripMatcherTest.java | 4 +- .../alert/AlertsUpdateHandlerTest.java | 6 +- .../updater/siri/AddedTripBuilderTest.java | 34 ++-- .../updater/siri/ModifiedTripBuilderTest.java | 58 ++++--- .../siri/SiriAlertsUpdateHandlerTest.java | 15 +- .../siri/SiriTimetableSnapshotSourceTest.java | 2 +- .../updater/trip/RealtimeTestConstants.java | 12 +- .../updater/trip/RealtimeTestEnvironment.java | 24 +-- .../trip/RealtimeTestEnvironmentBuilder.java | 37 ++-- .../trip/TimetableSnapshotManagerTest.java | 15 +- .../trip/TimetableSnapshotSourceTest.java | 10 +- .../trip/moduletests/addition/AddedTest.java | 10 +- .../CancellationDeletionTest.java | 2 +- .../trip/moduletests/delay/DelayedTest.java | 2 +- .../trip/moduletests/delay/SkippedTest.java | 2 +- ...VehicleParkingAvailabilityUpdaterTest.java | 6 +- .../VehicleParkingUpdaterTest.java | 20 ++- .../RealtimeVehicleMatcherTest.java | 42 ++--- .../GeofencingVertexUpdaterTest.java | 2 +- .../VehicleRentalUpdaterTest.java | 7 +- 262 files changed, 1766 insertions(+), 1596 deletions(-) rename application/src/main/java/org/opentripplanner/graph_builder/module/{AddTransitModelEntitiesToGraph.java => AddTransitEntitiesToGraph.java} (86%) rename application/src/main/java/org/opentripplanner/transit/service/{TransitModel.java => TimetableRepository.java} (93%) rename application/src/main/java/org/opentripplanner/transit/service/{TransitModelIndex.java => TimetableRepositoryIndex.java} (90%) rename application/src/test/java/org/opentripplanner/transit/model/{TransitModelArchitectureTest.java => TimetableRepositoryArchitectureTest.java} (98%) rename application/src/test/java/org/opentripplanner/transit/model/_data/{TransitModelForTest.java => TimetableRepositoryForTest.java} (97%) rename application/src/test/java/org/opentripplanner/transit/service/{TransitModelTest.java => TimetableRepositoryTest.java} (71%) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java b/application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java index 51bf5f344f6..c26ec7c636a 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/emissions/EmissionsTest.java @@ -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; @@ -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; @@ -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(); @@ -119,12 +123,15 @@ private ScheduledTransitLeg createTransitLeg(Route route) { var stoptime = new StopTime(); var stopTimes = new ArrayList(); 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) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java index ac11886c208..b897f3aa78f 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/FaresFilterTest.java @@ -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; @@ -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() { diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java index 407cd0f11e9..f1dabd0948c 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/CombinedInterlinedLegsFareServiceTest.java @@ -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 diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java index cae23f60800..788c1c9b6d6 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/DefaultFareServiceTest.java @@ -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 { @@ -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, diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java index e498588d00f..d9325d139a8 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java @@ -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; 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 7b822b03059..f5ad2b471ab 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 @@ -22,7 +22,7 @@ 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 { @@ -30,11 +30,11 @@ public class FaresIntegrationTest { 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) @@ -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( diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java index c209bc22192..19b55489778 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/GtfsFaresV2ServiceTest.java @@ -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; @@ -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"); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java index 17c381f1bd6..072e8a5a4fe 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HSLFareServiceTest.java @@ -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; @@ -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; @@ -76,7 +75,7 @@ private static List 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)); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java index e9aa17ba35f..c65db6c3a9f 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/HighestFareInFreeTransferWindowFareServiceTest.java @@ -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; diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java index 67eb7e3ed93..1e7ff64c5dd 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java @@ -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") @@ -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 testCases() { return List.of( 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 56d66081e35..cac0707af92 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 @@ -33,7 +33,7 @@ import org.opentripplanner.routing.api.request.framework.TimeAndCostPenalty; import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This test checks the combination of transit and flex works. @@ -48,7 +48,7 @@ public class FlexIntegrationTest { static Graph graph; - static TransitModel transitModel; + static TimetableRepository timetableRepository; static RoutingService service; @@ -57,23 +57,23 @@ static void setup() { OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, true)); TestOtpModel model = FlexIntegrationTestData.cobbOsm(); graph = model.graph(); - transitModel = model.transitModel(); + timetableRepository = model.timetableRepository(); addGtfsToGraph( graph, - transitModel, + timetableRepository, List.of( FlexIntegrationTestData.COBB_BUS_30_GTFS, FlexIntegrationTestData.MARTA_BUS_856_GTFS, FlexIntegrationTestData.COBB_FLEX_GTFS ) ); - service = TestServerContext.createServerContext(graph, transitModel).routingService(); + service = TestServerContext.createServerContext(graph, timetableRepository).routingService(); } @Test void addFlexTripsAndPatternsToGraph() { - assertFalse(transitModel.getAllTripPatterns().isEmpty()); + assertFalse(timetableRepository.getAllTripPatterns().isEmpty()); } @Test @@ -176,22 +176,26 @@ static void teardown() { OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, false)); } - private static void addGtfsToGraph(Graph graph, TransitModel transitModel, List gtfsFiles) { + private static void addGtfsToGraph( + Graph graph, + TimetableRepository timetableRepository, + List gtfsFiles + ) { // GTFS var gtfsBundles = gtfsFiles.stream().map(GtfsBundle::new).toList(); GtfsModule gtfsModule = new GtfsModule( gtfsBundles, - transitModel, + timetableRepository, graph, ServiceDateInterval.unbounded() ); gtfsModule.buildGraph(); // link stations to streets - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); // link flex locations to streets - new AreaStopsToVerticesMapper(graph, transitModel).buildGraph(); + new AreaStopsToVerticesMapper(graph, timetableRepository).buildGraph(); // generate direct transfers var req = new RouteRequest(); @@ -199,15 +203,15 @@ private static void addGtfsToGraph(Graph graph, TransitModel transitModel, List< // we don't have a complete coverage of the entire area so use straight lines for transfers new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, Duration.ofMinutes(10), List.of(req) ) .buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); } private Itinerary getItinerary(GenericLocation from, GenericLocation to, int index) { 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 d3f4f7a62e8..a1d41cdebb5 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 @@ -16,7 +16,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public final class FlexIntegrationTestData { @@ -43,20 +43,20 @@ public static TestOtpModel cobbOsm() { private static TestOtpModel buildFlexGraph(File file) { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); GtfsBundle gtfsBundle = new GtfsBundle(file); GtfsModule module = new GtfsModule( List.of(gtfsBundle), - transitModel, + timetableRepository, graph, new ServiceDateInterval(LocalDate.of(2021, 1, 1), LocalDate.of(2022, 1, 1)) ); OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, true)); module.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, false)); - assertTrue(transitModel.hasFlexTrips()); - return new TestOtpModel(graph, transitModel); + assertTrue(timetableRepository.hasFlexTrips()); + return new TestOtpModel(graph, timetableRepository); } } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java index 8437a62e6da..acf0d3b2699 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexStopTimesForTest.java @@ -5,13 +5,13 @@ import org.opentripplanner._support.geometry.Polygons; import org.opentripplanner.framework.time.TimeUtils; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; public class FlexStopTimesForTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final StopLocation AREA_STOP = TEST_MODEL .areaStop("area") .withGeometry(Polygons.BERLIN) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java index e116831e2d3..4bd042d332c 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/GtfsFlexTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.ext.flex.trip.FlexTrip; import org.opentripplanner.ext.flex.trip.UnscheduledTrip; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This test makes sure that one of the example feeds in the GTFS-Flex repo works. It's the City of @@ -23,17 +23,17 @@ */ class GtfsFlexTest { - private static TransitModel transitModel; + private static TimetableRepository timetableRepository; @BeforeAll static void setup() { TestOtpModel model = FlexIntegrationTestData.aspenGtfs(); - transitModel = model.transitModel(); + timetableRepository = model.timetableRepository(); } @Test void parseAspenTaxiAsUnscheduledTrip() { - var flexTrips = transitModel.getAllFlexTrips(); + var flexTrips = timetableRepository.getAllFlexTrips(); assertFalse(flexTrips.isEmpty()); assertEquals( Set.of("t_1289262_b_29084_tn_0", "t_1289257_b_28352_tn_0"), @@ -48,6 +48,6 @@ void parseAspenTaxiAsUnscheduledTrip() { @Test void shouldGeneratePatternForFlexTripWithSingleStop() { - assertFalse(transitModel.getAllTripPatterns().isEmpty()); + assertFalse(timetableRepository.getAllTripPatterns().isEmpty()); } } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java index 985ca5a9898..e6fddb07cf8 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/flexpathcalculator/ScheduledFlexPathCalculatorTest.java @@ -5,7 +5,7 @@ import static org.opentripplanner.ext.flex.FlexStopTimesForTest.regularStopTime; import static org.opentripplanner.street.model._data.StreetModelForTest.V1; import static org.opentripplanner.street.model._data.StreetModelForTest.V2; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.Duration; import java.util.List; diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java index 8c73d0901ff..cdb8bb8ff4e 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/template/FlexTemplateFactoryTest.java @@ -30,7 +30,7 @@ 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._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.timetable.Trip; @@ -38,7 +38,7 @@ class FlexTemplateFactoryTest { - private static final TransitModelForTest MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest MODEL = TimetableRepositoryForTest.of(); /** * This is pass-through information @@ -78,7 +78,7 @@ class FlexTemplateFactoryTest { private static final StopLocation GROUP_STOP_12 = MODEL.groupStop("G", STOP_G1, STOP_G2); private static final StopLocation GROUP_STOP_34 = MODEL.groupStop("G", STOP_G3, STOP_G4); - private static final Trip TRIP = TransitModelForTest.trip("Trip").build(); + private static final Trip TRIP = TimetableRepositoryForTest.trip("Trip").build(); private static final int T_10_00 = time("10:00"); private static final int T_10_10 = time("10:10"); private static final int T_10_20 = time("10:20"); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java index fad9e98e254..73364caccf1 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.ext.flex.flexpathcalculator.DirectFlexPathCalculator; import org.opentripplanner.model.StopTime; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.service.StopModel; class FlexTripsMapperTest { @@ -30,7 +30,7 @@ void defaultTimePenalty() { private static StopTime stopTime(int seq) { var st = FlexStopTimesForTest.area("08:00", "18:00"); - st.setTrip(TransitModelForTest.trip("flex-1").build()); + st.setTrip(TimetableRepositoryForTest.trip("flex-1").build()); st.setStopSequence(seq); return st; } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java index 6466d7bf6d6..4c77ecc6134 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/ScheduledDeviatedTripTest.java @@ -44,7 +44,7 @@ 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.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This tests that the feed for the Cobb County Flex service is processed correctly. This service @@ -56,13 +56,13 @@ class ScheduledDeviatedTripTest { static Graph graph; - static TransitModel transitModel; + static TimetableRepository timetableRepository; float delta = 0.01f; @Test void parseCobbCountyAsScheduledDeviatedTrip() { - var flexTrips = transitModel.getAllFlexTrips(); + var flexTrips = timetableRepository.getAllFlexTrips(); assertFalse(flexTrips.isEmpty()); assertEquals(72, flexTrips.size()); @@ -101,7 +101,7 @@ void calculateDirectFare() { var router = new FlexRouter( graph, - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), FlexParameters.defaultValues(), OffsetDateTime.parse("2021-11-12T10:15:24-05:00").toInstant(), null, @@ -134,9 +134,9 @@ void calculateDirectFare() { */ @Test void flexTripInTransitMode() { - var feedId = transitModel.getFeedIds().iterator().next(); + var feedId = 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("Transfer Point for Route 30", feedId, "cujv"); @@ -177,8 +177,8 @@ void flexTripInTransitMode() { */ @Test void shouldNotInterpolateFlexTimes() { - var feedId = transitModel.getFeedIds().iterator().next(); - var pattern = transitModel.getTripPatternForId(new FeedScopedId(feedId, "090z:0:01")); + var feedId = timetableRepository.getFeedIds().iterator().next(); + var pattern = timetableRepository.getTripPatternForId(new FeedScopedId(feedId, "090z:0:01")); assertEquals(3, pattern.numberOfStops()); @@ -192,7 +192,7 @@ void shouldNotInterpolateFlexTimes() { static void setup() { TestOtpModel model = FlexIntegrationTestData.cobbFlexGtfs(); graph = model.graph(); - transitModel = model.transitModel(); + timetableRepository = model.timetableRepository(); } private static List getItineraries( @@ -248,8 +248,8 @@ private static NearbyStop getNearbyStop(FlexTrip trip, String id) { } private static FlexTrip getFlexTrip() { - var feedId = transitModel.getFeedIds().iterator().next(); + var feedId = timetableRepository.getFeedIds().iterator().next(); var tripId = new FeedScopedId(feedId, "a326c618-d42c-4bd1-9624-c314fbf8ecd8"); - return transitModel.getFlexTrip(tripId); + return timetableRepository.getFlexTrip(tripId); } } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java index f19478af629..f6fd43595a9 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledDrivingDurationTest.java @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.street.model._data.StreetModelForTest.V1; import static org.opentripplanner.street.model._data.StreetModelForTest.V2; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.Duration; import java.util.List; diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java index 6280095b6be..d235dd5a950 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/UnscheduledTripTest.java @@ -3,14 +3,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.ext.flex.FlexStopTimesForTest.area; -import static org.opentripplanner.ext.flex.FlexStopTimesForTest.regularArrival; -import static org.opentripplanner.ext.flex.FlexStopTimesForTest.regularDeparture; import static org.opentripplanner.ext.flex.trip.UnscheduledTrip.isUnscheduledTrip; import static org.opentripplanner.ext.flex.trip.UnscheduledTripTest.TestCase.tc; import static org.opentripplanner.model.PickDrop.NONE; import static org.opentripplanner.model.StopTime.MISSING_VALUE; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Collections; import java.util.List; @@ -25,9 +22,7 @@ import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.model.PickDrop; import org.opentripplanner.model.StopTime; -import org.opentripplanner.routing.graphfinder.NearbyStop; -import org.opentripplanner.transit.model._data.TransitModelForTest; -import org.opentripplanner.transit.model.site.AreaStop; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; @@ -41,7 +36,7 @@ class UnscheduledTripTest { private static final int T14_00 = TimeUtils.hm2time(14, 0); private static final int T15_00 = TimeUtils.hm2time(15, 0); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop REGULAR_STOP = TEST_MODEL.stop("stop").build(); @@ -56,7 +51,7 @@ class IsUnscheduledTrip { private static final StopTime CONTINUOUS_DROP_OFF_STOP = new StopTime(); static { - var trip = TransitModelForTest.trip("flex").build(); + var trip = TimetableRepositoryForTest.trip("flex").build(); SCHEDULED_STOP.setArrivalTime(30); SCHEDULED_STOP.setDepartureTime(60); SCHEDULED_STOP.setStop(AREA_STOP); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java index de6e600037c..9d90cbb5f26 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java @@ -1,7 +1,7 @@ package org.opentripplanner.ext.geocoder; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.transit.model.basic.TransitMode.BUS; import static org.opentripplanner.transit.model.basic.TransitMode.FERRY; @@ -21,7 +21,7 @@ import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; import org.opentripplanner.model.FeedInfo; -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; @@ -31,11 +31,11 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class LuceneIndexTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); static final Agency BVG = Agency .of(id("bvg")) @@ -126,9 +126,9 @@ static void setup() { List .of(ALEXANDERPLATZ_STATION, BERLIN_HAUPTBAHNHOF_STATION, FIVE_POINTS_STATION) .forEach(stopModel::withStation); - var transitModel = new TransitModel(stopModel.build(), new Deduplicator()); - transitModel.index(); - var transitService = new DefaultTransitService(transitModel) { + var timetableRepository = new TimetableRepository(stopModel.build(), new Deduplicator()); + timetableRepository.index(); + var transitService = new DefaultTransitService(timetableRepository) { private final Multimap modes = ImmutableMultimap .builder() .putAll(WESTHAFEN, FERRY, BUS) @@ -153,7 +153,7 @@ public Agency getAgencyForId(FeedScopedId id) { @Override public Set getRoutesForStop(StopLocation stop) { - return Set.of(TransitModelForTest.route("route1").withAgency(BVG).build()); + return Set.of(TimetableRepositoryForTest.route("route1").withAgency(BVG).build()); } @Override @@ -171,7 +171,7 @@ public FeedInfo getFeedInfo(String feedId) { }; var stopConsolidationService = new DefaultStopConsolidationService( new DefaultStopConsolidationRepository(), - transitModel + timetableRepository ); index = new LuceneIndex(transitService, stopConsolidationService); mapper = new StopClusterMapper(transitService, stopConsolidationService); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java index 578f7d4118f..b98de173817 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java @@ -7,17 +7,17 @@ import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; import org.opentripplanner.ext.stopconsolidation.model.ConsolidatedStopGroup; -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.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class StopClusterMapperTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop STOP_A = TEST_MODEL.stop("A").build(); private static final RegularStop STOP_B = TEST_MODEL.stop("B").build(); private static final RegularStop STOP_C = TEST_MODEL.stop("C").build(); @@ -26,7 +26,7 @@ class StopClusterMapperTest { .stopModelBuilder() .withRegularStops(STOPS) .build(); - private static final TransitModel TRANSIT_MODEL = new TransitModel( + private static final TimetableRepository TRANSIT_MODEL = new TimetableRepository( STOP_MODEL, new Deduplicator() ); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java b/application/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java index ce841be54a7..82023904f0f 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/mapping/TransmodelMappingUtilTest.java @@ -6,7 +6,7 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.apis.transmodel.mapping.TransitIdMapper; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.organization.Agency; @@ -33,7 +33,7 @@ public void resolveFixedFeedIdTest() { Agency agency(String feedScope, int id) { // We use the test builder to make sure we get back an agency with all required fields - return TransitModelForTest + return TimetableRepositoryForTest .agency("Agency " + id) .copy() .withId(new FeedScopedId(feedScope, Integer.toString(id))) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java b/application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java index e5b842a474a..6150cfc6c18 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/realtimeresolver/RealtimeResolverTest.java @@ -23,21 +23,21 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; class RealtimeResolverTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); - private final Route route1 = TransitModelForTest.route("route1").build(); - private final Route route2 = TransitModelForTest.route("route2").build(); + private final Route route1 = TimetableRepositoryForTest.route("route1").build(); + private final Route route2 = TimetableRepositoryForTest.route("route2").build(); private final RegularStop stop1 = testModel.stop("stop1", 1, 1).build(); private final RegularStop stop2 = testModel.stop("stop2", 2, 1).build(); @@ -90,7 +90,7 @@ void testPopulateLegsWithRealtimeNonTransit() { .bus(route1, 1, time("11:20"), time("11:40"), Place.forStop(stop3)) .build(); - var model = new TransitModel(); + var model = new TimetableRepository(); model.index(); var transitService = new DefaultTransitService(model); @@ -164,23 +164,27 @@ private static TransitService makeTransitService( List patterns, LocalDate serviceDate ) { - var transitModel = new TransitModel(); + var timetableRepository = new TimetableRepository(); CalendarServiceData calendarServiceData = new CalendarServiceData(); patterns.forEach(pattern -> { - transitModel.addTripPattern(pattern.getId(), pattern); + timetableRepository.addTripPattern(pattern.getId(), pattern); var serviceCode = pattern.getScheduledTimetable().getTripTimes(0).getServiceCode(); - transitModel.getServiceCodes().put(pattern.getId(), serviceCode); + timetableRepository.getServiceCodes().put(pattern.getId(), serviceCode); calendarServiceData.putServiceDatesForServiceId(pattern.getId(), List.of(serviceDate)); }); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); - transitModel.index(); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); + timetableRepository.index(); - return new DefaultTransitService(transitModel) { - final TransitAlertService alertService = new TransitAlertServiceImpl(transitModel); + return new DefaultTransitService(timetableRepository) { + final TransitAlertService alertService = new TransitAlertServiceImpl(timetableRepository); @Override public TransitAlertService getTransitAlertService() { diff --git a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java index 7f389bc41ec..932ae697213 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java @@ -5,7 +5,7 @@ import static org.opentripplanner.ext.stopconsolidation.TestStopConsolidationModel.STOP_D; import static org.opentripplanner.model.plan.PlanTestConstants.T11_05; import static org.opentripplanner.model.plan.PlanTestConstants.T11_12; -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; @@ -35,13 +35,13 @@ class DecorateConsolidatedStopNamesTest { @Test void changeNames() { - var transitModel = TestStopConsolidationModel.buildTransitModel(); + var timetableRepository = TestStopConsolidationModel.buildTimetableRepository(); var groups = List.of(new ConsolidatedStopGroup(STOP_C.getId(), List.of(STOP_D.getId()))); var repo = new DefaultStopConsolidationRepository(); repo.addGroups(groups); - var service = new DefaultStopConsolidationService(repo, transitModel); + var service = new DefaultStopConsolidationService(repo, timetableRepository); var filter = new DecorateConsolidatedStopNames(service); var itinerary = TestItineraryBuilder diff --git a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java index 0df495d63d0..91f62c319f6 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModuleTest.java @@ -20,13 +20,13 @@ class StopConsolidationModuleTest { void replacePatterns() { var groups = List.of(new ConsolidatedStopGroup(STOP_D.getId(), List.of(STOP_B.getId()))); - var transitModel = TestStopConsolidationModel.buildTransitModel(); - transitModel.addTripPattern(PATTERN.getId(), PATTERN); + var timetableRepository = TestStopConsolidationModel.buildTimetableRepository(); + timetableRepository.addTripPattern(PATTERN.getId(), PATTERN); var repo = new DefaultStopConsolidationRepository(); - var module = new StopConsolidationModule(transitModel, repo, groups); + var module = new StopConsolidationModule(timetableRepository, repo, groups); module.buildGraph(); - var modifiedPattern = transitModel.getTripPatternForId(PATTERN.getId()); + var modifiedPattern = timetableRepository.getTripPatternForId(PATTERN.getId()); assertFalse(modifiedPattern.getRoutingTripPattern().getPattern().sameAs(PATTERN)); assertFalse(modifiedPattern.sameAs(PATTERN)); @@ -37,7 +37,7 @@ void replacePatterns() { .getStop(1); assertEquals(modifiedStop, STOP_D); - var patterns = List.copyOf(transitModel.getAllTripPatterns()); + var patterns = List.copyOf(timetableRepository.getAllTripPatterns()); var stops = patterns.stream().map(TripPattern::getStops).toList(); assertEquals(List.of(List.of(STOP_A, STOP_D, STOP_C)), stops); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java index da0c1d6f61d..193eddf9690 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java @@ -1,9 +1,9 @@ package org.opentripplanner.ext.stopconsolidation; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; -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.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -11,26 +11,26 @@ import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class TestStopConsolidationModel { - private static final TransitModelForTest testModel = TransitModelForTest.of(); + private static final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); public static final RegularStop STOP_A = testModel.stop("A").withCoordinate(1, 1).build(); public static final RegularStop STOP_B = testModel.stop("B").withCoordinate(1.1, 1.1).build(); public static final RegularStop STOP_C = testModel.stop("C").withCoordinate(1.2, 1.2).build(); - public static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern( + public static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( STOP_A, STOP_B, STOP_C ); static final String SECONDARY_FEED_ID = "secondary"; - static final Agency AGENCY = TransitModelForTest + static final Agency AGENCY = TimetableRepositoryForTest .agency("agency") .copy() .withId(new FeedScopedId(SECONDARY_FEED_ID, "agency")) .build(); - static final Route ROUTE = TransitModelForTest + static final Route ROUTE = TimetableRepositoryForTest .route(new FeedScopedId(SECONDARY_FEED_ID, "route-33")) .withAgency(AGENCY) .build(); @@ -45,9 +45,9 @@ class TestStopConsolidationModel { .withStopPattern(STOP_PATTERN) .build(); - static TransitModel buildTransitModel() { + static TimetableRepository buildTimetableRepository() { var stopModelBuilder = testModel.stopModelBuilder(); List.of(STOP_A, STOP_B, STOP_C, STOP_D).forEach(stopModelBuilder::withRegularStop); - return new TransitModel(stopModelBuilder.build(), new Deduplicator()); + return new TimetableRepository(stopModelBuilder.build(), new Deduplicator()); } } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java index ac5eb6d66e4..7bf87b4c89c 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationRepositoryTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -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; diff --git a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java index b2fc356d111..1dd07a075ed 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationServiceTest.java @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class DefaultStopConsolidationServiceTest { @@ -11,7 +11,7 @@ class DefaultStopConsolidationServiceTest { void isActive() { var service = new DefaultStopConsolidationService( new DefaultStopConsolidationRepository(), - new TransitModel() + new TimetableRepository() ); assertFalse(service.isActive()); } 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 ff9509a8474..be379fb6fa6 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 @@ -8,7 +8,7 @@ import org.opentripplanner.TestServerContext; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.test.support.HttpForTest; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class VectorTilesResourceTest { @@ -17,7 +17,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 TransitModel()), + TestServerContext.createServerContext(new Graph(), new TimetableRepository()), grizzlyRequest, "default" ); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java index f12d43b62cf..871a4b4c7da 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/LayerFiltersTest.java @@ -7,13 +7,13 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.transit.model._data.PatternTestModel; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.RegularStop; class LayerFiltersTest { - private static final RegularStop STOP = TransitModelForTest.of().stop("1").build(); + private static final RegularStop STOP = TimetableRepositoryForTest.of().stop("1").build(); private static final LocalDate DATE = LocalDate.of(2024, 9, 5); private static final TripPattern PATTERN = PatternTestModel.pattern(); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java index d187b611ef3..b97cbcdc6fe 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/TestTransitService.java @@ -1,23 +1,23 @@ package org.opentripplanner.ext.vectortiles.layers; import java.util.Set; -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.network.Route; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TestTransitService extends DefaultTransitService { - public TestTransitService(TransitModel transitModel) { - super(transitModel); + public TestTransitService(TimetableRepository timetableRepository) { + super(timetableRepository); } @Override public Set getRoutesForStop(StopLocation stop) { return Set.of( - TransitModelForTest.route("1").withMode(TransitMode.RAIL).withGtfsType(100).build() + TimetableRepositoryForTest.route("1").withMode(TransitMode.RAIL).withGtfsType(100).build() ); } } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java index 5387df91bca..7d14d11785c 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java @@ -6,20 +6,22 @@ import java.util.List; import java.util.Locale; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.service.StopModel; class AreaStopPropertyMapperTest { - private static final TransitModelForTest MODEL = new TransitModelForTest(StopModel.of()); + private static final TimetableRepositoryForTest MODEL = new TimetableRepositoryForTest( + StopModel.of() + ); private static final AreaStop STOP = MODEL.areaStop("123").build(); - private static final Route ROUTE_WITH_COLOR = TransitModelForTest + private static final Route ROUTE_WITH_COLOR = TimetableRepositoryForTest .route("123") .withColor("ffffff") .build(); - private static final Route ROUTE_WITHOUT_COLOR = TransitModelForTest.route("456").build(); + private static final Route ROUTE_WITHOUT_COLOR = TimetableRepositoryForTest.route("456").build(); @Test void map() { diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java index 2e6c4e16c40..7cfab197cf1 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java @@ -17,7 +17,7 @@ import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; import org.opentripplanner.transit.service.StopModelBuilder; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class AreaStopsLayerBuilderTest { @@ -54,17 +54,17 @@ class AreaStopsLayerBuilderTest { .withGeometry(Polygons.BERLIN) .build(); - private final TransitModel transitModel = new TransitModel( + private final TimetableRepository timetableRepository = new TimetableRepository( stopModelBuilder.withAreaStop(AREA_STOP).build(), new Deduplicator() ); @Test void getAreaStops() { - transitModel.index(); + timetableRepository.index(); var subject = new AreaStopsLayerBuilder( - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), LAYER_CONFIG, Locale.ENGLISH ); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java index da85285954d..2f37afc76be 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java @@ -1,7 +1,7 @@ package org.opentripplanner.ext.vectortiles.layers.stations; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.HashMap; import java.util.Locale; @@ -9,20 +9,20 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.ext.vectortiles.layers.TestTransitService; import org.opentripplanner.framework.i18n.I18NString; -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.Station; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class DigitransitStationPropertyMapperTest { @Test void map() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.index(); - var transitService = new TestTransitService(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.index(); + var transitService = new TestTransitService(timetableRepository); var mapper = DigitransitStationPropertyMapper.create(transitService, Locale.US); @@ -32,7 +32,7 @@ void map() { .withName(I18NString.of("A station")) .build(); - TransitModelForTest.of().stop("stop-1").withParentStation(station).build(); + TimetableRepositoryForTest.of().stop("stop-1").withParentStation(station).build(); Map map = new HashMap<>(); mapper.map(station).forEach(o -> map.put(o.key(), o.value())); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java index 796b2a204da..867903c410a 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java @@ -21,14 +21,14 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -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.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class RealtimeStopsLayerTest { @@ -62,11 +62,11 @@ public void setUp() { @Test void realtimeStopLayer() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.initTimeZone(ZoneIds.HELSINKI); - transitModel.index(); - var transitService = new DefaultTransitService(transitModel) { - final TransitAlertService alertService = new TransitAlertServiceImpl(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.initTimeZone(ZoneIds.HELSINKI); + timetableRepository.index(); + var transitService = new DefaultTransitService(timetableRepository) { + final TransitAlertService alertService = new TransitAlertServiceImpl(timetableRepository); @Override public TransitAlertService getTransitAlertService() { @@ -74,7 +74,7 @@ public TransitAlertService getTransitAlertService() { } }; - Route route = TransitModelForTest.route("route").build(); + Route route = TimetableRepositoryForTest.route("route").build(); var itinerary = newItinerary(Place.forStop(stop), time("11:00")) .bus(route, 1, time("11:05"), time("11:20"), Place.forStop(stop2)) .build(); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java index 7760eee13b8..046c5839db0 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java @@ -1,7 +1,7 @@ package org.opentripplanner.ext.vectortiles.layers.stops; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.HashMap; import java.util.Locale; @@ -17,7 +17,7 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class StopsLayerTest { @@ -59,9 +59,9 @@ public class StopsLayerTest { @Test public void digitransitStopPropertyMapperTest() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.index(); - var transitService = new TestTransitService(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.index(); + var transitService = new TestTransitService(timetableRepository); DigitransitStopPropertyMapper mapper = DigitransitStopPropertyMapper.create( transitService, @@ -81,9 +81,9 @@ public void digitransitStopPropertyMapperTest() { @Test public void digitransitStopPropertyMapperTranslationTest() { var deduplicator = new Deduplicator(); - var transitModel = new TransitModel(new StopModel(), deduplicator); - transitModel.index(); - var transitService = new DefaultTransitService(transitModel); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository.index(); + var transitService = new DefaultTransitService(timetableRepository); DigitransitStopPropertyMapper mapper = DigitransitStopPropertyMapper.create( transitService, diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java index 1beca037457..95ad7ea713e 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingGroupsLayerTest.java @@ -26,12 +26,12 @@ import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; import org.opentripplanner.routing.vehicle_parking.VehicleParkingState; import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; public class VehicleParkingGroupsLayerTest { - private static final FeedScopedId ID = TransitModelForTest.id("id"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("id"); private VehicleParkingGroup vehicleParkingGroup; private VehicleParking vehicleParking; diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java index 14e96e2aa28..b63c9c51bc6 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/vehicleparkings/VehicleParkingsLayerTest.java @@ -29,13 +29,13 @@ import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; import org.opentripplanner.routing.vehicle_parking.VehicleParkingState; import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig; -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.framework.FeedScopedId; public class VehicleParkingsLayerTest { - private static final FeedScopedId ID = TransitModelForTest.id("id"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("id"); private VehicleParking vehicleParking; diff --git a/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java b/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java index 8b969c99344..be237236700 100644 --- a/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java @@ -12,7 +12,7 @@ import org.opentripplanner.routing.graph.index.StreetIndex; import org.opentripplanner.street.model.vertex.StreetVertex; import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,31 +25,31 @@ public class AreaStopsToVerticesMapper implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(AreaStopsToVerticesMapper.class); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; @Inject - public AreaStopsToVerticesMapper(Graph graph, TransitModel transitModel) { + public AreaStopsToVerticesMapper(Graph graph, TimetableRepository timetableRepository) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; } @Override @SuppressWarnings("Convert2MethodRef") public void buildGraph() { - if (!transitModel.getStopModel().hasAreaStops()) { + if (!timetableRepository.getStopModel().hasAreaStops()) { return; } - StreetIndex streetIndex = graph.getStreetIndexSafe(transitModel.getStopModel()); + StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); ProgressTracker progress = ProgressTracker.track( "Add flex locations to street vertices", 1, - transitModel.getStopModel().listAreaStops().size() + timetableRepository.getStopModel().listAreaStops().size() ); LOG.info(progress.startMessage()); - var results = transitModel + var results = timetableRepository .getStopModel() .listAreaStops() .parallelStream() diff --git a/application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java b/application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java index a875ba0f516..cd047de6d04 100644 --- a/application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/FlexIndex.java @@ -12,7 +12,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.GroupStop; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class FlexIndex { @@ -24,11 +24,11 @@ public class FlexIndex { private final Map> tripById = new HashMap<>(); - public FlexIndex(TransitModel transitModel) { - for (PathTransfer transfer : transitModel.getAllPathTransfers()) { + public FlexIndex(TimetableRepository timetableRepository) { + for (PathTransfer transfer : timetableRepository.getAllPathTransfers()) { transfersToStop.put(transfer.to, transfer); } - for (FlexTrip flexTrip : transitModel.getAllFlexTrips()) { + for (FlexTrip flexTrip : timetableRepository.getAllFlexTrips()) { routeById.put(flexTrip.getTrip().getRoute().getId(), flexTrip.getTrip().getRoute()); tripById.put(flexTrip.getTrip().getId(), flexTrip); for (StopLocation stop : flexTrip.getStops()) { diff --git a/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java index 764c40d3f86..72ac22b027a 100644 --- a/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java +++ b/application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java @@ -48,7 +48,7 @@ import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.site.StopLocationsGroup; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; public class LuceneIndex implements Serializable { @@ -73,8 +73,11 @@ public class LuceneIndex implements Serializable { * However, we do need some methods in the service and that's why we instantiate it manually in this * constructor. */ - public LuceneIndex(TransitModel transitModel, StopConsolidationService stopConsolidationService) { - this(new DefaultTransitService(transitModel), stopConsolidationService); + public LuceneIndex( + TimetableRepository timetableRepository, + StopConsolidationService stopConsolidationService + ) { + this(new DefaultTransitService(timetableRepository), stopConsolidationService); } /** diff --git a/application/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java b/application/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java index 9eaf6ade8e5..666ff5d7eaf 100644 --- a/application/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java +++ b/application/src/ext/java/org/opentripplanner/ext/geocoder/configure/GeocoderModule.java @@ -7,7 +7,7 @@ import org.opentripplanner.ext.geocoder.LuceneIndex; import org.opentripplanner.ext.stopconsolidation.StopConsolidationService; import org.opentripplanner.framework.application.OTPFeature; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This module builds the Lucene geocoder based on whether the feature flag is on or off. @@ -19,11 +19,11 @@ public class GeocoderModule { @Singleton @Nullable LuceneIndex luceneIndex( - TransitModel transitModel, + TimetableRepository timetableRepository, @Nullable StopConsolidationService stopConsolidationService ) { if (OTPFeature.SandboxAPIGeocoder.isOn()) { - return new LuceneIndex(transitModel, stopConsolidationService); + return new LuceneIndex(timetableRepository, stopConsolidationService); } else { return null; } diff --git a/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java index b6a9f014c81..0f3e2afe1ea 100644 --- a/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java +++ b/application/src/ext/java/org/opentripplanner/ext/siri/updater/azure/SiriAzureSXUpdater.java @@ -17,7 +17,7 @@ import org.apache.hc.core5.net.URIBuilder; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.alert.TransitAlertProvider; import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import org.rutebanken.siri20.util.SiriXml; @@ -35,11 +35,14 @@ public class SiriAzureSXUpdater extends AbstractAzureSiriUpdater implements Tran private final LocalDate fromDateTime; private final LocalDate toDateTime; - public SiriAzureSXUpdater(SiriAzureSXUpdaterParameters config, TransitModel transitModel) { + public SiriAzureSXUpdater( + SiriAzureSXUpdaterParameters config, + TimetableRepository timetableRepository + ) { super(config); this.fromDateTime = config.getFromDateTime(); this.toDateTime = config.getToDateTime(); - this.transitAlertService = new TransitAlertServiceImpl(transitModel); + this.transitAlertService = new TransitAlertServiceImpl(timetableRepository); this.updateHandler = new SiriAlertsUpdateHandler(feedId, transitAlertService, Duration.ZERO); } diff --git a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java index 7f5cf431a4c..35db41764a9 100644 --- a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/StopConsolidationModule.java @@ -10,7 +10,7 @@ import org.opentripplanner.ext.stopconsolidation.model.StopReplacement; import org.opentripplanner.graph_builder.model.GraphBuilderModule; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,15 +28,15 @@ public class StopConsolidationModule implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(TripPattern.class); private final StopConsolidationRepository repository; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final Collection groups; public StopConsolidationModule( - TransitModel transitModel, + TimetableRepository timetableRepository, StopConsolidationRepository repository, Collection groups ) { - this.transitModel = Objects.requireNonNull(transitModel); + this.timetableRepository = Objects.requireNonNull(timetableRepository); this.repository = Objects.requireNonNull(repository); this.groups = Objects.requireNonNull(groups); } @@ -45,19 +45,19 @@ public StopConsolidationModule( public void buildGraph() { repository.addGroups(groups); - var service = new DefaultStopConsolidationService(repository, transitModel); + var service = new DefaultStopConsolidationService(repository, timetableRepository); var stopsToReplace = service.secondaryStops(); var replacements = service.replacements(); - transitModel + timetableRepository .getAllTripPatterns() .stream() .filter(pattern -> pattern.containsAnyStopId(stopsToReplace)) .forEach(pattern -> { LOG.info("Replacing stop(s) in pattern {}", pattern); var modifiedPattern = modifyStopsInPattern(pattern, replacements); - transitModel.addTripPattern(modifiedPattern.getId(), modifiedPattern); + timetableRepository.addTripPattern(modifiedPattern.getId(), modifiedPattern); }); } @@ -71,14 +71,14 @@ private TripPattern modifyStopsInPattern( } public static StopConsolidationModule of( - TransitModel transitModel, + TimetableRepository timetableRepository, StopConsolidationRepository repo, DataSource ds ) { LOG.info("Reading stop consolidation information from '{}'", ds); try (var inputStream = ds.asInputStream()) { var groups = StopConsolidationParser.parseGroups(inputStream); - return new StopConsolidationModule(transitModel, repo, groups); + return new StopConsolidationModule(timetableRepository, repo, groups); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java index 3851435641c..5c829b20b67 100644 --- a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/configure/StopConsolidationServiceModule.java @@ -7,7 +7,7 @@ import org.opentripplanner.ext.stopconsolidation.StopConsolidationRepository; import org.opentripplanner.ext.stopconsolidation.StopConsolidationService; import org.opentripplanner.ext.stopconsolidation.internal.DefaultStopConsolidationService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; @Module public class StopConsolidationServiceModule { @@ -15,7 +15,10 @@ public class StopConsolidationServiceModule { @Provides @Singleton @Nullable - StopConsolidationService service(@Nullable StopConsolidationRepository repo, TransitModel tm) { + StopConsolidationService service( + @Nullable StopConsolidationRepository repo, + TimetableRepository tm + ) { if (repo == null) { return null; } else { diff --git a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java index 53a0f8ed827..36060eb5ff3 100644 --- a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java @@ -11,7 +11,7 @@ import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,14 +20,14 @@ public class DefaultStopConsolidationService implements StopConsolidationService private static final Logger LOG = LoggerFactory.getLogger(DefaultStopConsolidationService.class); private final StopConsolidationRepository repo; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; public DefaultStopConsolidationService( StopConsolidationRepository repo, - TransitModel transitModel + TimetableRepository timetableRepository ) { this.repo = Objects.requireNonNull(repo); - this.transitModel = Objects.requireNonNull(transitModel); + this.timetableRepository = Objects.requireNonNull(timetableRepository); } @Override @@ -36,7 +36,7 @@ public List replacements() { .groups() .stream() .flatMap(group -> { - var primaryStop = transitModel.getStopModel().getRegularStop(group.primary()); + var primaryStop = timetableRepository.getStopModel().getRegularStop(group.primary()); if (primaryStop == null) { LOG.error( "Could not find primary stop with id {}. Ignoring stop group {}.", @@ -93,7 +93,7 @@ private Optional findAgencySpecificStop(StopLocation stop, Agency .flatMap(g -> g.secondaries().stream()) .filter(secondary -> secondary.getFeedId().equals(agency.getId().getFeedId())) .findAny() - .map(id -> transitModel.getStopModel().getRegularStop(id)); + .map(id -> timetableRepository.getStopModel().getRegularStop(id)); } @Override @@ -105,6 +105,6 @@ public Optional primaryStop(FeedScopedId id) { .map(ConsolidatedStopGroup::primary) .findAny() .orElse(id); - return Optional.ofNullable(transitModel.getStopModel().getRegularStop(primaryId)); + return Optional.ofNullable(timetableRepository.getStopModel().getRegularStop(primaryId)); } } diff --git a/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java index 979912c5f37..701ff702a32 100644 --- a/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java +++ b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java @@ -18,7 +18,7 @@ import org.opentripplanner.routing.graphfinder.StreetGraphFinder; import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,18 +41,18 @@ public class DirectTransferAnalyzer implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(DirectTransferAnalyzer.class); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private final double radiusMeters; public DirectTransferAnalyzer( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, double radiusMeters ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.radiusMeters = radiusMeters; } @@ -60,7 +60,7 @@ public DirectTransferAnalyzer( @Override public void buildGraph() { /* Initialize transit index which is needed by the nearby stop finder. */ - transitModel.index(); + timetableRepository.index(); LOG.info("Analyzing transfers (this can be time consuming)..."); @@ -68,7 +68,7 @@ public void buildGraph() { List directTransfersNotFound = new ArrayList<>(); DirectGraphFinder nearbyStopFinderEuclidian = new DirectGraphFinder( - transitModel.getStopModel()::findRegularStops + timetableRepository.getStopModel()::findRegularStops ); StreetGraphFinder nearbyStopFinderStreets = new StreetGraphFinder(graph); diff --git a/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java index 449a1489d89..25959d5ec7a 100644 --- a/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java +++ b/application/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stations/StationsLayerBuilder.java @@ -23,7 +23,7 @@ public class StationsLayerBuilder extends LayerBuilder { MapperType.Digitransit, DigitransitStationPropertyMapper::create ); - private final TransitService transitModel; + private final TransitService transitService; public StationsLayerBuilder( TransitService transitService, @@ -35,11 +35,11 @@ public StationsLayerBuilder( layerParameters.name(), layerParameters.expansionFactor() ); - this.transitModel = transitService; + this.transitService = transitService; } protected List getGeometries(Envelope query) { - return transitModel + return transitService .getStations() .stream() .map(station -> { diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java index fa8601096dc..7d982e77885 100644 --- a/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/TransmodelAPI.java @@ -22,7 +22,7 @@ import org.opentripplanner.apis.transmodel.mapping.TransitIdMapper; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.standalone.api.OtpServerRequestContext; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,15 +66,15 @@ public TransmodelAPIOldPath( */ public static void setUp( TransmodelAPIParameters config, - TransitModel transitModel, + TimetableRepository timetableRepository, RouteRequest defaultRouteRequest ) { if (config.hideFeedId()) { - TransitIdMapper.setupFixedFeedId(transitModel.getAgencies()); + TransitIdMapper.setupFixedFeedId(timetableRepository.getAgencies()); } tracingHeaderTags = config.tracingHeaderTags(); maxNumberOfResultFields = config.maxNumberOfResultFields(); - schema = TransmodelGraphQLSchema.create(defaultRouteRequest, transitModel.getTimeZone()); + schema = TransmodelGraphQLSchema.create(defaultRouteRequest, timetableRepository.getTimeZone()); } @POST diff --git a/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java b/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java index d6f91696e64..bd629da9468 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java @@ -23,7 +23,7 @@ import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository; import org.opentripplanner.standalone.config.BuildConfig; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,15 +37,19 @@ public class GraphBuilder implements Runnable { private final List graphBuilderModules = new ArrayList<>(); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private boolean hasTransitData = false; @Inject - public GraphBuilder(Graph baseGraph, TransitModel transitModel, DataImportIssueStore issueStore) { + public GraphBuilder( + Graph baseGraph, + TimetableRepository timetableRepository, + DataImportIssueStore issueStore + ) { this.graph = baseGraph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; } @@ -57,7 +61,7 @@ public static GraphBuilder create( BuildConfig config, GraphBuilderDataSources dataSources, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, @Nullable EmissionsDataModel emissionsDataModel, @Nullable StopConsolidationRepository stopConsolidationRepository, @@ -70,18 +74,18 @@ public static GraphBuilder create( boolean hasNetex = dataSources.has(NETEX); boolean hasTransitData = hasGtfs || hasNetex; - transitModel.initTimeZone(config.transitModelTimeZone); + timetableRepository.initTimeZone(config.transitModelTimeZone); var builder = DaggerGraphBuilderFactory .builder() .config(config) .graph(graph) - .transitModel(transitModel) + .timetableRepository(timetableRepository) .worldEnvelopeRepository(worldEnvelopeRepository) .stopConsolidationRepository(stopConsolidationRepository) .streetLimitationParameters(streetLimitationParameters) .dataSources(dataSources) - .timeZoneId(transitModel.getTimeZone()); + .timeZoneId(timetableRepository.getTimeZone()); if (OTPFeature.Co2Emissions.isOn()) { builder.emissionsDataModel(emissionsDataModel); @@ -114,7 +118,7 @@ public static GraphBuilder create( graphBuilder.addModule(factory.tripPatternNamer()); } - if (hasTransitData && transitModel.getAgencyTimeZones().size() > 1) { + if (hasTransitData && timetableRepository.getAgencyTimeZones().size() > 1) { graphBuilder.addModule(factory.timeZoneAdjusterModule()); } @@ -194,7 +198,7 @@ public void run() { new DataImportIssueSummary(issueStore.listIssues()).logSummary(); // Log before we validate, this way we have more information if the validation fails - logGraphBuilderCompleteStatus(startTime, graph, transitModel); + logGraphBuilderCompleteStatus(startTime, graph, timetableRepository); validate(); } @@ -223,7 +227,7 @@ public DataImportIssueSummary issueSummary() { * configuration, for example, then this function will throw a {@link OtpAppException}. */ private void validate() { - if (hasTransitData() && !transitModel.hasTransit()) { + if (hasTransitData() && !timetableRepository.hasTransit()) { throw new OtpAppException( "The provided transit data have no trips within the configured transit service period. " + "There is something wrong with your data - see the log above. Another possibility is that the " + @@ -235,14 +239,14 @@ private void validate() { private static void logGraphBuilderCompleteStatus( long startTime, Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { long endTime = System.currentTimeMillis(); String time = DurationUtils.durationToStr(Duration.ofMillis(endTime - startTime)); var f = new OtpNumberFormat(); - var nStops = f.formatNumber(transitModel.getStopModel().stopIndexSize()); - var nPatterns = f.formatNumber(transitModel.getAllTripPatterns().size()); - var nTransfers = f.formatNumber(transitModel.getTransferService().listAll().size()); + var nStops = f.formatNumber(timetableRepository.getStopModel().stopIndexSize()); + var nPatterns = f.formatNumber(timetableRepository.getAllTripPatterns().size()); + var nTransfers = f.formatNumber(timetableRepository.getTransferService().listAll().size()); var nVertices = f.formatNumber(graph.countVertices()); var nEdges = f.formatNumber(graph.countEdges()); diff --git a/application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java b/application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java index 718622a142d..199146667ed 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/GraphStats.java @@ -27,7 +27,7 @@ import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +60,7 @@ public class GraphStats { private Graph graph; - private TransitModel transitModel; + private TimetableRepository timetableRepository; private CsvWriter writer; @@ -97,7 +97,7 @@ private void run() { File graphFile = new File(graphPath); SerializedGraphObject serializedGraphObject = SerializedGraphObject.load(graphFile); graph = serializedGraphObject.graph; - transitModel = serializedGraphObject.transitModel; + timetableRepository = serializedGraphObject.timetableRepository; /* open output stream (same for all commands) */ if (outPath != null) { @@ -220,7 +220,7 @@ public void run() { "empiricalDistTrips", } ); - Collection patterns = transitModel.getAllTripPatterns(); + Collection patterns = timetableRepository.getAllTripPatterns(); Multiset counts = TreeMultiset.create(); int nPatterns = patterns.size(); LOG.info("total number of patterns is: {}", nPatterns); diff --git a/application/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java b/application/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java index e4e67a0f3c1..0a551cff1c9 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/model/GraphBuilderModule.java @@ -4,7 +4,7 @@ public interface GraphBuilderModule { /** * Process whatever inputs were supplied to this module and update the model objects(graph, - * transitModel and issueStore). + * timetableRepository and issueStore). */ void buildGraph(); diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java similarity index 86% rename from application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java rename to application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java index a4bbb10da68..7aa5d65bef1 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitModelEntitiesToGraph.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java @@ -42,13 +42,13 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StationElement; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class AddTransitModelEntitiesToGraph { +public class AddTransitEntitiesToGraph { - private static final Logger LOG = LoggerFactory.getLogger(AddTransitModelEntitiesToGraph.class); + private static final Logger LOG = LoggerFactory.getLogger(AddTransitEntitiesToGraph.class); private final OtpTransitService otpTransitService; @@ -62,7 +62,7 @@ public class AddTransitModelEntitiesToGraph { * @param subwayAccessTime a positive integer for the extra time to access a subway platform, if * negative the default value of zero is used. */ - private AddTransitModelEntitiesToGraph( + private AddTransitEntitiesToGraph( OtpTransitService otpTransitService, int subwayAccessTime, Graph graph @@ -76,16 +76,16 @@ public static void addToGraph( OtpTransitService otpTransitService, int subwayAccessTime, Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { - new AddTransitModelEntitiesToGraph(otpTransitService, subwayAccessTime, graph) - .applyToGraph(transitModel); + new AddTransitEntitiesToGraph(otpTransitService, subwayAccessTime, graph) + .applyToGraph(timetableRepository); } - private void applyToGraph(TransitModel transitModel) { - transitModel.mergeStopModels(otpTransitService.stopModel()); + private void applyToGraph(TimetableRepository timetableRepository) { + timetableRepository.mergeStopModels(otpTransitService.stopModel()); - addStopsToGraphAndGenerateStopVertexes(transitModel); + addStopsToGraphAndGenerateStopVertexes(timetableRepository); addEntrancesToGraph(); addStationCentroidsToGraph(); addPathwayNodesToGraph(); @@ -94,26 +94,26 @@ private void applyToGraph(TransitModel transitModel) { // Although pathways are loaded from GTFS they are street data, so we will put them in the // street graph. createPathwayEdgesAndAddThemToGraph(); - addFeedInfoToGraph(transitModel); - addAgenciesToGraph(transitModel); - addServicesToTransitModel(transitModel); - addTripPatternsToTransitModel(transitModel); + addFeedInfoToGraph(timetableRepository); + addAgenciesToGraph(timetableRepository); + addServicesToTimetableRepository(timetableRepository); + addTripPatternsToTimetableRepository(timetableRepository); /* Interpret the transfers explicitly defined in transfers.txt. */ - addTransfersToGraph(transitModel); + addTransfersToGraph(timetableRepository); if (OTPFeature.FlexRouting.isOn()) { - addFlexTripsToGraph(transitModel); + addFlexTripsToGraph(timetableRepository); } } - private void addStopsToGraphAndGenerateStopVertexes(TransitModel transitModel) { + private void addStopsToGraphAndGenerateStopVertexes(TimetableRepository timetableRepository) { // Compute the set of modes for each stop based on all the TripPatterns it is part of Map> stopModeMap = new HashMap<>(); for (TripPattern pattern : otpTransitService.getTripPatterns()) { TransitMode mode = pattern.getMode(); - transitModel.addTransitMode(mode); + timetableRepository.addTransitMode(mode); for (var stop : pattern.getStops()) { Set set = stopModeMap.computeIfAbsent(stop, s -> new HashSet<>()); set.add(mode); @@ -335,45 +335,47 @@ private StopLevel getStopLevel(StationElementVertex vertex) { : new StopLevel(fromStation.getName(), null); } - private void addFeedInfoToGraph(TransitModel transitModel) { + private void addFeedInfoToGraph(TimetableRepository timetableRepository) { for (FeedInfo info : otpTransitService.getAllFeedInfos()) { - transitModel.addFeedInfo(info); + timetableRepository.addFeedInfo(info); } } - private void addAgenciesToGraph(TransitModel transitModel) { + private void addAgenciesToGraph(TimetableRepository timetableRepository) { for (Agency agency : otpTransitService.getAllAgencies()) { - transitModel.addAgency(agency); + timetableRepository.addAgency(agency); } } - private void addTransfersToGraph(TransitModel transitModel) { - transitModel.getTransferService().addAll(otpTransitService.getAllTransfers()); + private void addTransfersToGraph(TimetableRepository timetableRepository) { + timetableRepository.getTransferService().addAll(otpTransitService.getAllTransfers()); } - private void addServicesToTransitModel(TransitModel transitModel) { + private void addServicesToTimetableRepository(TimetableRepository timetableRepository) { /* Assign 0-based numeric codes to all GTFS service IDs. */ for (FeedScopedId serviceId : otpTransitService.getAllServiceIds()) { - transitModel.getServiceCodes().put(serviceId, transitModel.getServiceCodes().size()); + timetableRepository + .getServiceCodes() + .put(serviceId, timetableRepository.getServiceCodes().size()); } } - private void addTripPatternsToTransitModel(TransitModel transitModel) { + private void addTripPatternsToTimetableRepository(TimetableRepository timetableRepository) { Collection tripPatterns = otpTransitService.getTripPatterns(); /* Loop over all new TripPatterns setting the service codes. */ for (TripPattern tripPattern : tripPatterns) { // TODO this could be more elegant - tripPattern.getScheduledTimetable().setServiceCodes(transitModel.getServiceCodes()); + tripPattern.getScheduledTimetable().setServiceCodes(timetableRepository.getServiceCodes()); // Store the tripPattern in the Graph so it will be serialized and usable in routing. - transitModel.addTripPattern(tripPattern.getId(), tripPattern); + timetableRepository.addTripPattern(tripPattern.getId(), tripPattern); } } - private void addFlexTripsToGraph(TransitModel transitModel) { + private void addFlexTripsToGraph(TimetableRepository timetableRepository) { for (FlexTrip flexTrip : otpTransitService.getAllFlexTrips()) { - transitModel.addFlexTrip(flexTrip.getId(), flexTrip); + timetableRepository.addFlexTrip(flexTrip.getId(), flexTrip); } } diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java b/application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java index a87f28182ff..a1a0796c66a 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/DirectTransferGenerator.java @@ -18,16 +18,14 @@ import org.opentripplanner.graph_builder.module.nearbystops.StreetNearbyStopFinder; import org.opentripplanner.model.PathTransfer; import org.opentripplanner.routing.api.request.RouteRequest; -import org.opentripplanner.routing.api.request.request.StreetRequest; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.graphfinder.NearbyStop; import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.vertex.TransitStopVertex; -import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,18 +45,18 @@ public class DirectTransferGenerator implements GraphBuilderModule { private final List transferRequests; private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; public DirectTransferGenerator( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, Duration radiusByDuration, List transferRequests ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.radiusByDuration = radiusByDuration; this.transferRequests = transferRequests; @@ -67,7 +65,7 @@ public DirectTransferGenerator( @Override public void buildGraph() { /* Initialize transit model index which is needed by the nearby stop finder. */ - transitModel.index(); + timetableRepository.index(); /* The linker will use streets if they are available, or straight-line distance otherwise. */ NearbyStopFinder nearbyStopFinder = createNearbyStopFinder(); @@ -166,7 +164,7 @@ public void buildGraph() { progress.step(m -> LOG.info(m)); }); - transitModel.addAllTransfersByStops(transfersByStop); + timetableRepository.addAllTransfersByStops(transfersByStop); LOG.info(progress.completeMessage()); LOG.info( @@ -182,7 +180,7 @@ public void buildGraph() { * enabled. */ private NearbyStopFinder createNearbyStopFinder() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); NearbyStopFinder finder; if (!graph.hasStreets) { LOG.info( diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java index 3bb9c3745a8..ba847b96eb9 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java @@ -27,7 +27,7 @@ import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,15 +55,15 @@ public class OsmBoardingLocationsModule implements GraphBuilderModule { private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final VertexFactory vertexFactory; private VertexLinker linker; @Inject - public OsmBoardingLocationsModule(Graph graph, TransitModel transitModel) { + public OsmBoardingLocationsModule(Graph graph, TimetableRepository timetableRepository) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.vertexFactory = new VertexFactory(graph); } @@ -71,7 +71,7 @@ public OsmBoardingLocationsModule(Graph graph, TransitModel transitModel) { public void buildGraph() { LOG.info("Improving boarding locations by checking OSM entities..."); - StreetIndex streetIndex = graph.getStreetIndexSafe(transitModel.getStopModel()); + StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); this.linker = streetIndex.getVertexLinker(); int successes = 0; diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java b/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java index 0b17f956ae8..2b4a38da58a 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java @@ -6,26 +6,26 @@ import org.opentripplanner.graph_builder.model.GraphBuilderModule; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class RouteToCentroidStationIdsValidator implements GraphBuilderModule { private final DataImportIssueStore issueStore; private final Collection transitRouteToStationCentroid; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; public RouteToCentroidStationIdsValidator( DataImportIssueStore issueStore, Collection transitRouteToStationCentroid, - TransitModel transitModel + TimetableRepository timetableRepository ) { this.issueStore = issueStore; this.transitRouteToStationCentroid = transitRouteToStationCentroid; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; } private void validate() { - var stationIds = transitModel + var stationIds = timetableRepository .getStopModel() .listStations() .stream() diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java index a134dd3c75b..59b6a8b48a0 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java @@ -31,7 +31,7 @@ import org.opentripplanner.transit.model.site.GroupStop; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,30 +48,30 @@ public class StreetLinkerModule implements GraphBuilderModule { private static final TraverseModeSet CAR_ONLY = new TraverseModeSet(TraverseMode.CAR); private static final TraverseModeSet WALK_ONLY = new TraverseModeSet(TraverseMode.WALK); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private final Boolean addExtraEdgesToAreas; public StreetLinkerModule( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, boolean addExtraEdgesToAreas ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.addExtraEdgesToAreas = addExtraEdgesToAreas; } @Override public void buildGraph() { - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); graph.getLinker().setAddExtraEdgesToAreas(this.addExtraEdgesToAreas); if (graph.hasStreets) { - linkTransitStops(graph, transitModel); + linkTransitStops(graph, timetableRepository); linkTransitEntrances(graph); linkStationCentroids(graph); linkVehicleParks(graph, issueStore); @@ -81,7 +81,7 @@ public void buildGraph() { graph.calculateConvexHull(); } - public void linkTransitStops(Graph graph, TransitModel transitModel) { + public void linkTransitStops(Graph graph, TimetableRepository timetableRepository) { List vertices = graph.getVerticesOfType(TransitStopVertex.class); var progress = ProgressTracker.track("Linking transit stops to graph", 5000, vertices.size()); LOG.info(progress.startMessage()); @@ -90,7 +90,7 @@ public void linkTransitStops(Graph graph, TransitModel transitModel) { if (OTPFeature.FlexRouting.isOn()) { stopLocationsUsedForFlexTrips = - transitModel + timetableRepository .getAllFlexTrips() .stream() .flatMap(t -> t.getStops().stream()) diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java index 7168066afe3..3bd33f08a52 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/TimeZoneAdjusterModule.java @@ -8,32 +8,32 @@ import java.util.Map; import org.opentripplanner.graph_builder.model.GraphBuilderModule; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Adjust all scheduled times to match the transit model timezone. */ public class TimeZoneAdjusterModule implements GraphBuilderModule { - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; @Inject - public TimeZoneAdjusterModule(TransitModel transitModel) { - this.transitModel = transitModel; + public TimeZoneAdjusterModule(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; } @Override public void buildGraph() { // TODO: We assume that all time zones follow the same DST rules. In reality we need to split up // the services for each DST transition - final Instant serviceStart = transitModel.getTransitServiceStarts().toInstant(); + final Instant serviceStart = timetableRepository.getTransitServiceStarts().toInstant(); var graphOffset = Duration.ofSeconds( - transitModel.getTimeZone().getRules().getOffset(serviceStart).getTotalSeconds() + timetableRepository.getTimeZone().getRules().getOffset(serviceStart).getTotalSeconds() ); Map agencyShift = new HashMap<>(); - transitModel + timetableRepository .getAllTripPatterns() .forEach(pattern -> { var timeShift = agencyShift.computeIfAbsent( @@ -53,8 +53,8 @@ public void buildGraph() { ) .build(); // replace the original pattern with the updated pattern in the transit model - transitModel.addTripPattern(updatedPattern.getId(), updatedPattern); + timetableRepository.addTripPattern(updatedPattern.getId(), updatedPattern); }); - transitModel.index(); + timetableRepository.index(); } } diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java b/application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java index 744260ba784..238ddc5dc67 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/TripPatternNamer.java @@ -12,24 +12,24 @@ import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.timetable.TripTimes; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TripPatternNamer implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(TripPatternNamer.class); - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; @Inject - public TripPatternNamer(TransitModel transitModel) { - this.transitModel = transitModel; + public TripPatternNamer(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; } @Override public void buildGraph() { /* Generate unique human-readable names for all the TableTripPatterns. */ - generateUniqueNames(transitModel.getAllTripPatterns()); + generateUniqueNames(timetableRepository.getAllTripPatterns()); } /** diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java index 21b125b1188..d0d359cea3e 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderFactory.java @@ -33,7 +33,7 @@ import org.opentripplanner.service.worldenvelope.WorldEnvelopeRepository; import org.opentripplanner.standalone.config.BuildConfig; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; @Singleton @Component(modules = { GraphBuilderModules.class }) @@ -77,7 +77,7 @@ interface Builder { Builder graph(Graph graph); @BindsInstance - Builder transitModel(TransitModel transitModel); + Builder timetableRepository(TimetableRepository timetableRepository); @BindsInstance Builder worldEnvelopeRepository(WorldEnvelopeRepository worldEnvelopeRepository); diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java index 85b34b5704b..080d69c571e 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/configure/GraphBuilderModules.java @@ -45,7 +45,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.config.BuildConfig; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Configure all modules which is not simple enough to be injected. @@ -95,7 +95,7 @@ static GtfsModule provideGtfsModule( GraphBuilderDataSources dataSources, BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { List gtfsBundles = new ArrayList<>(); @@ -108,7 +108,7 @@ static GtfsModule provideGtfsModule( } return new GtfsModule( gtfsBundles, - transitModel, + timetableRepository, graph, issueStore, config.getTransitServicePeriod(), @@ -138,13 +138,13 @@ static NetexModule provideNetexModule( GraphBuilderDataSources dataSources, BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { return new NetexConfigure(config) .createNetexModule( dataSources.getNetexConfiguredDatasource(), - transitModel, + timetableRepository, graph, issueStore ); @@ -155,10 +155,10 @@ static NetexModule provideNetexModule( static StreetLinkerModule provideStreetLinkerModule( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { - return new StreetLinkerModule(graph, transitModel, issueStore, config.areaVisibility); + return new StreetLinkerModule(graph, timetableRepository, issueStore, config.areaVisibility); } @Provides @@ -166,14 +166,14 @@ static StreetLinkerModule provideStreetLinkerModule( static PruneIslands providePruneIslands( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { PruneIslands pruneIslands = new PruneIslands( graph, - transitModel, + timetableRepository, issueStore, - new StreetLinkerModule(graph, transitModel, issueStore, config.areaVisibility) + new StreetLinkerModule(graph, timetableRepository, issueStore, config.areaVisibility) ); pruneIslands.setPruningThresholdIslandWithoutStops( config.islandPruning.pruningThresholdIslandWithoutStops @@ -229,12 +229,12 @@ static List provideElevationModules( static DirectTransferGenerator provideDirectTransferGenerator( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { return new DirectTransferGenerator( graph, - transitModel, + timetableRepository, issueStore, config.maxTransferDuration, config.transferRequests @@ -246,12 +246,12 @@ static DirectTransferGenerator provideDirectTransferGenerator( static DirectTransferAnalyzer provideDirectTransferAnalyzer( BuildConfig config, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore ) { return new DirectTransferAnalyzer( graph, - transitModel, + timetableRepository, issueStore, config.maxTransferDuration.toSeconds() * WalkPreferences.DEFAULT.speed() ); @@ -293,13 +293,13 @@ static DataImportIssueSummary providesDataImportIssueSummary(DataImportIssueStor @Singleton @Nullable static StopConsolidationModule providesStopConsolidationModule( - TransitModel transitModel, + TimetableRepository timetableRepository, @Nullable StopConsolidationRepository repo, GraphBuilderDataSources dataSources ) { return dataSources .stopConsolidation() - .map(ds -> StopConsolidationModule.of(transitModel, repo, ds)) + .map(ds -> StopConsolidationModule.of(timetableRepository, repo, ds)) .orElse(null); } @@ -309,12 +309,12 @@ static StopConsolidationModule providesStopConsolidationModule( static RouteToCentroidStationIdsValidator routeToCentroidStationIdValidator( DataImportIssueStore issueStore, BuildConfig config, - TransitModel transitModel + TimetableRepository timetableRepository ) { var ids = config.transitRouteToStationCentroid(); return ids.isEmpty() ? null - : new RouteToCentroidStationIdsValidator(issueStore, ids, transitModel); + : new RouteToCentroidStationIdsValidator(issueStore, ids, timetableRepository); } /* private methods */ diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java index adcfe525414..151470e0c11 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java @@ -9,7 +9,7 @@ import org.opentripplanner.service.worldenvelope.model.WorldEnvelope; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,24 +28,24 @@ public class CalculateWorldEnvelopeModule implements GraphBuilderModule { private static final int LOG_EVERY_N_COORDINATE = 1_000_000; private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final WorldEnvelopeRepository worldEnvelopeRepository; @Inject public CalculateWorldEnvelopeModule( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.worldEnvelopeRepository = worldEnvelopeRepository; } @Override public void buildGraph() { var vertices = graph.getVertices(); - var stops = transitModel.getStopModel().listStopLocations(); + var stops = timetableRepository.getStopModel().listStopLocations(); WorldEnvelope envelope = build(vertices, stops); worldEnvelopeRepository.saveEnvelope(envelope); } diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java index 26349c0d803..6bb2bc83719 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java @@ -32,7 +32,7 @@ import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.request.StreetSearchRequest; import org.opentripplanner.street.search.state.State; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,7 +48,7 @@ public class PruneIslands implements GraphBuilderModule { private static final Logger LOG = LoggerFactory.getLogger(PruneIslands.class); private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; private final StreetLinkerModule streetLinkerModule; private int pruningThresholdWithoutStops; @@ -60,12 +60,12 @@ public class PruneIslands implements GraphBuilderModule { public PruneIslands( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, StreetLinkerModule streetLinkerModule ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.streetLinkerModule = streetLinkerModule; } @@ -81,8 +81,8 @@ public void buildGraph() { adaptivePruningDistance ); - this.vertexLinker = graph.getLinkerSafe(transitModel.getStopModel()); - this.streetIndex = graph.getStreetIndexSafe(transitModel.getStopModel()); + this.vertexLinker = graph.getLinkerSafe(timetableRepository.getStopModel()); + this.streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); pruneIslands(TraverseMode.BICYCLE); pruneIslands(TraverseMode.WALK); @@ -91,7 +91,7 @@ public void buildGraph() { // reconnect stops that got disconnected if (streetLinkerModule != null) { LOG.info("Reconnecting stops"); - streetLinkerModule.linkTransitStops(graph, transitModel); + streetLinkerModule.linkTransitStops(graph, timetableRepository); int isolated = 0; for (TransitStopVertex tStop : graph.getVerticesOfType(TransitStopVertex.class)) { if (tStop.getDegreeOut() + tStop.getDegreeIn() == 0) { 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 2f7feb5993e..59acabee819 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java +++ b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java @@ -35,7 +35,7 @@ import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.model.GraphBuilderModule; -import org.opentripplanner.graph_builder.module.AddTransitModelEntitiesToGraph; +import org.opentripplanner.graph_builder.module.AddTransitEntitiesToGraph; import org.opentripplanner.graph_builder.module.GtfsFeedId; import org.opentripplanner.graph_builder.module.ValidateAndInterpolateStopTimesForEachTrip; import org.opentripplanner.graph_builder.module.geometry.GeometryProcessor; @@ -51,7 +51,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.config.BuildConfig; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,21 +77,21 @@ public class GtfsModule implements GraphBuilderModule { private final List gtfsBundles; private final FareServiceFactory fareServiceFactory; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final Graph graph; private final DataImportIssueStore issueStore; private int nextAgencyId = 1; // used for generating agency IDs to resolve ID conflicts public GtfsModule( List bundles, - TransitModel transitModel, + TimetableRepository timetableRepository, Graph graph, DataImportIssueStore issueStore, ServiceDateInterval transitPeriodLimit, FareServiceFactory fareServiceFactory ) { this.gtfsBundles = bundles; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.graph = graph; this.issueStore = issueStore; this.transitPeriodLimit = transitPeriodLimit; @@ -100,13 +100,13 @@ public GtfsModule( public GtfsModule( List bundles, - TransitModel transitModel, + TimetableRepository timetableRepository, Graph graph, ServiceDateInterval transitPeriodLimit ) { this( bundles, - transitModel, + timetableRepository, graph, DataImportIssueStore.NOOP, transitPeriodLimit, @@ -132,7 +132,7 @@ public void buildGraph() { feedIdsEncountered.put(feedId, gtfsBundle); GTFSToOtpTransitServiceMapper mapper = new GTFSToOtpTransitServiceMapper( - new OtpTransitServiceBuilder(transitModel.getStopModel(), issueStore), + new OtpTransitServiceBuilder(timetableRepository.getStopModel(), issueStore), feedId, issueStore, gtfsBundle.discardMinTransferTimes(), @@ -170,7 +170,7 @@ public void buildGraph() { // NB! The calls below have side effects - the builder state is updated! createTripPatterns( graph, - transitModel, + timetableRepository, builder, calendarServiceData.getServiceIds(), geometryProcessor, @@ -182,11 +182,11 @@ public void buildGraph() { // if this or previously processed gtfs bundle has transit that has not been filtered out hasTransit = hasTransit || otpTransitService.hasActiveTransit(); - addTransitModelToGraph(graph, transitModel, gtfsBundle, otpTransitService); + addTimetableRepositoryToGraph(graph, timetableRepository, gtfsBundle, otpTransitService); if (gtfsBundle.blockBasedInterlining()) { new InterlineProcessor( - transitModel.getTransferService(), + timetableRepository.getTransferService(), builder.getStaySeatedNotAllowed(), gtfsBundle.maxInterlineDistance(), issueStore, @@ -206,9 +206,9 @@ public void buildGraph() { gtfsBundles.forEach(GtfsBundle::close); } - transitModel.validateTimeZones(); + timetableRepository.validateTimeZones(); - transitModel.updateCalendarServiceData(hasTransit, calendarServiceData, issueStore); + timetableRepository.updateCalendarServiceData(hasTransit, calendarServiceData, issueStore); } /** @@ -268,7 +268,7 @@ private void validateAndInterpolateStopTimesForEachTrip( */ private void createTripPatterns( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, OtpTransitServiceBuilder builder, Set calServiceIds, GeometryProcessor geometryProcessor, @@ -282,25 +282,25 @@ private void createTripPatterns( geometryProcessor ); buildTPOp.run(); - transitModel.setHasFrequencyService( - transitModel.hasFrequencyService() || buildTPOp.hasFrequencyBasedTrips() + timetableRepository.setHasFrequencyService( + timetableRepository.hasFrequencyService() || buildTPOp.hasFrequencyBasedTrips() ); - transitModel.setHasScheduledService( - transitModel.hasScheduledService() || buildTPOp.hasScheduledTrips() + timetableRepository.setHasScheduledService( + timetableRepository.hasScheduledService() || buildTPOp.hasScheduledTrips() ); } - private void addTransitModelToGraph( + private void addTimetableRepositoryToGraph( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, GtfsBundle gtfsBundle, OtpTransitService otpTransitService ) { - AddTransitModelEntitiesToGraph.addToGraph( + AddTransitEntitiesToGraph.addToGraph( otpTransitService, gtfsBundle.subwayAccessTime, graph, - transitModel + timetableRepository ); } diff --git a/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java index 6b1190a66b3..20f1312bccd 100644 --- a/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java +++ b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java @@ -130,7 +130,7 @@ public class TimetableSnapshot { /** * The realTimeAdded* maps are indexes on the trips created at runtime (extra-journey), and the * Route, TripPattern, TripOnServiceDate they refer to. - * They are meant to override the corresponding indexes in TransitModelIndex. + * They are meant to override the corresponding indexes in TimetableRepositoryIndex. */ private final Map realtimeAddedRoutes; private final Map realTimeAddedTrips; diff --git a/application/src/main/java/org/opentripplanner/netex/NetexBundle.java b/application/src/main/java/org/opentripplanner/netex/NetexBundle.java index a0e0aae8500..b061c9e9352 100644 --- a/application/src/main/java/org/opentripplanner/netex/NetexBundle.java +++ b/application/src/main/java/org/opentripplanner/netex/NetexBundle.java @@ -125,19 +125,19 @@ public void close() throws IOException { /** Load all files entries in the bundle */ private void loadFileEntries() { // Load global shared files - loadFilesThenMapToOtpTransitModel("shared file", hierarchy.sharedEntries()); + loadFilesThenMapToTimetableRepository("shared file", hierarchy.sharedEntries()); for (GroupEntries group : hierarchy.groups()) { LOG.info("reading group {}", group.name()); scopeInputData(() -> { // Load shared group files - loadFilesThenMapToOtpTransitModel("shared group file", group.sharedEntries()); + loadFilesThenMapToTimetableRepository("shared group file", group.sharedEntries()); for (DataSource entry : group.independentEntries()) { scopeInputData(() -> { // Load each independent file in group - loadFilesThenMapToOtpTransitModel("group file", List.of(entry)); + loadFilesThenMapToTimetableRepository("group file", List.of(entry)); }); } }); @@ -164,7 +164,7 @@ private void scopeInputData(Runnable task) { * when read, would lead to missing references, since the order entries are read is not enforced * in any way. */ - private void loadFilesThenMapToOtpTransitModel( + private void loadFilesThenMapToTimetableRepository( String fileDescription, Iterable entries ) { diff --git a/application/src/main/java/org/opentripplanner/netex/NetexModule.java b/application/src/main/java/org/opentripplanner/netex/NetexModule.java index 92ee25dbab2..4c45131389f 100644 --- a/application/src/main/java/org/opentripplanner/netex/NetexModule.java +++ b/application/src/main/java/org/opentripplanner/netex/NetexModule.java @@ -5,7 +5,7 @@ import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.model.GraphBuilderModule; -import org.opentripplanner.graph_builder.module.AddTransitModelEntitiesToGraph; +import org.opentripplanner.graph_builder.module.AddTransitEntitiesToGraph; import org.opentripplanner.graph_builder.module.ValidateAndInterpolateStopTimesForEachTrip; import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.TripStopTimes; @@ -15,7 +15,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.vehicle_parking.VehicleParkingHelper; import org.opentripplanner.standalone.config.BuildConfig; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This module is used for importing the NeTEx CEN Technical Standard for exchanging Public @@ -28,7 +28,7 @@ public class NetexModule implements GraphBuilderModule { private final int subwayAccessTime; private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final DataImportIssueStore issueStore; /** @@ -41,14 +41,14 @@ public class NetexModule implements GraphBuilderModule { public NetexModule( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, DataImportIssueStore issueStore, int subwayAccessTime, ServiceDateInterval transitPeriodLimit, List netexBundles ) { this.graph = graph; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.issueStore = issueStore; this.subwayAccessTime = subwayAccessTime; this.transitPeriodLimit = transitPeriodLimit; @@ -70,7 +70,7 @@ public void buildGraph() { ); transitBuilder.limitServiceDays(transitPeriodLimit); for (var tripOnServiceDate : transitBuilder.getTripOnServiceDates().values()) { - transitModel.addTripOnServiceDate(tripOnServiceDate); + timetableRepository.addTripOnServiceDate(tripOnServiceDate); } calendarServiceData.add(transitBuilder.buildCalendarServiceData()); @@ -87,20 +87,20 @@ public void buildGraph() { // if this or previously processed netex bundle has transit that has not been filtered out hasActiveTransit = hasActiveTransit || otpService.hasActiveTransit(); - // TODO OTP2 - Move this into the AddTransitModelEntitiesToGraph + // TODO OTP2 - Move this into the AddTransitEntitiesToGraph // - and make sure they also work with GTFS feeds - GTFS do no // - have operators and notice assignments. - transitModel.addOperators(otpService.getAllOperators()); - transitModel.addNoticeAssignments(otpService.getNoticeAssignments()); + timetableRepository.addOperators(otpService.getAllOperators()); + timetableRepository.addNoticeAssignments(otpService.getNoticeAssignments()); - AddTransitModelEntitiesToGraph.addToGraph( + AddTransitEntitiesToGraph.addToGraph( otpService, subwayAccessTime, graph, - transitModel + timetableRepository ); - transitModel.validateTimeZones(); + timetableRepository.validateTimeZones(); var lots = transitBuilder.vehicleParkings(); graph.getVehicleParkingService().updateVehicleParking(lots, List.of()); @@ -108,7 +108,11 @@ public void buildGraph() { lots.forEach(linker::linkVehicleParkingToGraph); } - transitModel.updateCalendarServiceData(hasActiveTransit, calendarServiceData, issueStore); + timetableRepository.updateCalendarServiceData( + hasActiveTransit, + calendarServiceData, + issueStore + ); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java b/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java index 5f4b665e362..5d824f833db 100644 --- a/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java +++ b/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java @@ -12,7 +12,7 @@ import org.opentripplanner.netex.loader.NetexDataSourceHierarchy; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.config.BuildConfig; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Responsible for dependency injection and creating main NeTEx module objects. This decouple the @@ -35,7 +35,7 @@ public NetexConfigure(BuildConfig builderParams) { public NetexModule createNetexModule( Iterable> netexSources, - TransitModel transitModel, + TimetableRepository timetableRepository, Graph graph, DataImportIssueStore issueStore ) { @@ -43,7 +43,7 @@ public NetexModule createNetexModule( for (ConfiguredDataSource it : netexSources) { var transitServiceBuilder = new OtpTransitServiceBuilder( - transitModel.getStopModel(), + timetableRepository.getStopModel(), issueStore ); netexBundles.add(netexBundle(transitServiceBuilder, it)); @@ -51,7 +51,7 @@ public NetexModule createNetexModule( return new NetexModule( graph, - transitModel, + timetableRepository, issueStore, buildParams.getSubwayAccessTimeSeconds(), buildParams.getTransitServicePeriod(), diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java index 30b87d248a0..02b5de80bb3 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/TripMapper.java @@ -137,7 +137,7 @@ Trip mapServiceJourney(ServiceJourney serviceJourney, Supplier headsign) ); // TODO RTM - Instead of getting the first headsign from the StopTime this could be the - // - default behaviour of the TransitModel - So, in the NeTEx mapper we would just + // - default behaviour of the TimetableRepository - So, in the NeTEx mapper we would just // - ignore setting the headsign on the Trip. builder.withHeadsign(new NonLocalizedString(headsign.get())); diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java index e5f0544f584..9e07c57ede7 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java @@ -17,15 +17,15 @@ import org.opentripplanner.transit.service.StopModel; /** - * This is a replica of public transportation data already present in TransitModel, but rearranged + * This is a replica of public transportation data already present in TimetableRepository, but rearranged * and indexed differently for efficient use by the Raptor router. Patterns and trips are split out * by days, retaining only the services actually running on any particular day. * * TODO RT_AB: this name may reflect usage in R5, where the TransportNetwork encompasses two * sub-aggregates (one for the streets and one for the public transit data). Here, the TransitLayer - * seems to just be an indexed and rearranged copy of the main TransitModel instance. TG has + * seems to just be an indexed and rearranged copy of the main TimetableRepository instance. TG has * indicated that "layer" should be restricted in its standard OO meaning, and this class should - * really be merged into TransitModel. + * really be merged into TimetableRepository. */ public class TransitLayer { diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java index 13f8facef3d..a9da73200cc 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java @@ -25,13 +25,13 @@ import org.opentripplanner.transit.model.site.StopTransferPriority; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Maps the TransitLayer object from the TransitModel object. The ServiceDay hierarchy is reversed, + * Maps the TransitLayer object from the TimetableRepository object. The ServiceDay hierarchy is reversed, * with service days at the top level, which contains TripPatternForDate objects that contain only * TripSchedules running on that particular date. This makes it faster to filter out TripSchedules * when doing Range Raptor searches. @@ -48,16 +48,16 @@ public class TransitLayerMapper { private final TransitService transitService; private final StopModel stopModel; - private TransitLayerMapper(TransitModel transitModel) { - this.transitService = new DefaultTransitService(transitModel); - this.stopModel = transitModel.getStopModel(); + private TransitLayerMapper(TimetableRepository timetableRepository) { + this.transitService = new DefaultTransitService(timetableRepository); + this.stopModel = timetableRepository.getStopModel(); } public static TransitLayer map( TransitTuningParameters tuningParameters, - TransitModel transitModel + TimetableRepository timetableRepository ) { - return new TransitLayerMapper(transitModel).map(tuningParameters); + return new TransitLayerMapper(timetableRepository).map(tuningParameters); } private TransitLayer map(TransitTuningParameters tuningParameters) { @@ -65,7 +65,7 @@ private TransitLayer map(TransitTuningParameters tuningParameters) { List> transferByStopIndex; ConstrainedTransfersForPatterns constrainedTransfers = null; - LOG.info("Mapping transitLayer from TransitModel..."); + LOG.info("Mapping transitLayer from TimetableRepository..."); Collection allTripPatterns = transitService.getAllTripPatterns(); diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java index 934bec39c11..c814a48f114 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerUpdater.java @@ -30,7 +30,7 @@ * the updated copy in an atomic operation. This ensures that any TransitLayer that is referenced * from the Graph is never changed. * - * This is a way of keeping the TransitLayer up to date (in sync with the TransitModel plus its most + * This is a way of keeping the TransitLayer up to date (in sync with the TimetableRepository plus its most * recent TimetableSnapshot) without repeatedly deriving it from scratch every few seconds. The same * incremental changes are applied to both the TimetableSnapshot and the TransitLayer and they are * published together. 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 1fbea77e759..bb1944d0c4b 100644 --- a/application/src/main/java/org/opentripplanner/routing/graph/Graph.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/Graph.java @@ -43,10 +43,10 @@ * In OTP1, the Graph contained vertices and edges representing the entire transportation network, * including edges representing both street segments and public transit lines connecting stops. In * OTP2, the Graph edges now represent only the street network. Transit routing is performed on - * other data structures suited to the Raptor algorithm (the TransitModel). Some transit-related + * other data structures suited to the Raptor algorithm (the TimetableRepository). Some transit-related * vertices are still present in the Graph, specifically those representing transit stops, * entrances, and elevators. Their presence in the street graph creates a connection between the two - * routable data structures (identifying where stops in the TransitModel are located relative to + * routable data structures (identifying where stops in the TimetableRepository are located relative to * roads). *

* Other data structures related to street routing, such as elevation data and vehicle parking 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 b2404adc5d1..327428cfccb 100644 --- a/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java @@ -35,7 +35,7 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.network.RoutingTripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +55,7 @@ public class SerializedGraphObject implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(SerializedGraphObject.class); public final Graph graph; - public final TransitModel transitModel; + public final TimetableRepository timetableRepository; public final WorldEnvelopeRepository worldEnvelopeRepository; private final Collection edges; @@ -82,7 +82,7 @@ public class SerializedGraphObject implements Serializable { public SerializedGraphObject( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, BuildConfig buildConfig, RouterConfig routerConfig, @@ -93,7 +93,7 @@ public SerializedGraphObject( ) { this.graph = graph; this.edges = graph.getEdges(); - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.worldEnvelopeRepository = worldEnvelopeRepository; this.buildConfig = buildConfig; this.routerConfig = routerConfig; @@ -184,9 +184,9 @@ private static SerializedGraphObject load(InputStream inputStream, String source ); LOG.debug("Graph read."); serObj.reconstructEdgeLists(); - serObj.transitModel.getStopModel().reindexAfterDeserialization(); - serObj.transitModel.index(); - logSerializationCompleteStatus(serObj.graph, serObj.transitModel); + serObj.timetableRepository.getStopModel().reindexAfterDeserialization(); + serObj.timetableRepository.index(); + logSerializationCompleteStatus(serObj.graph, serObj.timetableRepository); return serObj; } catch (IOException e) { LOG.error("IO exception while loading graph: {}", e.getLocalizedMessage(), e); @@ -256,11 +256,14 @@ private void save(OutputStream outputStream, String graphName, long size) { // ((InstanceCountingClassResolver) kryo.getClassResolver()).summarize(); } - private static void logSerializationCompleteStatus(Graph graph, TransitModel transitModel) { + private static void logSerializationCompleteStatus( + Graph graph, + TimetableRepository timetableRepository + ) { var f = new OtpNumberFormat(); - var nStops = f.formatNumber(transitModel.getStopModel().stopIndexSize()); - var nTransfers = f.formatNumber(transitModel.getTransferService().listAll().size()); - var nPatterns = f.formatNumber(transitModel.getAllTripPatterns().size()); + var nStops = f.formatNumber(timetableRepository.getStopModel().stopIndexSize()); + var nTransfers = f.formatNumber(timetableRepository.getTransferService().listAll().size()); + var nPatterns = f.formatNumber(timetableRepository.getAllTripPatterns().size()); var nVertices = f.formatNumber(graph.countVertices()); var nEdges = f.formatNumber(graph.countEdges()); diff --git a/application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java b/application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java index 8da6fc21aa7..e63894b1a2c 100644 --- a/application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java +++ b/application/src/main/java/org/opentripplanner/routing/impl/DelegatingTransitAlertServiceImpl.java @@ -11,7 +11,7 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Direction; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.alert.TransitAlertProvider; /** @@ -30,14 +30,14 @@ public class DelegatingTransitAlertServiceImpl implements TransitAlertService { private final ArrayList transitAlertServices = new ArrayList<>(); /** - * Constructor which scans over all existing GraphUpdaters associated with a TransitModel + * Constructor which scans over all existing GraphUpdaters associated with a TimetableRepository * instance and retains references to all their TransitAlertService instances. * This implies that these instances are expected to remain in use indefinitely (not be replaced * with new instances or taken out of service over time). */ - public DelegatingTransitAlertServiceImpl(TransitModel transitModel) { - if (transitModel.getUpdaterManager() != null) { - transitModel + public DelegatingTransitAlertServiceImpl(TimetableRepository timetableRepository) { + if (timetableRepository.getUpdaterManager() != null) { + timetableRepository .getUpdaterManager() .getUpdaterList() .stream() diff --git a/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java b/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java index 0cc24c691e9..2662eb7d3e5 100644 --- a/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java +++ b/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java @@ -13,7 +13,7 @@ import org.opentripplanner.routing.services.TransitAlertService; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Direction; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This is the primary implementation of TransitAlertService, which actually retains its own set @@ -32,12 +32,12 @@ */ public class TransitAlertServiceImpl implements TransitAlertService { - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private Multimap alerts = HashMultimap.create(); - public TransitAlertServiceImpl(TransitModel transitModel) { - this.transitModel = transitModel; + public TransitAlertServiceImpl(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; } @Override @@ -85,8 +85,8 @@ public Collection getStopAlerts( } if (result.isEmpty()) { // Search for alerts on parent-stop - if (transitModel != null) { - var quay = transitModel.getStopModel().getRegularStop(stopId); + if (timetableRepository != null) { + var quay = timetableRepository.getStopModel().getRegularStop(stopId); if (quay != null) { // TODO - SIRI: Add alerts from parent- and multimodal-stops /* diff --git a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java index d865f8fa28c..915b7091ba6 100644 --- a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java +++ b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java @@ -17,7 +17,7 @@ import org.opentripplanner.standalone.configure.ConstructApplication; import org.opentripplanner.standalone.configure.LoadApplication; import org.opentripplanner.standalone.server.GrizzlyServer; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.configure.UpdaterConfigurator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -150,7 +150,7 @@ private static void startOTPServer(CommandLineParameters cli) { // with using the embedded router config. new SerializedGraphObject( app.graph(), - app.transitModel(), + app.timetableRepository(), app.worldEnvelopeRepository(), config.buildConfig(), config.routerConfig(), @@ -187,8 +187,8 @@ private static void detectUnusedConfigParams(CommandLineParameters cli, ConfigMo private static void startOtpWebServer(CommandLineParameters params, ConstructApplication app) { // Index graph for travel search - app.transitModel().index(); - app.graph().index(app.transitModel().getStopModel()); + app.timetableRepository().index(); + app.graph().index(app.timetableRepository().getStopModel()); // publishing the config version info make it available to the APIs setOtpConfigVersionsOnServerInfo(app); @@ -205,7 +205,7 @@ private static void startOtpWebServer(CommandLineParameters params, ConstructApp if (params.doServe()) { GrizzlyServer grizzlyServer = app.createGrizzlyServer(); - registerShutdownHookToGracefullyShutDownServer(app.transitModel(), app.raptorConfig()); + registerShutdownHookToGracefullyShutDownServer(app.timetableRepository(), app.raptorConfig()); // Loop to restart server on uncaught fatal exceptions. while (true) { @@ -232,14 +232,14 @@ private static void startOtpWebServer(CommandLineParameters params, ConstructApp * */ private static void registerShutdownHookToGracefullyShutDownServer( - TransitModel transitModel, + TimetableRepository timetableRepository, RaptorConfig raptorConfig ) { ApplicationShutdownSupport.addShutdownHook( "server-shutdown", () -> { LOG.info("OTP shutdown started..."); - UpdaterConfigurator.shutdownGraph(transitModel); + UpdaterConfigurator.shutdownGraph(timetableRepository); raptorConfig.shutdown(); WeakCollectionCleaner.DEFAULT.exit(); DeferredAuthorityFactory.exit(); 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 52f7970ccd7..560f234187a 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplication.java @@ -33,7 +33,7 @@ import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.street.model.elevation.ElevationUtils; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.configure.UpdaterConfigurator; import org.opentripplanner.visualizer.GraphVisualizer; import org.slf4j.Logger; @@ -69,7 +69,7 @@ public class ConstructApplication { ConstructApplication( CommandLineParameters cli, Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, ConfigModel config, GraphBuilderDataSources graphBuilderDataSources, @@ -90,7 +90,7 @@ public class ConstructApplication { .builder() .configModel(config) .graph(graph) - .transitModel(transitModel) + .timetableRepository(timetableRepository) .graphVisualizer(graphVisualizer) .worldEnvelopeRepository(worldEnvelopeRepository) .emissionsDataModel(emissionsDataModel) @@ -125,7 +125,7 @@ public GraphBuilder createGraphBuilder() { buildConfig(), graphBuilderDataSources, graph(), - transitModel(), + timetableRepository(), factory.worldEnvelopeRepository(), factory.emissionsDataModel(), factory.stopConsolidationRepository(), @@ -156,25 +156,25 @@ private void setupTransitRoutingServer() { enableRequestTraceLogging(); createMetricsLogging(); - creatTransitLayerForRaptor(transitModel(), routerConfig().transitTuningConfig()); + creatTransitLayerForRaptor(timetableRepository(), routerConfig().transitTuningConfig()); /* Create updater modules from JSON config. */ UpdaterConfigurator.configure( graph(), realtimeVehicleRepository(), vehicleRentalRepository(), - transitModel(), + timetableRepository(), routerConfig().updaterConfig() ); initEllipsoidToGeoidDifference(); - initializeTransferCache(routerConfig().transitTuningConfig(), transitModel()); + initializeTransferCache(routerConfig().transitTuningConfig(), timetableRepository()); if (OTPFeature.TransmodelGraphQlApi.isOn()) { TransmodelAPI.setUp( routerConfig().transmodelApi(), - transitModel(), + timetableRepository(), routerConfig().routingRequestDefaults() ); } @@ -200,25 +200,29 @@ private void initEllipsoidToGeoidDifference() { * Create transit layer for Raptor routing. Here we map the scheduled timetables. */ public static void creatTransitLayerForRaptor( - TransitModel transitModel, + TimetableRepository timetableRepository, TransitTuningParameters tuningParameters ) { - if (!transitModel.hasTransit() || !transitModel.isIndexed()) { + if (!timetableRepository.hasTransit() || !timetableRepository.isIndexed()) { LOG.warn( "Cannot create Raptor data, that requires the graph to have transit data and be indexed." ); } LOG.info("Creating transit layer for Raptor routing."); - transitModel.setTransitLayer(TransitLayerMapper.map(tuningParameters, transitModel)); - transitModel.setRealtimeTransitLayer(new TransitLayer(transitModel.getTransitLayer())); - transitModel.setTransitLayerUpdater( - new TransitLayerUpdater(new DefaultTransitService(transitModel)) + timetableRepository.setTransitLayer( + TransitLayerMapper.map(tuningParameters, timetableRepository) + ); + timetableRepository.setRealtimeTransitLayer( + new TransitLayer(timetableRepository.getTransitLayer()) + ); + timetableRepository.setTransitLayerUpdater( + new TransitLayerUpdater(new DefaultTransitService(timetableRepository)) ); } public static void initializeTransferCache( TransitTuningParameters transitTuningConfig, - TransitModel transitModel + TimetableRepository timetableRepository ) { var transferCacheRequests = transitTuningConfig.transferCacheRequests(); if (!transferCacheRequests.isEmpty()) { @@ -231,7 +235,7 @@ public static void initializeTransferCache( LOG.info(progress.startMessage()); transferCacheRequests.forEach(request -> { - transitModel.getTransitLayer().initTransferCacheForRequest(request); + timetableRepository.getTransitLayer().initTransferCacheForRequest(request); //noinspection Convert2MethodRef progress.step(s -> LOG.info(s)); @@ -241,8 +245,8 @@ public static void initializeTransferCache( } } - public TransitModel transitModel() { - return factory.transitModel(); + public TimetableRepository timetableRepository() { + return factory.timetableRepository(); } public DataImportIssueSummary dataImportIssueSummary() { 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 b307776ef52..e828406a35e 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/ConstructApplicationFactory.java @@ -34,7 +34,7 @@ import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.street.service.StreetLimitationParametersServiceModule; import org.opentripplanner.transit.configure.TransitModule; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.visualizer.GraphVisualizer; @@ -65,7 +65,7 @@ public interface ConstructApplicationFactory { ConfigModel config(); RaptorConfig raptorConfig(); Graph graph(); - TransitModel transitModel(); + TimetableRepository timetableRepository(); WorldEnvelopeRepository worldEnvelopeRepository(); WorldEnvelopeService worldEnvelopeService(); RealtimeVehicleRepository realtimeVehicleRepository(); @@ -102,7 +102,7 @@ interface Builder { Builder graph(Graph graph); @BindsInstance - Builder transitModel(TransitModel transitModel); + Builder timetableRepository(TimetableRepository timetableRepository); @BindsInstance Builder graphVisualizer(@Nullable GraphVisualizer graphVisualizer); 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 19415e489b4..300eb24f997 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplication.java @@ -12,7 +12,7 @@ import org.opentripplanner.standalone.config.CommandLineParameters; import org.opentripplanner.standalone.config.ConfigModel; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This class is responsible for loading configuration and setting up the OTP data store. @@ -54,7 +54,7 @@ public DataSource getInputGraphDataStore() { public ConstructApplication appConstruction(SerializedGraphObject obj) { return createAppConstruction( obj.graph, - obj.transitModel, + obj.timetableRepository, obj.worldEnvelopeRepository, obj.issueSummary, obj.emissionsDataModel, @@ -67,7 +67,7 @@ public ConstructApplication appConstruction(SerializedGraphObject obj) { public ConstructApplication appConstruction() { return createAppConstruction( factory.emptyGraph(), - factory.emptyTransitModel(), + factory.emptyTimetableRepository(), factory.emptyWorldEnvelopeRepository(), DataImportIssueSummary.empty(), factory.emptyEmissionsDataModel(), @@ -89,7 +89,7 @@ public ConfigModel config() { private ConstructApplication createAppConstruction( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, DataImportIssueSummary issueSummary, @Nullable EmissionsDataModel emissionsDataModel, @@ -99,7 +99,7 @@ private ConstructApplication createAppConstruction( return new ConstructApplication( cli, graph, - transitModel, + timetableRepository, worldEnvelopeRepository, config(), graphBuilderDataSources(), diff --git a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java index aacb42c4336..8d11d645c48 100644 --- a/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java +++ b/application/src/main/java/org/opentripplanner/standalone/configure/LoadApplicationFactory.java @@ -17,7 +17,7 @@ import org.opentripplanner.standalone.config.ConfigModel; import org.opentripplanner.standalone.config.configure.LoadConfigModule; import org.opentripplanner.street.model.StreetLimitationParameters; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Dagger dependency injection Factory to create components for the OTP load application phase. @@ -41,7 +41,7 @@ public interface LoadApplicationFactory { Graph emptyGraph(); @Singleton - TransitModel emptyTransitModel(); + TimetableRepository emptyTimetableRepository(); @Singleton WorldEnvelopeRepository emptyWorldEnvelopeRepository(); diff --git a/application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java b/application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java index 3ed5685015b..c9161c7588a 100644 --- a/application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java +++ b/application/src/main/java/org/opentripplanner/standalone/server/MetricsLogging.java @@ -22,7 +22,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.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * This class is responsible for wiring up various metrics to micrometer, which we use for @@ -32,7 +32,7 @@ public class MetricsLogging { @Inject public MetricsLogging( - TransitModel transitModel, + TimetableRepository timetableRepository, RaptorConfig raptorConfig, DataImportIssueSummary issueSummary ) { @@ -48,9 +48,9 @@ public MetricsLogging( new ProcessorMetrics().bindTo(Metrics.globalRegistry); new UptimeMetrics().bindTo(Metrics.globalRegistry); - if (transitModel.getTransitLayer() != null) { + if (timetableRepository.getTransitLayer() != null) { new GuavaCacheMetrics( - transitModel.getTransitLayer().getTransferCache().getTransferCache(), + timetableRepository.getTransitLayer().getTransferCache().getTransferCache(), "raptorTransfersCache", List.of(Tag.of("cache", "raptorTransfers")) ) @@ -63,23 +63,23 @@ public MetricsLogging( ) .bindTo(Metrics.globalRegistry); - if (transitModel.getUpdaterManager() != null) { + if (timetableRepository.getUpdaterManager() != null) { new ExecutorServiceMetrics( - transitModel.getUpdaterManager().getPollingUpdaterPool(), + timetableRepository.getUpdaterManager().getPollingUpdaterPool(), "pollingGraphUpdaters", List.of(Tag.of("pool", "pollingGraphUpdaters")) ) .bindTo(Metrics.globalRegistry); new ExecutorServiceMetrics( - transitModel.getUpdaterManager().getNonPollingUpdaterPool(), + timetableRepository.getUpdaterManager().getNonPollingUpdaterPool(), "nonPollingGraphUpdaters", List.of(Tag.of("pool", "nonPollingGraphUpdaters")) ) .bindTo(Metrics.globalRegistry); new ExecutorServiceMetrics( - transitModel.getUpdaterManager().getScheduler(), + timetableRepository.getUpdaterManager().getScheduler(), "graphUpdateScheduler", List.of(Tag.of("pool", "graphUpdateScheduler")) ) diff --git a/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java index ce2d3aa0ad2..62d8a727615 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java @@ -68,9 +68,9 @@ */ public class DefaultTransitService implements TransitEditorService { - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; - private final TransitModelIndex transitModelIndex; + private final TimetableRepositoryIndex timetableRepositoryIndex; /** * This should only be accessed through the getTimetableSnapshot method. @@ -78,113 +78,113 @@ public class DefaultTransitService implements TransitEditorService { private TimetableSnapshot timetableSnapshot; @Inject - public DefaultTransitService(TransitModel transitModel) { - this.transitModel = transitModel; - this.transitModelIndex = transitModel.getTransitModelIndex(); + public DefaultTransitService(TimetableRepository timetableRepository) { + this.timetableRepository = timetableRepository; + this.timetableRepositoryIndex = timetableRepository.getTimetableRepositoryIndex(); } public DefaultTransitService( - TransitModel transitModel, + TimetableRepository timetableRepository, TimetableSnapshot timetableSnapshotBuffer ) { - this(transitModel); + this(timetableRepository); this.timetableSnapshot = timetableSnapshotBuffer; } @Override public Collection getFeedIds() { - return this.transitModel.getFeedIds(); + return this.timetableRepository.getFeedIds(); } @Override public Collection getAgencies() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getAgencies(); + return this.timetableRepository.getAgencies(); } @Override public Optional findAgencyById(FeedScopedId id) { - return this.transitModel.findAgencyById(id); + return this.timetableRepository.findAgencyById(id); } @Override public FeedInfo getFeedInfo(String feedId) { - return this.transitModel.getFeedInfo(feedId); + return this.timetableRepository.getFeedInfo(feedId); } @Override public void addAgency(Agency agency) { - this.transitModel.addAgency(agency); + this.timetableRepository.addAgency(agency); } @Override public void addFeedInfo(FeedInfo info) { - this.transitModel.addFeedInfo(info); + this.timetableRepository.addFeedInfo(info); } @Override public Collection getNoticesByEntity(AbstractTransitEntity entity) { - return this.transitModel.getNoticesByElement().get(entity); + return this.timetableRepository.getNoticesByElement().get(entity); } @Override public TripPattern getTripPatternForId(FeedScopedId id) { - return this.transitModel.getTripPatternForId(id); + return this.timetableRepository.getTripPatternForId(id); } @Override public Collection getAllTripPatterns() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getAllTripPatterns(); + return this.timetableRepository.getAllTripPatterns(); } @Override public Collection getNotices() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getNoticesByElement().values(); + return this.timetableRepository.getNoticesByElement().values(); } @Override public Station getStationById(FeedScopedId id) { - return this.transitModel.getStopModel().getStationById(id); + return this.timetableRepository.getStopModel().getStationById(id); } @Override public MultiModalStation getMultiModalStation(FeedScopedId id) { - return this.transitModel.getStopModel().getMultiModalStation(id); + return this.timetableRepository.getStopModel().getMultiModalStation(id); } @Override public Collection getStations() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getStopModel().listStations(); + return this.timetableRepository.getStopModel().listStations(); } @Override public Integer getServiceCodeForId(FeedScopedId id) { - return this.transitModel.getServiceCodes().get(id); + return this.timetableRepository.getServiceCodes().get(id); } @Override public TIntSet getServiceCodesRunningForDate(LocalDate serviceDate) { - return transitModelIndex + return timetableRepositoryIndex .getServiceCodesRunningForDate() .getOrDefault(serviceDate, new TIntHashSet()); } @Override public AreaStop getAreaStop(FeedScopedId id) { - return this.transitModel.getStopModel().getAreaStop(id); + return this.timetableRepository.getStopModel().getAreaStop(id); } @Override public Agency getAgencyForId(FeedScopedId id) { - return this.transitModelIndex.getAgencyForId(id); + return this.timetableRepositoryIndex.getAgencyForId(id); } @Override public RegularStop getRegularStop(FeedScopedId id) { - return this.transitModel.getStopModel().getRegularStop(id); + return this.timetableRepository.getStopModel().getRegularStop(id); } @Override @@ -196,7 +196,7 @@ public Route getRouteForId(FeedScopedId id) { return realtimeAddedRoute; } } - return transitModelIndex.getRouteForId(id); + return timetableRepositoryIndex.getRouteForId(id); } /** @@ -205,75 +205,75 @@ public Route getRouteForId(FeedScopedId id) { */ @Override public void addRoutes(Route route) { - this.transitModelIndex.addRoutes(route); + this.timetableRepositoryIndex.addRoutes(route); } @Override public Set getRoutesForStop(StopLocation stop) { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getRoutesForStop(stop); + return this.timetableRepositoryIndex.getRoutesForStop(stop); } @Override public Collection getPatternsForStop(StopLocation stop) { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getPatternsForStop(stop); + return this.timetableRepositoryIndex.getPatternsForStop(stop); } @Override public Collection getTripsForStop(StopLocation stop) { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModelIndex.getTripsForStop(stop); + return this.timetableRepositoryIndex.getTripsForStop(stop); } @Override public Collection getAllOperators() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getOperators(); + return this.timetableRepository.getOperators(); } @Override public Operator getOperatorForId(FeedScopedId id) { - return this.transitModelIndex.getOperatorForId(id); + return this.timetableRepositoryIndex.getOperatorForId(id); } @Override public Collection listStopLocations() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listStopLocations(); + return timetableRepository.getStopModel().listStopLocations(); } @Override public Collection listRegularStops() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listRegularStops(); + return timetableRepository.getStopModel().listRegularStops(); } @Override public Collection listGroupStops() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listGroupStops(); + return timetableRepository.getStopModel().listGroupStops(); } @Override public StopLocation getStopLocation(FeedScopedId id) { - return transitModel.getStopModel().getStopLocation(id); + return timetableRepository.getStopModel().getStopLocation(id); } @Override public Collection getStopOrChildStops(FeedScopedId id) { - return transitModel.getStopModel().findStopOrChildStops(id); + return timetableRepository.getStopModel().findStopOrChildStops(id); } @Override public Collection listStopLocationGroups() { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().listStopLocationGroups(); + return timetableRepository.getStopModel().listStopLocationGroups(); } @Override public StopLocationsGroup getStopLocationsGroup(FeedScopedId id) { - return transitModel.getStopModel().getStopLocationsGroup(id); + return timetableRepository.getStopModel().getStopLocationsGroup(id); } @Override @@ -291,7 +291,7 @@ public Trip getTripForId(FeedScopedId id) { @Nullable @Override public Trip getScheduledTripForId(FeedScopedId id) { - return this.transitModelIndex.getTripForId(id); + return this.timetableRepositoryIndex.getTripForId(id); } @Override @@ -300,11 +300,11 @@ public Collection getAllTrips() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModelIndex.getAllTrips(), + timetableRepositoryIndex.getAllTrips(), currentSnapshot.listRealTimeAddedTrips() ); } - return Collections.unmodifiableCollection(transitModelIndex.getAllTrips()); + return Collections.unmodifiableCollection(timetableRepositoryIndex.getAllTrips()); } @Override @@ -313,11 +313,11 @@ public Collection getAllRoutes() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModelIndex.getAllRoutes(), + timetableRepositoryIndex.getAllRoutes(), currentSnapshot.listRealTimeAddedRoutes() ); } - return transitModelIndex.getAllRoutes(); + return timetableRepositoryIndex.getAllRoutes(); } @Override @@ -329,7 +329,7 @@ public TripPattern getPatternForTrip(Trip trip) { return realtimeAddedTripPattern; } } - return this.transitModelIndex.getPatternForTrip(trip); + return this.timetableRepositoryIndex.getPatternForTrip(trip); } @Override @@ -345,7 +345,7 @@ public TripPattern getPatternForTrip(Trip trip, LocalDate serviceDate) { public Collection getPatternsForRoute(Route route) { OTPRequestTimeoutException.checkForTimeout(); Collection tripPatterns = new HashSet<>( - transitModelIndex.getPatternsForRoute(route) + timetableRepositoryIndex.getPatternsForRoute(route) ); TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { @@ -359,7 +359,7 @@ public Collection getPatternsForRoute(Route route) { @Override public MultiModalStation getMultiModalStationForStation(Station station) { - return this.transitModel.getStopModel().getMultiModalStationForStation(station); + return this.timetableRepository.getStopModel().getMultiModalStationForStation(station); } /** @@ -465,7 +465,7 @@ public List stopTimesForPatternAtStop( * Returns all the patterns for a specific stop. If includeRealtimeUpdates is set, new patterns * added by realtime updates are added to the collection. * A set is used here because trip patterns - * that were updated by realtime data is both part of the TransitModelIndex and the TimetableSnapshot + * that were updated by realtime data is both part of the TimetableRepositoryIndex and the TimetableSnapshot */ @Override public Collection getPatternsForStop( @@ -486,18 +486,18 @@ public Collection getPatternsForStop( @Override public Collection getGroupsOfRoutes() { OTPRequestTimeoutException.checkForTimeout(); - return transitModelIndex.getAllGroupOfRoutes(); + return timetableRepositoryIndex.getAllGroupOfRoutes(); } @Override public Collection getRoutesForGroupOfRoutes(GroupOfRoutes groupOfRoutes) { OTPRequestTimeoutException.checkForTimeout(); - return transitModelIndex.getRoutesForGroupOfRoutes(groupOfRoutes); + return timetableRepositoryIndex.getRoutesForGroupOfRoutes(groupOfRoutes); } @Override public GroupOfRoutes getGroupOfRoutesForId(FeedScopedId id) { - return transitModelIndex.getGroupOfRoutesForId(id); + return timetableRepositoryIndex.getGroupOfRoutesForId(id); } /** @@ -540,7 +540,7 @@ public boolean hasNewTripPatternsForModifiedTrips() { @Nullable private TimetableSnapshot lazyGetTimeTableSnapShot() { if (this.timetableSnapshot == null) { - timetableSnapshot = transitModel.getTimetableSnapshot(); + timetableSnapshot = timetableRepository.getTimetableSnapshot(); } return this.timetableSnapshot; } @@ -556,7 +556,7 @@ public TripOnServiceDate getTripOnServiceDateById(FeedScopedId tripOnServiceDate return tripOnServiceDate; } } - return transitModel.getTripOnServiceDateById(tripOnServiceDateId); + return timetableRepository.getTripOnServiceDateById(tripOnServiceDateId); } @Override @@ -564,11 +564,11 @@ public Collection getAllTripOnServiceDates() { TimetableSnapshot currentSnapshot = lazyGetTimeTableSnapShot(); if (currentSnapshot != null) { return new CollectionsView<>( - transitModel.getAllTripsOnServiceDates(), + timetableRepository.getAllTripsOnServiceDates(), currentSnapshot.listRealTimeAddedTripOnServiceDate() ); } - return transitModel.getAllTripsOnServiceDates(); + return timetableRepository.getAllTripsOnServiceDates(); } @Override @@ -584,7 +584,7 @@ public TripOnServiceDate getTripOnServiceDateForTripAndDay( return tripOnServiceDate; } } - return transitModelIndex.getTripOnServiceDateForTripAndDay(tripIdAndServiceDate); + return timetableRepositoryIndex.getTripOnServiceDateForTripAndDay(tripIdAndServiceDate); } /** @@ -605,96 +605,96 @@ public List getTripOnServiceDates(TripOnServiceDateRequest re */ @Override public FeedScopedId getOrCreateServiceIdForDate(LocalDate serviceDate) { - return transitModel.getOrCreateServiceIdForDate(serviceDate); + return timetableRepository.getOrCreateServiceIdForDate(serviceDate); } @Override public void addTransitMode(TransitMode mode) { - this.transitModel.addTransitMode(mode); + this.timetableRepository.addTransitMode(mode); } @Override public Set getTransitModes() { - return this.transitModel.getTransitModes(); + return this.timetableRepository.getTransitModes(); } @Override public Collection getTransfersByStop(StopLocation stop) { - return this.transitModel.getTransfersByStop(stop); + return this.timetableRepository.getTransfersByStop(stop); } @Override public TransitLayer getTransitLayer() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getTransitLayer(); + return this.timetableRepository.getTransitLayer(); } @Override public TransitLayer getRealtimeTransitLayer() { OTPRequestTimeoutException.checkForTimeout(); - return this.transitModel.getRealtimeTransitLayer(); + return this.timetableRepository.getRealtimeTransitLayer(); } @Override public void setTransitLayer(TransitLayer transitLayer) { - this.transitModel.setTransitLayer(transitLayer); + this.timetableRepository.setTransitLayer(transitLayer); } @Override public void setRealtimeTransitLayer(TransitLayer realtimeTransitLayer) { - transitModel.setRealtimeTransitLayer(realtimeTransitLayer); + timetableRepository.setRealtimeTransitLayer(realtimeTransitLayer); } @Override public boolean hasRealtimeTransitLayer() { - return transitModel.hasRealtimeTransitLayer(); + return timetableRepository.hasRealtimeTransitLayer(); } @Override public CalendarService getCalendarService() { - return this.transitModel.getCalendarService(); + return this.timetableRepository.getCalendarService(); } @Override public ZoneId getTimeZone() { - return this.transitModel.getTimeZone(); + return this.timetableRepository.getTimeZone(); } @Override public TransitAlertService getTransitAlertService() { - return this.transitModel.getTransitAlertService(); + return this.timetableRepository.getTransitAlertService(); } @Override public FlexIndex getFlexIndex() { - return this.transitModelIndex.getFlexIndex(); + return this.timetableRepositoryIndex.getFlexIndex(); } @Override public ZonedDateTime getTransitServiceEnds() { - return transitModel.getTransitServiceEnds(); + return timetableRepository.getTransitServiceEnds(); } @Override public ZonedDateTime getTransitServiceStarts() { - return transitModel.getTransitServiceStarts(); + return timetableRepository.getTransitServiceStarts(); } @Override public Collection findRegularStops(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().findRegularStops(envelope); + return timetableRepository.getStopModel().findRegularStops(envelope); } @Override public Collection findAreaStops(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); - return transitModel.getStopModel().findAreaStops(envelope); + return timetableRepository.getStopModel().findAreaStops(envelope); } @Override public GraphUpdaterStatus getUpdaterStatus() { - return transitModel.getUpdaterManager(); + return timetableRepository.getUpdaterManager(); } @Override @@ -712,17 +712,19 @@ public List getModesOfStopLocation(StopLocation stop) { @Override public Deduplicator getDeduplicator() { - return transitModel.getDeduplicator(); + return timetableRepository.getDeduplicator(); } @Override public Set getAllServiceCodes() { - return Collections.unmodifiableSet(transitModelIndex.getServiceCodesRunningForDate().keySet()); + return Collections.unmodifiableSet( + timetableRepositoryIndex.getServiceCodesRunningForDate().keySet() + ); } @Override public Map getServiceCodesRunningForDate() { - return Collections.unmodifiableMap(transitModelIndex.getServiceCodesRunningForDate()); + return Collections.unmodifiableMap(timetableRepositoryIndex.getServiceCodesRunningForDate()); } /** @@ -738,12 +740,12 @@ private Stream getPatternModesOfStop(StopLocation stop) { @Override public TransferService getTransferService() { - return transitModel.getTransferService(); + return timetableRepository.getTransferService(); } @Override public boolean transitFeedCovers(Instant dateTime) { - return transitModel.transitFeedCovers(dateTime); + return timetableRepository.transitFeedCovers(dateTime); } /** diff --git a/application/src/main/java/org/opentripplanner/transit/service/TransitModel.java b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java similarity index 93% rename from application/src/main/java/org/opentripplanner/transit/service/TransitModel.java rename to application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java index 91c5ba8e5d9..dc092cc26c2 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/TransitModel.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java @@ -55,32 +55,32 @@ import org.slf4j.LoggerFactory; /** - * The TransitModel groups together all instances making up OTP's primary internal representation + * The TimetableRepository groups together all instances making up OTP's primary internal representation * of the public transportation network. Although the names of many entities are derived from * GTFS concepts, these are actually independent of the data source from which they are loaded. * Both GTFS and NeTEx entities are mapped to these same internal OTP entities. If a concept exists * in both GTFS and NeTEx, the GTFS name is used in the internal model. For concepts that exist * only in NeTEx, the NeTEx name is used in the internal model. * - * A TransitModel instance also includes references to some transient indexes of its contents, to + * A TimetableRepository instance also includes references to some transient indexes of its contents, to * the TransitLayer derived from it, and to some other services and utilities that operate upon * its contents. * - * The TransitModel stands in opposition to two other aggregates: the Graph (representing the - * street network) and the TransitLayer (representing many of the same things in the TransitModel + * The TimetableRepository stands in opposition to two other aggregates: the Graph (representing the + * street network) and the TransitLayer (representing many of the same things in the TimetableRepository * but rearranged to be more efficient for Raptor routing). * - * At this point the TransitModel is not often read directly. Many requests will look at the - * TransitLayer rather than the TransitModel it's derived from. Both are often accessed via the - * TransitService rather than directly reading the fields of TransitModel or TransitLayer. + * At this point the TimetableRepository is not often read directly. Many requests will look at the + * TransitLayer rather than the TimetableRepository it's derived from. Both are often accessed via the + * TransitService rather than directly reading the fields of TimetableRepository or TransitLayer. * * TODO RT_AB: consider renaming. By some definitions this is not really the model, but a top-level * object grouping together instances of model classes with things that operate on and map those * instances. */ -public class TransitModel implements Serializable { +public class TimetableRepository implements Serializable { - private static final Logger LOG = LoggerFactory.getLogger(TransitModel.class); + private static final Logger LOG = LoggerFactory.getLogger(TimetableRepository.class); private final Collection agencies = new ArrayList<>(); private final Collection operators = new ArrayList<>(); @@ -101,22 +101,22 @@ public class TransitModel implements Serializable { private ZonedDateTime transitServiceEnds = LocalDate.MIN.atStartOfDay(ZoneId.systemDefault()); /** - * The TransitLayer representation (optimized and rearranged for Raptor) of this TransitModel's + * The TransitLayer representation (optimized and rearranged for Raptor) of this TimetableRepository's * scheduled (non-realtime) contents. */ private transient TransitLayer transitLayer; /** * This updater applies realtime changes queued up for the next TimetableSnapshot such that - * this TransitModel.realtimeSnapshot remains aligned with the service represented in - * (this TransitModel instance + that next TimetableSnapshot). This is a way of keeping the + * this TimetableRepository.realtimeSnapshot remains aligned with the service represented in + * (this TimetableRepository instance + that next TimetableSnapshot). This is a way of keeping the * TransitLayer up to date without repeatedly deriving it from scratch every few seconds. The * same incremental changes are applied to both sets of data and they are published together. */ private transient TransitLayerUpdater transitLayerUpdater; /** - * An optionally present second TransitLayer representing the contents of this TransitModel plus + * An optionally present second TransitLayer representing the contents of this TimetableRepository plus * the results of realtime updates in the latest TimetableSnapshot. */ private final transient ConcurrentPublished realtimeTransitLayer = new ConcurrentPublished<>(); @@ -125,7 +125,7 @@ public class TransitModel implements Serializable { private final CalendarServiceData calendarServiceData = new CalendarServiceData(); - private transient TransitModelIndex index; + private transient TimetableRepositoryIndex index; private transient TimetableSnapshotProvider timetableSnapshotProvider = null; private ZoneId timeZone = null; private boolean timeZoneExplicitlySet = false; @@ -145,13 +145,13 @@ public class TransitModel implements Serializable { private transient TransitAlertService transitAlertService; @Inject - public TransitModel(StopModel stopModel, Deduplicator deduplicator) { + public TimetableRepository(StopModel stopModel, Deduplicator deduplicator) { this.stopModel = Objects.requireNonNull(stopModel); this.deduplicator = deduplicator; } /** No-argument constructor, required for deserialization. */ - public TransitModel() { + public TimetableRepository() { this(new StopModel(), new Deduplicator()); } @@ -164,7 +164,7 @@ public void index() { if (index == null) { LOG.info("Index transit model..."); // the transit model indexing updates the stop model index (flex stops added to the stop index) - this.index = new TransitModelIndex(this); + this.index = new TimetableRepositoryIndex(this); LOG.info("Index transit model complete."); } } @@ -548,7 +548,7 @@ public void setHasScheduledService(boolean hasScheduledService) { * possibility that the index is not initialized (during graph build). */ @Nullable - TransitModelIndex getTransitModelIndex() { + TimetableRepositoryIndex getTimetableRepositoryIndex() { return index; } diff --git a/application/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepositoryIndex.java similarity index 90% rename from application/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java rename to application/src/main/java/org/opentripplanner/transit/service/TimetableRepositoryIndex.java index 7f44854eb9a..dc618b0943f 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/TransitModelIndex.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepositoryIndex.java @@ -35,9 +35,9 @@ * For performance reasons these indexes are not part of the serialized state of the graph. * They are rebuilt at runtime after graph deserialization. */ -class TransitModelIndex { +class TimetableRepositoryIndex { - private static final Logger LOG = LoggerFactory.getLogger(TransitModelIndex.class); + private static final Logger LOG = LoggerFactory.getLogger(TimetableRepositoryIndex.class); // TODO: consistently key on model object or id string private final Map agencyForId = new HashMap<>(); @@ -58,18 +58,18 @@ class TransitModelIndex { private final Map groupOfRoutesForId = new HashMap<>(); private FlexIndex flexIndex = null; - TransitModelIndex(TransitModel transitModel) { + TimetableRepositoryIndex(TimetableRepository timetableRepository) { LOG.info("Transit model index init..."); - for (Agency agency : transitModel.getAgencies()) { + for (Agency agency : timetableRepository.getAgencies()) { this.agencyForId.put(agency.getId(), agency); } - for (Operator operator : transitModel.getOperators()) { + for (Operator operator : timetableRepository.getOperators()) { this.operatorForId.put(operator.getId(), operator); } - for (TripPattern pattern : transitModel.getAllTripPatterns()) { + for (TripPattern pattern : timetableRepository.getAllTripPatterns()) { patternsForRoute.put(pattern.getRoute(), pattern); pattern .scheduledTripsAsStream() @@ -91,7 +91,7 @@ class TransitModelIndex { groupOfRoutesForId.put(groupOfRoutes.getId(), groupOfRoutes); } - for (TripOnServiceDate tripOnServiceDate : transitModel.getAllTripsOnServiceDates()) { + for (TripOnServiceDate tripOnServiceDate : timetableRepository.getAllTripsOnServiceDates()) { tripOnServiceDateForTripAndDay.put( new TripIdAndServiceDate( tripOnServiceDate.getTrip().getId(), @@ -101,10 +101,10 @@ class TransitModelIndex { ); } - initalizeServiceCodesForDate(transitModel); + initalizeServiceCodesForDate(timetableRepository); if (OTPFeature.FlexRouting.isOn()) { - flexIndex = new FlexIndex(transitModel); + flexIndex = new FlexIndex(timetableRepository); for (Route route : flexIndex.getAllFlexRoutes()) { routeForId.put(route.getId(), route); } @@ -185,8 +185,8 @@ FlexIndex getFlexIndex() { return flexIndex; } - private void initalizeServiceCodesForDate(TransitModel transitModel) { - CalendarService calendarService = transitModel.getCalendarService(); + private void initalizeServiceCodesForDate(TimetableRepository timetableRepository) { + CalendarService calendarService = timetableRepository.getCalendarService(); if (calendarService == null) { return; @@ -216,7 +216,7 @@ private void initalizeServiceCodesForDate(TransitModel transitModel) { for (LocalDate serviceDate : serviceIdsForServiceDate.keySet()) { TIntSet serviceCodesRunning = new TIntHashSet(); for (FeedScopedId serviceId : serviceIdsForServiceDate.get(serviceDate)) { - serviceCodesRunning.add(transitModel.getServiceCodes().get(serviceId)); + serviceCodesRunning.add(timetableRepository.getServiceCodes().get(serviceId)); } serviceCodesRunningForDate.put(serviceDate, serviceCodesRunning); } diff --git a/application/src/main/java/org/opentripplanner/transit/service/TransitService.java b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java index 12fcbc9bc46..7be2a29065a 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/TransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java @@ -54,12 +54,12 @@ * fetching tables of specific information like the routes passing through a particular stop, or for * gaining access to the entirety of the data to perform routing. *

- * TODO RT_AB: this interface seems to provide direct access to TransitLayer but not TransitModel. - * Is this intentional, because TransitLayer is meant to be read-only and TransitModel is not? + * TODO RT_AB: this interface seems to provide direct access to TransitLayer but not TimetableRepository. + * Is this intentional, because TransitLayer is meant to be read-only and TimetableRepository is not? * Should this be renamed TransitDataService since it seems to provide access to the data but * not to transit routing functionality (which is provided by the RoutingService)? - * The DefaultTransitService implementation has a TransitModel instance and many of its methods - * read through to that TransitModel instance. But that field itself is not exposed, while the + * The DefaultTransitService implementation has a TimetableRepository instance and many of its methods + * read through to that TimetableRepository instance. But that field itself is not exposed, while the * TransitLayer is here. It seems like exposing the raw TransitLayer is still a risk since it's * copy-on-write and shares a lot of objects with any other TransitLayer instances. */ diff --git a/application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java b/application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java index a7f8e77dc00..f30111608cc 100644 --- a/application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java +++ b/application/src/main/java/org/opentripplanner/updater/DefaultRealTimeUpdateContext.java @@ -3,7 +3,7 @@ import org.opentripplanner.model.TimetableSnapshot; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.updater.siri.EntityResolver; import org.opentripplanner.updater.siri.SiriFuzzyTripMatcher; @@ -16,18 +16,18 @@ public class DefaultRealTimeUpdateContext implements RealTimeUpdateContext { public DefaultRealTimeUpdateContext( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, TimetableSnapshot timetableSnapshotBuffer ) { this.graph = graph; - this.transitService = new DefaultTransitService(transitModel, timetableSnapshotBuffer); + this.transitService = new DefaultTransitService(timetableRepository, timetableSnapshotBuffer); } /** * Constructor for unit tests only. */ - public DefaultRealTimeUpdateContext(Graph graph, TransitModel transitModel) { - this(graph, transitModel, null); + public DefaultRealTimeUpdateContext(Graph graph, TimetableRepository timetableRepository) { + this(graph, timetableRepository, null); } @Override diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index 728c07690ab..23b6d741e10 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -7,7 +7,7 @@ import org.opentripplanner.framework.tostring.ToStringBuilder; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.HttpHeaders; import org.opentripplanner.updater.spi.PollingGraphUpdater; import org.opentripplanner.updater.spi.WriteToGraphCallback; @@ -31,12 +31,12 @@ public class GtfsRealtimeAlertsUpdater extends PollingGraphUpdater implements Tr public GtfsRealtimeAlertsUpdater( GtfsRealtimeAlertsUpdaterParameters config, - TransitModel transitModel + TimetableRepository timetableRepository ) { super(config); this.url = config.url(); this.headers = HttpHeaders.of().acceptProtobuf().add(config.headers()).build(); - TransitAlertService transitAlertService = new TransitAlertServiceImpl(transitModel); + TransitAlertService transitAlertService = new TransitAlertServiceImpl(timetableRepository); this.transitAlertService = transitAlertService; diff --git a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java index df7014f2151..feea541741c 100644 --- a/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java +++ b/application/src/main/java/org/opentripplanner/updater/configure/UpdaterConfigurator.java @@ -13,7 +13,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.realtimevehicles.RealtimeVehicleRepository; import org.opentripplanner.service.vehiclerental.VehicleRentalRepository; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.UpdatersParameters; @@ -45,7 +45,7 @@ public class UpdaterConfigurator { private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final UpdatersParameters updatersParameters; private final RealtimeVehicleRepository realtimeVehicleRepository; private final VehicleRentalRepository vehicleRentalRepository; @@ -56,13 +56,13 @@ private UpdaterConfigurator( Graph graph, RealtimeVehicleRepository realtimeVehicleRepository, VehicleRentalRepository vehicleRentalRepository, - TransitModel transitModel, + TimetableRepository timetableRepository, UpdatersParameters updatersParameters ) { this.graph = graph; this.realtimeVehicleRepository = realtimeVehicleRepository; this.vehicleRentalRepository = vehicleRentalRepository; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.updatersParameters = updatersParameters; } @@ -70,14 +70,14 @@ public static void configure( Graph graph, RealtimeVehicleRepository realtimeVehicleRepository, VehicleRentalRepository vehicleRentalRepository, - TransitModel transitModel, + TimetableRepository timetableRepository, UpdatersParameters updatersParameters ) { new UpdaterConfigurator( graph, realtimeVehicleRepository, vehicleRentalRepository, - transitModel, + timetableRepository, updatersParameters ) .configure(); @@ -102,7 +102,7 @@ private void configure() { timetableSnapshotBuffer = gtfsTimetableSnapshotSource.getTimetableSnapshotBuffer(); } GraphUpdaterManager updaterManager = new GraphUpdaterManager( - new DefaultRealTimeUpdateContext(graph, transitModel, timetableSnapshotBuffer), + new DefaultRealTimeUpdateContext(graph, timetableRepository, timetableSnapshotBuffer), updaters ); @@ -116,12 +116,12 @@ private void configure() { } // Otherwise add it to the graph else { - transitModel.setUpdaterManager(updaterManager); + timetableRepository.setUpdaterManager(updaterManager); } } - public static void shutdownGraph(TransitModel transitModel) { - GraphUpdaterManager updaterManager = transitModel.getUpdaterManager(); + public static void shutdownGraph(TimetableRepository timetableRepository) { + GraphUpdaterManager updaterManager = timetableRepository.getUpdaterManager(); if (updaterManager != null) { updaterManager.stop(); } @@ -167,7 +167,7 @@ private List createUpdatersFromConfig() { } } for (var configItem : updatersParameters.getGtfsRealtimeAlertsUpdaterParameters()) { - updaters.add(new GtfsRealtimeAlertsUpdater(configItem, transitModel)); + updaters.add(new GtfsRealtimeAlertsUpdater(configItem, timetableRepository)); } for (var configItem : updatersParameters.getPollingStoptimeUpdaterParameters()) { updaters.add(new PollingTripUpdater(configItem, provideGtfsTimetableSnapshot())); @@ -182,7 +182,7 @@ private List createUpdatersFromConfig() { updaters.add(new SiriETGooglePubsubUpdater(configItem, provideSiriTimetableSnapshot())); } for (var configItem : updatersParameters.getSiriSXUpdaterParameters()) { - updaters.add(new SiriSXUpdater(configItem, transitModel)); + updaters.add(new SiriSXUpdater(configItem, timetableRepository)); } for (var configItem : updatersParameters.getMqttGtfsRealtimeUpdaterParameters()) { updaters.add(new MqttGtfsRealtimeUpdater(configItem, provideGtfsTimetableSnapshot())); @@ -219,7 +219,7 @@ private List createUpdatersFromConfig() { updaters.add(new SiriAzureETUpdater(configItem, provideSiriTimetableSnapshot())); } for (var configItem : updatersParameters.getSiriAzureSXUpdaterParameters()) { - updaters.add(new SiriAzureSXUpdater(configItem, transitModel)); + updaters.add(new SiriAzureSXUpdater(configItem, timetableRepository)); } return updaters; @@ -230,7 +230,7 @@ private SiriTimetableSnapshotSource provideSiriTimetableSnapshot() { this.siriTimetableSnapshotSource = new SiriTimetableSnapshotSource( updatersParameters.timetableSnapshotParameters(), - transitModel + timetableRepository ); } @@ -240,7 +240,10 @@ private SiriTimetableSnapshotSource provideSiriTimetableSnapshot() { private TimetableSnapshotSource provideGtfsTimetableSnapshot() { if (gtfsTimetableSnapshotSource == null) { this.gtfsTimetableSnapshotSource = - new TimetableSnapshotSource(updatersParameters.timetableSnapshotParameters(), transitModel); + new TimetableSnapshotSource( + updatersParameters.timetableSnapshotParameters(), + timetableRepository + ); } return gtfsTimetableSnapshotSource; } diff --git a/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java b/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java index b3f9a3e4e00..c3bb31ed068 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java @@ -180,7 +180,7 @@ Result build() { } route = createRoute(agency); isAddedRoute = true; - LOG.info("Adding route {} to transitModel.", route); + LOG.info("Adding route {} to timetableRepository.", route); } Trip trip = createTrip(route, calServiceId); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSource.java b/application/src/main/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSource.java index ad49af38235..b6aa5310d83 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSource.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSource.java @@ -24,8 +24,8 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.DefaultTransitService; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; -import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.spi.DataValidationExceptionMapper; import org.opentripplanner.updater.spi.UpdateError; @@ -69,20 +69,20 @@ public class SiriTimetableSnapshotSource implements TimetableSnapshotProvider { public SiriTimetableSnapshotSource( TimetableSnapshotSourceParameters parameters, - TransitModel transitModel + TimetableRepository timetableRepository ) { this.snapshotManager = new TimetableSnapshotManager( - transitModel.getTransitLayerUpdater(), + timetableRepository.getTransitLayerUpdater(), parameters, - () -> LocalDate.now(transitModel.getTimeZone()) + () -> LocalDate.now(timetableRepository.getTimeZone()) ); this.transitEditorService = - new DefaultTransitService(transitModel, getTimetableSnapshotBuffer()); + new DefaultTransitService(timetableRepository, getTimetableSnapshotBuffer()); this.tripPatternCache = new SiriTripPatternCache(tripPatternIdGenerator, transitEditorService::getPatternForTrip); - transitModel.initTimetableSnapshotProvider(this); + timetableRepository.initTimetableSnapshotProvider(this); } /** @@ -293,7 +293,7 @@ private Result handleModifiedTrip( } /** - * Add a (new) trip to the transitModel and the buffer + * Add a (new) trip to the timetableRepository and the buffer */ private Result addTripToGraphAndBuffer(TripUpdate tripUpdate) { Trip trip = tripUpdate.tripTimes().getTrip(); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternCache.java b/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternCache.java index b750df8b69f..19816bd085f 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternCache.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/SiriTripPatternCache.java @@ -100,7 +100,7 @@ public synchronized TripPattern getOrCreateTripPattern( .withCreatedByRealtimeUpdater(true) .withOriginalTripPattern(originalTripPattern) .build(); - // TODO: Add pattern to transitModel index? + // TODO: Add pattern to timetableRepository index? // Add pattern to cache cache.put(key, tripPattern); diff --git a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java index 5eeb6ffc66e..83200db30d3 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/updater/SiriSXUpdater.java @@ -9,7 +9,7 @@ import org.opentripplanner.framework.retry.OtpRetryBuilder; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.alert.TransitAlertProvider; import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import org.opentripplanner.updater.spi.PollingGraphUpdater; @@ -43,7 +43,7 @@ public class SiriSXUpdater extends PollingGraphUpdater implements TransitAlertPr private final SiriHttpLoader siriHttpLoader; private final OtpRetry retry; - public SiriSXUpdater(SiriSXUpdaterParameters config, TransitModel transitModel) { + public SiriSXUpdater(SiriSXUpdaterParameters config, TimetableRepository timetableRepository) { super(config); // TODO: add options to choose different patch services this.url = config.url(); @@ -56,7 +56,7 @@ public SiriSXUpdater(SiriSXUpdaterParameters config, TransitModel transitModel) //Keeping original requestorRef use as base for updated requestorRef to be used in retries this.originalRequestorRef = requestorRef; this.blockReadinessUntilInitialized = config.blockReadinessUntilInitialized(); - this.transitAlertService = new TransitAlertServiceImpl(transitModel); + this.transitAlertService = new TransitAlertServiceImpl(timetableRepository); this.updateHandler = new SiriAlertsUpdateHandler(config.feedId(), transitAlertService, config.earlyStart()); siriHttpLoader = new SiriHttpLoader(url, config.timeout(), config.requestHeaders()); @@ -120,11 +120,11 @@ private void updateSiri() { // Such runnables should be illustrated in documentation as e.g. a little box labeled // "change trip ABC123 by making stop 53 late by 2 minutes." // Also clarify how this runnable works without even using the supplied - // (graph, transitModel) parameters. There are multiple TransitAlertServices and they + // (graph, timetableRepository) parameters. There are multiple TransitAlertServices and they // are not versioned along with the Graph, they are attached to updaters. // // This is submitting a runnable to an executor, but that runnable only writes back to - // objects referenced by updateHandler itself, rather than the graph or transitModel + // objects referenced by updateHandler itself, rather than the graph or timetableRepository // supplied for writing, and apparently with no versioning. This seems like a // misinterpretation of the realtime design. // If this is an intentional choice to live-patch a single server-wide instance of an diff --git a/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java b/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java index 6273de676b5..f83fa9d247e 100644 --- a/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/TimetableSnapshotSource.java @@ -60,8 +60,8 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; -import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.updater.GtfsRealtimeFuzzyTripMatcher; import org.opentripplanner.updater.GtfsRealtimeMapper; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; @@ -108,9 +108,9 @@ public class TimetableSnapshotSource implements TimetableSnapshotProvider { public TimetableSnapshotSource( TimetableSnapshotSourceParameters parameters, - TransitModel transitModel + TimetableRepository timetableRepository ) { - this(parameters, transitModel, () -> LocalDate.now(transitModel.getTimeZone())); + this(parameters, timetableRepository, () -> LocalDate.now(timetableRepository.getTimeZone())); } /** @@ -119,20 +119,24 @@ public TimetableSnapshotSource( */ TimetableSnapshotSource( TimetableSnapshotSourceParameters parameters, - TransitModel transitModel, + TimetableRepository timetableRepository, Supplier localDateNow ) { this.snapshotManager = - new TimetableSnapshotManager(transitModel.getTransitLayerUpdater(), parameters, localDateNow); - this.timeZone = transitModel.getTimeZone(); + new TimetableSnapshotManager( + timetableRepository.getTransitLayerUpdater(), + parameters, + localDateNow + ); + this.timeZone = timetableRepository.getTimeZone(); this.transitEditorService = - new DefaultTransitService(transitModel, snapshotManager.getTimetableSnapshotBuffer()); - this.deduplicator = transitModel.getDeduplicator(); - this.serviceCodes = transitModel.getServiceCodes(); + new DefaultTransitService(timetableRepository, snapshotManager.getTimetableSnapshotBuffer()); + this.deduplicator = timetableRepository.getDeduplicator(); + this.serviceCodes = timetableRepository.getServiceCodes(); this.localDateNow = localDateNow; // Inject this into the transit model - transitModel.initTimetableSnapshotProvider(this); + timetableRepository.initTimetableSnapshotProvider(this); } /** diff --git a/application/src/test/java/org/opentripplanner/ConstantsForTests.java b/application/src/test/java/org/opentripplanner/ConstantsForTests.java index b9ec788dac0..241cc245da1 100644 --- a/application/src/test/java/org/opentripplanner/ConstantsForTests.java +++ b/application/src/test/java/org/opentripplanner/ConstantsForTests.java @@ -44,7 +44,7 @@ import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class ConstantsForTests { @@ -124,7 +124,7 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { try { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); // Add street data from OSM { OsmProvider osmProvider = new OsmProvider(PORTLAND_CENTRAL_OSM, false); @@ -137,10 +137,16 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { } // Add transit data from GTFS { - addGtfsToGraph(graph, transitModel, PORTLAND_GTFS, new DefaultFareServiceFactory(), "prt"); + addGtfsToGraph( + graph, + timetableRepository, + PORTLAND_GTFS, + new DefaultFareServiceFactory(), + "prt" + ); } // Link transit stops to streets - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); // Add elevation data if (withElevation) { @@ -155,10 +161,10 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { addPortlandVehicleRentals(graph); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); - return new TestOtpModel(graph, transitModel); + return new TestOtpModel(graph, timetableRepository); } catch (Exception e) { throw new RuntimeException(e); } @@ -169,12 +175,12 @@ public static TestOtpModel buildOsmGraph(File osmFile) { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); // Add street data from OSM OsmProvider osmProvider = new OsmProvider(osmFile, true); OsmModule osmModule = OsmModule.of(osmProvider, graph).build(); osmModule.buildGraph(); - return new TestOtpModel(graph, transitModel); + return new TestOtpModel(graph, timetableRepository); } catch (Exception e) { throw new RuntimeException(e); } @@ -185,14 +191,14 @@ public static TestOtpModel buildOsmAndGtfsGraph(File osmPath, File gtfsPath) { addGtfsToGraph( otpModel.graph(), - otpModel.transitModel(), + otpModel.timetableRepository(), gtfsPath, new DefaultFareServiceFactory(), null ); // Link transit stops to streets - TestStreetLinkerModule.link(otpModel.graph(), otpModel.transitModel()); + TestStreetLinkerModule.link(otpModel.graph(), otpModel.timetableRepository()); return otpModel; } @@ -205,9 +211,9 @@ public static TestOtpModel buildGtfsGraph(File gtfsFile, FareServiceFactory fare var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); - addGtfsToGraph(graph, transitModel, gtfsFile, fareServiceFactory, null); - return new TestOtpModel(graph, transitModel); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); + addGtfsToGraph(graph, timetableRepository, gtfsFile, fareServiceFactory, null); + return new TestOtpModel(graph, timetableRepository); } public static TestOtpModel buildNewMinimalNetexGraph() { @@ -215,7 +221,7 @@ public static TestOtpModel buildNewMinimalNetexGraph() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); // Add street data from OSM { OsmProvider osmProvider = new OsmProvider(OSLO_EAST_OSM, false); @@ -232,13 +238,13 @@ public static TestOtpModel buildNewMinimalNetexGraph() { var sources = List.of(new ConfiguredDataSource<>(NETEX_MINIMAL_DATA_SOURCE, netexConfig)); new NetexConfigure(buildConfig) - .createNetexModule(sources, transitModel, graph, DataImportIssueStore.NOOP) + .createNetexModule(sources, timetableRepository, graph, DataImportIssueStore.NOOP) .buildGraph(); } // Link transit stops to streets - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); - return new TestOtpModel(graph, transitModel); + return new TestOtpModel(graph, timetableRepository); } catch (Exception e) { throw new RuntimeException(e); } @@ -266,7 +272,7 @@ public synchronized TestOtpModel getCachedPortlandGraphWithElevation() { public static void addGtfsToGraph( Graph graph, - TransitModel transitModel, + TimetableRepository timetableRepository, File file, FareServiceFactory fareServiceFactory, @Nullable String feedId @@ -276,7 +282,7 @@ public static void addGtfsToGraph( var module = new GtfsModule( List.of(bundle), - transitModel, + timetableRepository, graph, DataImportIssueStore.NOOP, ServiceDateInterval.unbounded(), @@ -285,8 +291,8 @@ public static void addGtfsToGraph( module.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); } private static void addPortlandVehicleRentals(Graph graph) { diff --git a/application/src/test/java/org/opentripplanner/GtfsTest.java b/application/src/test/java/org/opentripplanner/GtfsTest.java index 9b37c488b8e..0e862c38901 100644 --- a/application/src/test/java/org/opentripplanner/GtfsTest.java +++ b/application/src/test/java/org/opentripplanner/GtfsTest.java @@ -40,7 +40,7 @@ import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.alert.AlertsUpdateHandler; import org.opentripplanner.updater.trip.TimetableSnapshotSource; @@ -50,7 +50,7 @@ public abstract class GtfsTest { public Graph graph; - public TransitModel transitModel; + public TimetableRepository timetableRepository; AlertsUpdateHandler alertsUpdateHandler; TimetableSnapshotSource timetableSnapshotSource; @@ -194,27 +194,27 @@ protected void setUp() throws Exception { alertsUpdateHandler = new AlertsUpdateHandler(false); var deduplicator = new Deduplicator(); graph = new Graph(deduplicator); - transitModel = new TransitModel(new StopModel(), deduplicator); + timetableRepository = new TimetableRepository(new StopModel(), deduplicator); GtfsModule gtfsGraphBuilderImpl = new GtfsModule( gtfsBundleList, - transitModel, + timetableRepository, graph, ServiceDateInterval.unbounded() ); gtfsGraphBuilderImpl.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); - serverContext = TestServerContext.createServerContext(graph, transitModel); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); + serverContext = TestServerContext.createServerContext(graph, timetableRepository); timetableSnapshotSource = new TimetableSnapshotSource( TimetableSnapshotSourceParameters.DEFAULT .withPurgeExpiredData(true) .withMaxSnapshotFrequency(Duration.ZERO), - transitModel + timetableRepository ); - alertPatchServiceImpl = new TransitAlertServiceImpl(transitModel); + alertPatchServiceImpl = new TransitAlertServiceImpl(timetableRepository); alertsUpdateHandler.setTransitAlertService(alertPatchServiceImpl); alertsUpdateHandler.setFeedId(feedId.getId()); diff --git a/application/src/test/java/org/opentripplanner/TestOtpModel.java b/application/src/test/java/org/opentripplanner/TestOtpModel.java index a2fc5305ce9..36caf1dec43 100644 --- a/application/src/test/java/org/opentripplanner/TestOtpModel.java +++ b/application/src/test/java/org/opentripplanner/TestOtpModel.java @@ -1,12 +1,12 @@ package org.opentripplanner; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; -public record TestOtpModel(Graph graph, TransitModel transitModel) { +public record TestOtpModel(Graph graph, TimetableRepository timetableRepository) { public TestOtpModel index() { - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); return this; } } diff --git a/application/src/test/java/org/opentripplanner/TestServerContext.java b/application/src/test/java/org/opentripplanner/TestServerContext.java index 90dca6ff840..04a222c4434 100644 --- a/application/src/test/java/org/opentripplanner/TestServerContext.java +++ b/application/src/test/java/org/opentripplanner/TestServerContext.java @@ -24,7 +24,7 @@ import org.opentripplanner.street.service.DefaultStreetLimitationParametersService; import org.opentripplanner.street.service.StreetLimitationParametersService; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; public class TestServerContext { @@ -34,17 +34,17 @@ private TestServerContext() {} /** Create a context for unit testing, using the default RouteRequest. */ public static OtpServerRequestContext createServerContext( Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { - transitModel.index(); + timetableRepository.index(); final RouterConfig routerConfig = RouterConfig.DEFAULT; - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); DefaultServerRequestContext context = DefaultServerRequestContext.create( routerConfig.transitTuningConfig(), routerConfig.routingRequestDefaults(), new RaptorConfig<>(routerConfig.transitTuningConfig()), graph, - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), Metrics.globalRegistry, routerConfig.vectorTileConfig(), createWorldEnvelopeService(), @@ -58,7 +58,7 @@ public static OtpServerRequestContext createServerContext( null, null ); - creatTransitLayerForRaptor(transitModel, routerConfig.transitTuningConfig()); + creatTransitLayerForRaptor(timetableRepository, routerConfig.transitTuningConfig()); return context; } diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java index 416ca6c364e..730ea4e2ed3 100644 --- a/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java @@ -11,7 +11,7 @@ import static org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary; import static org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle.StopStatus.IN_TRANSIT_TO; import static org.opentripplanner.test.support.JsonAssertions.assertEqualJson; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.transit.model.basic.TransitMode.BUS; import static org.opentripplanner.transit.model.basic.TransitMode.FERRY; import static org.opentripplanner.transit.model.timetable.OccupancyStatus.FEW_SEATS_AVAILABLE; @@ -79,7 +79,7 @@ import org.opentripplanner.service.vehiclerental.model.VehicleRentalVehicle; import org.opentripplanner.standalone.config.framework.json.JsonSupport; import org.opentripplanner.test.support.FilePatternSource; -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.AbstractBuilder; @@ -94,13 +94,13 @@ import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; -import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.transit.service.TransitService; class GraphQLIntegrationTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = TEST_MODEL.place("A", 5.0, 8.0); private static final Place B = TEST_MODEL.place("B", 6.0, 8.5); @@ -115,7 +115,7 @@ class GraphQLIntegrationTest { .of(A, B, C, D, E, F, G, H) .map(p -> (RegularStop) p.stop) .toList(); - private static final Route ROUTE = TransitModelForTest.route("a-route").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("a-route").build(); private static VehicleRentalStation VEHICLE_RENTAL_STATION = new TestVehicleRentalStationBuilder() .withVehicles(10) @@ -160,9 +160,12 @@ static void setup() { var stopModel = TEST_MODEL.stopModelBuilder(); STOP_LOCATIONS.forEach(stopModel::withRegularStop); var model = stopModel.build(); - var transitModel = new TransitModel(model, DEDUPLICATOR); + var timetableRepository = new TimetableRepository(model, DEDUPLICATOR); - var trip = TransitModelForTest.trip("123").withHeadsign(I18NString.of("Trip Headsign")).build(); + var trip = TimetableRepositoryForTest + .trip("123") + .withHeadsign(I18NString.of("Trip Headsign")) + .build(); var stopTimes = TEST_MODEL.stopTimesEvery5Minutes(3, trip, T11_00); var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, DEDUPLICATOR); final TripPattern pattern = TEST_MODEL @@ -170,11 +173,11 @@ static void setup() { .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); - transitModel.addTripPattern(id("pattern-1"), pattern); + timetableRepository.addTripPattern(id("pattern-1"), pattern); var feedId = "testfeed"; var feedInfo = FeedInfo.dummyForTest(feedId); - transitModel.addFeedInfo(feedInfo); + timetableRepository.addFeedInfo(feedInfo); var agency = Agency .of(new FeedScopedId(feedId, "agency-xx")) @@ -182,15 +185,15 @@ static void setup() { .withUrl("www.otp-foo.bar") .withTimezone("Europe/Berlin") .build(); - transitModel.addAgency(agency); + timetableRepository.addAgency(agency); - transitModel.initTimeZone(ZoneIds.BERLIN); - transitModel.index(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + timetableRepository.index(); var routes = Arrays .stream(TransitMode.values()) .sorted(Comparator.comparing(Enum::name)) .map(m -> - TransitModelForTest + TimetableRepositoryForTest .route(m.name()) .withMode(m) .withLongName(I18NString.of("Long name for %s".formatted(m))) @@ -201,8 +204,10 @@ static void setup() { .toList(); var busRoute = routes.stream().filter(r -> r.getMode().equals(BUS)).findFirst().get(); - TransitEditorService transitService = new DefaultTransitService(transitModel) { - private final TransitAlertService alertService = new TransitAlertServiceImpl(transitModel); + TransitEditorService transitService = new DefaultTransitService(timetableRepository) { + private final TransitAlertService alertService = new TransitAlertServiceImpl( + timetableRepository + ); @Override public List getModesOfStopLocation(StopLocation stop) { @@ -464,7 +469,7 @@ public List findClosestPlaces( List filterByNetwork, TransitService transitService ) { - var stop = TransitModelForTest.of().stop("A").build(); + var stop = TimetableRepositoryForTest.of().stop("A").build(); return List.of( new PlaceAtDistance(stop, 0), new PlaceAtDistance(VEHICLE_RENTAL_STATION, 30), diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java index f2992a30d92..3ca29f7c531 100644 --- a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java @@ -38,7 +38,7 @@ import org.opentripplanner.service.vehiclerental.internal.DefaultVehicleRentalService; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class LegacyRouteRequestMapperTest implements PlanTestConstants { @@ -46,9 +46,9 @@ class LegacyRouteRequestMapperTest implements PlanTestConstants { static { Graph graph = new Graph(); - var transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.BERLIN); - final DefaultTransitService transitService = new DefaultTransitService(transitModel); + var timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + final DefaultTransitService transitService = new DefaultTransitService(timetableRepository); context = new GraphQLRequestContext( new TestRoutingService(List.of()), diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java index f47f7a7004a..d4e48b63141 100644 --- a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java @@ -34,7 +34,7 @@ import org.opentripplanner.service.vehiclerental.internal.DefaultVehicleRentalService; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class RouteRequestMapperTest { @@ -62,9 +62,9 @@ class RouteRequestMapperTest { static { Graph graph = new Graph(); - var transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.BERLIN); - final DefaultTransitService transitService = new DefaultTransitService(transitModel); + var timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + final DefaultTransitService transitService = new DefaultTransitService(timetableRepository); CONTEXT = new GraphQLRequestContext( new TestRoutingService(List.of()), 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 38a411ac1cf..b8eeb2d13d9 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 @@ -54,25 +54,25 @@ import org.opentripplanner.standalone.server.DefaultServerRequestContext; import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.street.service.DefaultStreetLimitationParametersService; -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.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TripRequestMapperTest implements PlanTestConstants { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Duration MAX_FLEXIBLE = Duration.ofMinutes(20); private static final Function STOP_TO_ID = s -> s.getId().toString(); - private static final Route route1 = TransitModelForTest.route("route1").build(); - private static final Route route2 = TransitModelForTest.route("route2").build(); + private static final Route route1 = TimetableRepositoryForTest.route("route1").build(); + private static final Route route2 = TimetableRepositoryForTest.route("route2").build(); private static final RegularStop stop1 = TEST_MODEL.stop("ST:stop1", 1, 1).build(); private static final RegularStop stop2 = TEST_MODEL.stop("ST:stop2", 2, 1).build(); @@ -96,20 +96,24 @@ public class TripRequestMapperTest implements PlanTestConstants { .withRegularStop(stop3) .build(); - var transitModel = new TransitModel(stopModel, new Deduplicator()); - transitModel.initTimeZone(ZoneIds.STOCKHOLM); + var timetableRepository = new TimetableRepository(stopModel, new Deduplicator()); + timetableRepository.initTimeZone(ZoneIds.STOCKHOLM); var calendarServiceData = new CalendarServiceData(); LocalDate serviceDate = itinerary.startTime().toLocalDate(); patterns.forEach(pattern -> { - transitModel.addTripPattern(pattern.getId(), pattern); + timetableRepository.addTripPattern(pattern.getId(), pattern); final int serviceCode = pattern.getScheduledTimetable().getTripTimes(0).getServiceCode(); - transitModel.getServiceCodes().put(pattern.getId(), serviceCode); + timetableRepository.getServiceCodes().put(pattern.getId(), serviceCode); calendarServiceData.putServiceDatesForServiceId(pattern.getId(), List.of(serviceDate)); }); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); - transitModel.index(); - transitService = new DefaultTransitService(transitModel); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); + timetableRepository.index(); + transitService = new DefaultTransitService(timetableRepository); } @BeforeEach diff --git a/application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java index 579f9b73761..58054a3c778 100644 --- a/application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java +++ b/application/src/test/java/org/opentripplanner/apis/transmodel/model/plan/TripPlanTimePenaltyDtoTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; import org.opentripplanner.model.plan.TestItineraryBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class TripPlanTimePenaltyDtoTest { @@ -20,7 +20,7 @@ class TripPlanTimePenaltyDtoTest { Cost.costOfSeconds(21) ); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final Place placeA = Place.forStop(testModel.stop("A").build()); private final Place placeB = Place.forStop(testModel.stop("B").build()); 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 a86e270a2af..dc924ac765a 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 @@ -15,14 +15,14 @@ import org.opentripplanner.routing.api.request.RequestModes; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.api.OtpServerRequestContext; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class PlannerResourceTest { static OtpServerRequestContext context() { - var transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.BERLIN); - return TestServerContext.createServerContext(new Graph(), transitModel); + var timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.BERLIN); + return TestServerContext.createServerContext(new Graph(), timetableRepository); } @Test diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java index 002c386d151..bb3144aa904 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/DirectTransferGeneratorTest.java @@ -26,7 +26,7 @@ import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.vertex.StreetVertex; import org.opentripplanner.street.model.vertex.TransitStopVertex; -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.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; @@ -54,7 +54,7 @@ class DirectTransferGeneratorTest extends GraphRoutingTest { public void testDirectTransfersWithoutPatterns() { var otpModel = model(false); var graph = otpModel.graph(); - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var req = new RouteRequest(); req.journey().transfer().setMode(StreetMode.WALK); var transferRequests = List.of(req); @@ -62,14 +62,14 @@ public void testDirectTransfersWithoutPatterns() { new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTransfers(transitModel.getAllPathTransfers()); + assertTransfers(timetableRepository.getAllPathTransfers()); } @Test @@ -77,14 +77,14 @@ public void testDirectTransfersWithPatterns() { var otpModel = model(true); var graph = otpModel.graph(); graph.hasStreets = false; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var req = new RouteRequest(); req.journey().transfer().setMode(StreetMode.WALK); var transferRequests = List.of(req); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -92,7 +92,7 @@ public void testDirectTransfersWithPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 556, S11), tr(S0, 935, S21), tr(S11, 751, S21), @@ -111,12 +111,12 @@ public void testDirectTransfersWithRestrictedPatterns() { var otpModel = model(true, true); var graph = otpModel.graph(); graph.hasStreets = false; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var transferRequests = List.of(new RouteRequest()); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -124,7 +124,7 @@ public void testDirectTransfersWithRestrictedPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 2780, S12), tr(S0, 935, S21), tr(S11, 2224, S12), @@ -148,18 +148,18 @@ public void testSingleRequestWithoutPatterns() { var otpModel = model(false); var graph = otpModel.graph(); graph.hasStreets = true; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTransfers(transitModel.getAllPathTransfers()); + assertTransfers(timetableRepository.getAllPathTransfers()); } @Test @@ -171,11 +171,11 @@ public void testSingleRequestWithPatterns() { var otpModel = model(true); var graph = otpModel.graph(); graph.hasStreets = true; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -183,7 +183,7 @@ public void testSingleRequestWithPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 100, List.of(V0, V11), S11), tr(S0, 100, List.of(V0, V21), S21), tr(S11, 100, List.of(V11, V21), S21) @@ -203,18 +203,18 @@ public void testMultipleRequestsWithoutPatterns() { var otpModel = model(false); var graph = otpModel.graph(); graph.hasStreets = true; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTransfers(transitModel.getAllPathTransfers()); + assertTransfers(timetableRepository.getAllPathTransfers()); } @Test @@ -230,11 +230,11 @@ public void testMultipleRequestsWithPatterns() { TestOtpModel model = model(true); var graph = model.graph(); graph.hasStreets = true; - var transitModel = model.transitModel(); + var timetableRepository = model.timetableRepository(); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests @@ -242,7 +242,7 @@ public void testMultipleRequestsWithPatterns() { .buildGraph(); assertTransfers( - transitModel.getAllPathTransfers(), + timetableRepository.getAllPathTransfers(), tr(S0, 100, List.of(V0, V11), S11), tr(S0, 100, List.of(V0, V21), S21), tr(S11, 100, List.of(V11, V21), S21), @@ -256,21 +256,21 @@ public void testTransferOnIsolatedStations() { var graph = otpModel.graph(); graph.hasStreets = false; - var transitModel = otpModel.transitModel(); + var timetableRepository = otpModel.timetableRepository(); var req = new RouteRequest(); req.journey().transfer().setMode(StreetMode.WALK); var transferRequests = List.of(req); new DirectTransferGenerator( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, MAX_TRANSFER_DURATION, transferRequests ) .buildGraph(); - assertTrue(transitModel.getAllPathTransfers().isEmpty()); + assertTrue(timetableRepository.getAllPathTransfers().isEmpty()); } private TestOtpModel model(boolean addPatterns) { @@ -332,11 +332,11 @@ public void build() { street(V11, V22, 110, StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE); if (addPatterns) { - var agency = TransitModelForTest.agency("Agency"); + var agency = TimetableRepositoryForTest.agency("Agency"); tripPattern( TripPattern - .of(TransitModelForTest.id("TP1")) + .of(TimetableRepositoryForTest.id("TP1")) .withRoute(route("R1", TransitMode.BUS, agency)) .withStopPattern( new StopPattern(List.of(st(S11, !withBoardingConstraint, true), st(S12), st(S13))) @@ -346,7 +346,7 @@ public void build() { tripPattern( TripPattern - .of(TransitModelForTest.id("TP2")) + .of(TimetableRepositoryForTest.id("TP2")) .withRoute(route("R2", TransitMode.BUS, agency)) .withStopPattern(new StopPattern(List.of(st(S21), st(S22), st(S23)))) .build() 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 8123661990e..650282d6e7d 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 @@ -19,7 +19,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class GtfsModuleTest { @@ -30,14 +30,14 @@ void addShapesForFrequencyTrips() { var bundle = new GtfsBundle(ConstantsForTests.SIMPLE_GTFS); var module = new GtfsModule( List.of(bundle), - model.transitModel, + model.timetableRepository, model.graph, ServiceDateInterval.unbounded() ); module.buildGraph(); - var frequencyTripPattern = model.transitModel + var frequencyTripPattern = model.timetableRepository .getAllTripPatterns() .stream() .filter(p -> !p.getScheduledTimetable().getFrequencyEntries().isEmpty()) @@ -49,7 +49,7 @@ void addShapesForFrequencyTrips() { assertNotNull(tripPattern.getGeometry()); assertNotNull(tripPattern.getHopGeometry(0)); - var pattern = model.transitModel.getTripPatternForId(tripPattern.getId()); + var pattern = model.timetableRepository.getTripPatternForId(tripPattern.getId()); assertNotNull(pattern.getGeometry()); assertNotNull(pattern.getHopGeometry(0)); } @@ -61,7 +61,7 @@ void duplicateFeedId() { var module = new GtfsModule( bundles, - model.transitModel, + model.timetableRepository, model.graph, ServiceDateInterval.unbounded() ); @@ -72,11 +72,11 @@ private static TestModels buildTestModel() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); - return new TestModels(graph, transitModel); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); + return new TestModels(graph, timetableRepository); } - record TestModels(Graph graph, TransitModel transitModel) {} + record TestModels(Graph graph, TimetableRepository timetableRepository) {} static GtfsBundle bundle(String feedId) { var b = new GtfsBundle(ResourceLoader.of(GtfsModuleTest.class).file("/gtfs/interlining")); @@ -109,14 +109,17 @@ void interline(List bundles, int expectedTransfers) { var module = new GtfsModule( bundles, - model.transitModel, + model.timetableRepository, model.graph, ServiceDateInterval.unbounded() ); module.buildGraph(); - assertEquals(expectedTransfers, model.transitModel.getTransferService().listAll().size()); + assertEquals( + expectedTransfers, + model.timetableRepository.getTransferService().listAll().size() + ); } } } diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java index 9409171920f..f411bf6757c 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java @@ -24,12 +24,12 @@ import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.street.model.vertex.VertexLabel; import org.opentripplanner.test.support.ResourceLoader; -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.site.RegularStop; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * We test that the platform area at Herrenberg station (https://www.openstreetmap.org/way/27558650) @@ -37,7 +37,7 @@ */ class OsmBoardingLocationsModuleTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); File file = ResourceLoader .of(OsmBoardingLocationsModuleTest.class) @@ -69,7 +69,7 @@ static Stream testCases() { void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVertices) { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); var factory = new VertexFactory(graph); var provider = new OsmProvider(file, false); @@ -97,8 +97,8 @@ void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVerti TransitStopVertex.of().withStop(busStop).withModes(Set.of(TransitMode.BUS)) ); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); assertEquals(0, busVertex.getIncoming().size()); assertEquals(0, busVertex.getOutgoing().size()); @@ -106,7 +106,7 @@ void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVerti assertEquals(0, platformVertex.getIncoming().size()); assertEquals(0, platformVertex.getOutgoing().size()); - new OsmBoardingLocationsModule(graph, transitModel).buildGraph(); + new OsmBoardingLocationsModule(graph, timetableRepository).buildGraph(); var boardingLocations = graph.getVerticesOfType(OsmBoardingLocationVertex.class); assertEquals(5, boardingLocations.size()); // 3 nodes connected to the street network, plus one "floating" and one area centroid created by the module diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java index 06b10575ef9..f9957a09b95 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java @@ -7,7 +7,7 @@ import static org.opentripplanner._support.geometry.Coordinates.KONGSBERG_PLATFORM_1; import static org.opentripplanner.street.model.StreetTraversalPermission.CAR; import static org.opentripplanner.street.model.StreetTraversalPermission.PEDESTRIAN; -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; @@ -21,11 +21,11 @@ import org.opentripplanner.street.model.edge.StreetTransitStopLink; import org.opentripplanner.street.model.vertex.SplitterVertex; import org.opentripplanner.street.model.vertex.TransitStopVertex; -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.RegularStop; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class StreetLinkerModuleTest { @@ -67,7 +67,7 @@ void linkRegularStop() { void linkFlexStop() { OTPFeature.FlexRouting.testOn(() -> { var model = new TestModel(); - var flexTrip = TransitModelForTest.of().unscheduledTrip("flex", model.stop()); + var flexTrip = TimetableRepositoryForTest.of().unscheduledTrip("flex", model.stop()); model.withFlexTrip(flexTrip); var module = model.streetLinkerModule(); @@ -97,7 +97,7 @@ private static class TestModel { private final TransitStopVertex stopVertex; private final StreetLinkerModule module; private final RegularStop stop; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; public TestModel() { var from = StreetModelForTest.intersectionVertex( @@ -123,13 +123,13 @@ public TestModel() { .build(); builder.withRegularStop(stop); - transitModel = new TransitModel(builder.build(), new Deduplicator()); + timetableRepository = new TimetableRepository(builder.build(), new Deduplicator()); stopVertex = TransitStopVertex.of().withStop(stop).build(); graph.addVertex(stopVertex); graph.hasStreets = true; - module = new StreetLinkerModule(graph, transitModel, DataImportIssueStore.NOOP, false); + module = new StreetLinkerModule(graph, timetableRepository, DataImportIssueStore.NOOP, false); assertFalse(stopVertex.isConnectedToGraph()); assertTrue(stopVertex.getIncoming().isEmpty()); @@ -153,7 +153,7 @@ public RegularStop stop() { } public void withFlexTrip(UnscheduledTrip flexTrip) { - transitModel.addFlexTrip(flexTrip.getId(), flexTrip); + timetableRepository.addFlexTrip(flexTrip.getId(), flexTrip); } } } diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java b/application/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java index 38680c357c4..49627c6231d 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/TestStreetLinkerModule.java @@ -2,12 +2,12 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TestStreetLinkerModule { /** For test only */ - public static void link(Graph graph, TransitModel model) { + public static void link(Graph graph, TimetableRepository model) { new StreetLinkerModule(graph, model, DataImportIssueStore.NOOP, false).buildGraph(); } } diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java index 23f4ffc72ca..d7f75f530d1 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/VehicleParkingLinkingTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -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.BeforeEach; @@ -18,12 +18,12 @@ import org.opentripplanner.street.model.vertex.IntersectionVertex; import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; import org.opentripplanner.street.model.vertex.VertexFactory; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class VehicleParkingLinkingTest { private Graph graph; - private TransitModel transitModel; + private TimetableRepository timetableRepository; private IntersectionVertex A; private IntersectionVertex B; @@ -36,7 +36,7 @@ public void setup() { VehicleParkingTestGraphData graphData = new VehicleParkingTestGraphData(); graphData.initGraph(); graph = graphData.getGraph(); - transitModel = graphData.getTransitModel(); + timetableRepository = graphData.getTimetableRepository(); A = graphData.getAVertex(); B = graphData.getBVertex(); vertexFactory = new VertexFactory(graph); @@ -53,7 +53,7 @@ public void entranceWithVertexLinkingTest() { .build(); var parkingVertex = vertexFactory.vehicleParkingEntrance(parking); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); assertEquals(1, parkingVertex.getOutgoing().size()); parkingVertex.getOutgoing().forEach(e -> assertEquals(e.getToVertex(), A)); @@ -76,7 +76,7 @@ public void entranceWithoutVertexLinkingTest() { .build(); var parkingVertex = vertexFactory.vehicleParkingEntrance(parking.getEntrances().get(0)); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); var streetLinks = graph.getEdgesOfType(StreetVehicleParkingLink.class); assertEquals(2, streetLinks.size()); @@ -110,7 +110,7 @@ public void carParkingEntranceToAllTraversableStreetLinkingTest() { .build(); var parkingVertex = vertexFactory.vehicleParkingEntrance(parking.getEntrances().get(0)); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); var streetLinks = graph.getEdgesOfType(StreetVehicleParkingLink.class); assertEquals(4, streetLinks.size()); @@ -145,7 +145,7 @@ public void removeEntranceWithNonExistingVertexTest() { graph.remove(A); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); assertEquals(1, vehicleParking.getEntrances().size()); @@ -175,7 +175,7 @@ public void removeVehicleParkingWithOneEntranceAndNonExistingVertexTest() { graph.remove(A); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); assertEquals(0, graph.getVerticesOfType(VehicleParkingEntranceVertex.class).size()); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java index 9157f8433b8..4f9a837ef6c 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModuleTest.java @@ -7,12 +7,12 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.model.vertex.VertexLabel; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; class CalculateWorldEnvelopeModuleTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final List vertexes = List.of(new V(10d, 12d), new V(11d, 13d), new V(14d, 15d)); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java index 72d9f817bd8..bb15be82d9e 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java @@ -7,7 +7,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class IslandPruningUtils { @@ -21,20 +21,20 @@ static Graph buildOsmGraph( try { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); // Add street data from OSM OsmProvider osmProvider = new OsmProvider(osmFile, true); OsmModule osmModule = OsmModule.of(osmProvider, graph).withEdgeNamer(new TestNamer()).build(); osmModule.buildGraph(); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); // Prune floating islands and set noThru where necessary PruneIslands pruneIslands = new PruneIslands( graph, - transitModel, + timetableRepository, DataImportIssueStore.NOOP, null ); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java index f069a518fc0..2085e7a238a 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/SubgraphOnlyFerryTest.java @@ -6,13 +6,13 @@ import java.util.Set; import org.junit.jupiter.api.Test; import org.opentripplanner.street.model.vertex.TransitStopVertex; -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.site.RegularStop; class SubgraphOnlyFerryTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop regularStop1 = TEST_MODEL.stop("TEST-1").build(); private static final RegularStop regularStop2 = TEST_MODEL.stop("TEST-2").build(); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java index a51095163fc..adef7774936 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java @@ -33,7 +33,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class LinkingTest { @@ -114,16 +114,16 @@ public void testStopsLinkedIdentically() { // build the graph without the added stops TestOtpModel model = buildGraphNoTransit(); Graph g1 = model.graph(); - TransitModel transitModel1 = model.transitModel(); + TimetableRepository timetableRepository1 = model.timetableRepository(); addRegularStopGrid(g1); - link(g1, transitModel1); + link(g1, timetableRepository1); TestOtpModel model2 = buildGraphNoTransit(); Graph g2 = model2.graph(); - TransitModel transitModel2 = model2.transitModel(); + TimetableRepository timetableRepository2 = model2.timetableRepository(); addExtraStops(g2); addRegularStopGrid(g2); - link(g2, transitModel2); + link(g2, timetableRepository2); var transitStopVertices = g1.getVerticesOfType(TransitStopVertex.class); assertEquals(1350, transitStopVertices.size()); @@ -152,7 +152,7 @@ public static TestOtpModel buildGraphNoTransit() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var gg = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); File file = ResourceLoader.of(LinkingTest.class).file("columbus.osm.pbf"); OsmProvider provider = new OsmProvider(file, false); @@ -160,7 +160,7 @@ public static TestOtpModel buildGraphNoTransit() { OsmModule osmModule = OsmModule.of(provider, gg).build(); osmModule.buildGraph(); - return new TestOtpModel(gg, transitModel); + return new TestOtpModel(gg, timetableRepository); } private static List outgoingStls(final TransitStopVertex tsv) { diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java index a45b8eef239..4c8b6a176d3 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java @@ -8,9 +8,9 @@ import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Get graphs of Columbus Ohio with real OSM streets and a synthetic transit system for use in @@ -18,7 +18,7 @@ */ class TestGraph { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); /** Add a regular grid of stops to the graph */ public static void addRegularStopGrid(Graph graph) { @@ -60,9 +60,9 @@ public static void addExtraStops(Graph graph) { } /** link the stops in the graph */ - public static void link(Graph graph, TransitModel transitModel) { - transitModel.index(); - graph.index(transitModel.getStopModel()); + public static void link(Graph graph, TimetableRepository timetableRepository) { + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); VertexLinker linker = graph.getLinker(); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java index be1666824f3..75c56dd2fb3 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java @@ -20,7 +20,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class UnconnectedAreasTest { @@ -159,7 +159,7 @@ private Graph buildOsmGraph(String osmFileName, DataImportIssueStore issueStore) var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); OsmProvider provider = new OsmProvider(RESOURCE_LOADER.file(osmFileName), false); OsmModule loader = OsmModule .of(provider, graph) @@ -171,7 +171,7 @@ private Graph buildOsmGraph(String osmFileName, DataImportIssueStore issueStore) loader.buildGraph(); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); return graph; } diff --git a/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java index 74819deabc2..8b91e3c3d08 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java @@ -1,6 +1,6 @@ package org.opentripplanner.gtfs; -import static org.opentripplanner.transit.model._data.TransitModelForTest.trip; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.trip; import java.util.Collection; import java.util.List; @@ -19,7 +19,7 @@ import org.opentripplanner.graph_builder.module.geometry.GeometryProcessor; import org.opentripplanner.model.StopTime; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; -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; @@ -50,12 +50,12 @@ class GenerateTripPatternsOperationTest { @BeforeAll static void setupClass() { - TransitModelForTest transitModelForTest = TransitModelForTest.of(); - stopA = transitModelForTest.stop("stopA").build(); - stopB = transitModelForTest.stop("stopB").build(); - stopC = transitModelForTest.stop("stopC").build(); + TimetableRepositoryForTest timetableRepositoryForTest = TimetableRepositoryForTest.of(); + stopA = timetableRepositoryForTest.stop("stopA").build(); + stopB = timetableRepositoryForTest.stop("stopB").build(); + stopC = timetableRepositoryForTest.stop("stopC").build(); stopModel = - transitModelForTest + timetableRepositoryForTest .stopModelBuilder() .withRegularStop(stopA) .withRegularStop(stopB) @@ -69,7 +69,7 @@ static void setupClass() { stopTimeC = new StopTime(); stopTimeC.setStop(stopC); - FeedScopedId serviceId1 = TransitModelForTest.id("SERVICE_ID_1"); + FeedScopedId serviceId1 = TimetableRepositoryForTest.id("SERVICE_ID_1"); trip1 = trip("TRIP_ID_1") .withServiceId(serviceId1) @@ -79,7 +79,7 @@ static void setupClass() { .build(); // same route, mode, submode and direction as trip1 - FeedScopedId serviceId2 = TransitModelForTest.id("SERVICE_ID_2"); + FeedScopedId serviceId2 = TimetableRepositoryForTest.id("SERVICE_ID_2"); trip2 = trip("TRIP_ID_2") .withServiceId(serviceId2) @@ -90,7 +90,7 @@ static void setupClass() { .build(); // same route, direction as trip1, different mode - FeedScopedId serviceId3 = TransitModelForTest.id("SERVICE_ID_3"); + FeedScopedId serviceId3 = TimetableRepositoryForTest.id("SERVICE_ID_3"); trip3 = trip("TRIP_ID_3") .withServiceId(serviceId3) @@ -100,7 +100,7 @@ static void setupClass() { .build(); // same route, mode, direction as trip1, different submode - FeedScopedId serviceId4 = TransitModelForTest.id("SERVICE_ID_4"); + FeedScopedId serviceId4 = TimetableRepositoryForTest.id("SERVICE_ID_4"); trip4 = trip("TRIP_ID_4") .withServiceId(serviceId4) @@ -111,7 +111,7 @@ static void setupClass() { .build(); // same route, mode as trip1, different direction - FeedScopedId serviceId5 = TransitModelForTest.id("SERVICE_ID_5"); + FeedScopedId serviceId5 = TimetableRepositoryForTest.id("SERVICE_ID_5"); trip5 = trip("TRIP_ID_5") .withServiceId(serviceId5) diff --git a/application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java b/application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java index e14a33cd276..1fd24f17f3b 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/interlining/InterlineProcessorTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.transfer.DefaultTransferService; -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.framework.FeedScopedId; import org.opentripplanner.transit.model.network.StopPattern; @@ -25,7 +25,7 @@ class InterlineProcessorTest implements PlanTestConstants { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); List patterns = List.of( tripPattern("trip-1", "block-1", "service-1"), @@ -150,7 +150,7 @@ void staySeatedNotAllowed() { } private static TripPattern tripPattern(String tripId, String blockId, String serviceId) { - var trip = TransitModelForTest + var trip = TimetableRepositoryForTest .trip(tripId) .withGtfsBlockId(blockId) .withServiceId(new FeedScopedId("1", serviceId)) @@ -165,7 +165,7 @@ private static TripPattern tripPattern(String tripId, String blockId, String ser var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); return TripPattern - .of(TransitModelForTest.id(tripId)) + .of(TimetableRepositoryForTest.id(tripId)) .withRoute(trip.getRoute()) .withStopPattern(stopPattern) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java index c37df887927..e0390fee6b2 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/AgencyMapperTest.java @@ -11,7 +11,7 @@ import java.util.Collections; import org.junit.jupiter.api.Test; import org.onebusaway.gtfs.model.Agency; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class AgencyMapperTest { @@ -32,7 +32,7 @@ public class AgencyMapperTest { private static final String FARE_URL = "www.url.com/fare"; private static final String BRANDING_URL = "www.url.com/brand"; - private final AgencyMapper subject = new AgencyMapper(TransitModelForTest.FEED_ID); + private final AgencyMapper subject = new AgencyMapper(TimetableRepositoryForTest.FEED_ID); static { AGENCY.setId(ID); @@ -58,7 +58,7 @@ public void testMap() throws Exception { result = subject.map(AGENCY); - assertEquals(TransitModelForTest.FEED_ID, result.getId().getFeedId()); + assertEquals(TimetableRepositoryForTest.FEED_ID, result.getId().getFeedId()); assertEquals(ID, result.getId().getId()); assertEquals(NAME, result.getName()); assertEquals(LANG, result.getLang()); diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java index 083db3bcb84..cb4ff3caaa3 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/BoardingAreaMapperTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test; import org.onebusaway.gtfs.model.AgencyAndId; import org.onebusaway.gtfs.model.Stop; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.BoardingArea; import org.opentripplanner.transit.model.site.RegularStop; @@ -40,7 +40,7 @@ public class BoardingAreaMapperTest { private static final int VEHICLE_TYPE = 5; private static final int WHEELCHAIR_BOARDING = 1; - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop PARENT_STOP = TEST_MODEL.stop(PARENT).build(); diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java index 01eeaa662fa..2119c7299d0 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/RouteMapperTest.java @@ -14,7 +14,7 @@ import org.onebusaway.gtfs.model.AgencyAndId; import org.onebusaway.gtfs.model.Route; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -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.network.BikeAccess; import org.opentripplanner.transit.model.organization.Branding; @@ -51,7 +51,7 @@ public class RouteMapperTest { private static final Route ROUTE = new Route(); private final RouteMapper subject = new RouteMapper( - new AgencyMapper(TransitModelForTest.FEED_ID), + new AgencyMapper(TimetableRepositoryForTest.FEED_ID), DataImportIssueStore.NOOP, new TranslationHelper() ); 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 1489cd87c13..6c874c7108f 100644 --- a/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java +++ b/application/src/test/java/org/opentripplanner/inspector/vector/VectorTileResponseFactoryTest.java @@ -11,13 +11,13 @@ import org.opentripplanner.inspector.vector.geofencing.GeofencingZonesLayerBuilder; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.standalone.api.OtpServerRequestContext; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class VectorTileResponseFactoryTest { public static final OtpServerRequestContext SERVER_CONTEXT = TestServerContext.createServerContext( new Graph(), - new TransitModel() + new TimetableRepository() ); enum LayerType { diff --git a/application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java b/application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java index 167bd2a2972..bcfd93513ce 100644 --- a/application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java +++ b/application/src/test/java/org/opentripplanner/model/ShapeGeometryTest.java @@ -6,17 +6,17 @@ import org.opentripplanner.ConstantsForTests; import org.opentripplanner.TestOtpModel; import org.opentripplanner.transit.model.network.TripPattern; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class ShapeGeometryTest { @Test public void useShapeGeometries() { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SHAPE_DIST_GTFS); - TransitModel transitModel = model.transitModel(); + TimetableRepository timetableRepository = model.timetableRepository(); // data includes 2 trips, of which one has incorrect shape_dist_traveled parametrization in stop_times - for (TripPattern pattern : transitModel.getAllTripPatterns()) { + for (TripPattern pattern : timetableRepository.getAllTripPatterns()) { // examine if shape extraction worked at first stop intervals, where dist parameter is wrong assertTrue(pattern.getHopGeometry(0).getCoordinates().length > 2); assertTrue(pattern.getHopGeometry(1).getCoordinates().length > 2); diff --git a/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java b/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java index ffdfc027b76..77f6f94266c 100644 --- a/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java +++ b/application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java @@ -26,7 +26,7 @@ import org.opentripplanner.transit.model.framework.Result; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.TripTimes; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.UpdateError; import org.opentripplanner.updater.trip.BackwardsDelayPropagationType; @@ -39,12 +39,12 @@ public class TimetableSnapshotTest { @BeforeAll public static void setUp() throws Exception { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - TransitModel transitModel = model.transitModel(); + TimetableRepository timetableRepository = model.timetableRepository(); - feedId = transitModel.getFeedIds().iterator().next(); + feedId = timetableRepository.getFeedIds().iterator().next(); patternIndex = new HashMap<>(); - for (TripPattern tripPattern : transitModel.getAllTripPatterns()) { + for (TripPattern tripPattern : timetableRepository.getAllTripPatterns()) { tripPattern .scheduledTripsAsStream() .forEach(trip -> patternIndex.put(trip.getId(), tripPattern)); diff --git a/application/src/test/java/org/opentripplanner/model/TimetableTest.java b/application/src/test/java/org/opentripplanner/model/TimetableTest.java index dca4d3e828d..a615041d7a1 100644 --- a/application/src/test/java/org/opentripplanner/model/TimetableTest.java +++ b/application/src/test/java/org/opentripplanner/model/TimetableTest.java @@ -32,7 +32,7 @@ import org.opentripplanner.transit.model.framework.Result; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeState; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.UpdateError; import org.opentripplanner.updater.trip.BackwardsDelayPropagationType; import org.opentripplanner.updater.trip.TripUpdateBuilder; @@ -51,12 +51,12 @@ public class TimetableTest { @BeforeAll public static void setUp() throws Exception { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - TransitModel transitModel = model.transitModel(); + TimetableRepository timetableRepository = model.timetableRepository(); - feedId = transitModel.getFeedIds().stream().findFirst().get(); + feedId = timetableRepository.getFeedIds().stream().findFirst().get(); patternIndex = new HashMap<>(); - for (TripPattern pattern : transitModel.getAllTripPatterns()) { + for (TripPattern pattern : timetableRepository.getAllTripPatterns()) { pattern.scheduledTripsAsStream().forEach(trip -> patternIndex.put(trip.getId(), pattern)); } diff --git a/application/src/test/java/org/opentripplanner/model/TripPatternTest.java b/application/src/test/java/org/opentripplanner/model/TripPatternTest.java index bad159eb3cd..f629902f3e1 100644 --- a/application/src/test/java/org/opentripplanner/model/TripPatternTest.java +++ b/application/src/test/java/org/opentripplanner/model/TripPatternTest.java @@ -8,7 +8,7 @@ import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; import org.opentripplanner.framework.geometry.GeometryUtils; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; @@ -28,7 +28,7 @@ public class TripPatternTest { */ @Test public void testSetHopGeometriesFromPattern() { - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); var stationOrigin = testModel.station("S1").withCoordinate(0.0, 0.0).build(); var stationDestination = testModel.station("S2").withCoordinate(1.0, 1.0).build(); var stopOrigin = testModel @@ -103,7 +103,7 @@ public TripPattern setupTripPattern( } var stopPattern = builder.build(); - var route = TransitModelForTest.route("R1").build(); + var route = TimetableRepositoryForTest.route("R1").build(); return TripPattern .of(new FeedScopedId("Test", "T1")) diff --git a/application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java b/application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java index 78002e46eae..97e34b134bf 100644 --- a/application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java +++ b/application/src/test/java/org/opentripplanner/model/TripTimeOnDateTest.java @@ -5,7 +5,7 @@ import java.time.LocalTime; import org.junit.jupiter.api.Test; 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.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.timetable.TripTimesFactory; @@ -14,9 +14,9 @@ class TripTimeOnDateTest implements PlanTestConstants { @Test void gtfsSequence() { - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); var pattern = testModel.pattern(TransitMode.BUS).build(); - var trip = TransitModelForTest.trip("123").build(); + var trip = TimetableRepositoryForTest.trip("123").build(); var stopTimes = testModel.stopTimesEvery5Minutes(3, trip, T11_00); var tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); diff --git a/application/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java b/application/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java index 135a3045c3c..9516ce03a32 100644 --- a/application/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java +++ b/application/src/test/java/org/opentripplanner/model/calendar/impl/CalendarServiceDataFactoryImplTest.java @@ -8,7 +8,7 @@ import static org.opentripplanner.gtfs.GtfsContextBuilder.contextBuilder; import static org.opentripplanner.model.calendar.ServiceCalendarDate.EXCEPTION_TYPE_REMOVE; import static org.opentripplanner.model.calendar.impl.CalendarServiceDataFactoryImpl.merge; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.io.IOException; import java.time.LocalDate; @@ -28,7 +28,7 @@ import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.calendar.ServiceCalendarDate; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; /** @@ -123,7 +123,7 @@ public void testServiceGetServiceDatesForServiceId() { private static GtfsContext createCtxBuilder() throws IOException { GtfsContextBuilder ctxBuilder = contextBuilder( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, ConstantsForTests.SIMPLE_GTFS ); OtpTransitServiceBuilder builder = ctxBuilder @@ -132,7 +132,7 @@ private static GtfsContext createCtxBuilder() throws IOException { // Supplement test data with at least one entity in all collections builder.getCalendarDates().add(removeMondayFromAlldays()); - builder.getFeedInfos().add(FeedInfo.dummyForTest(TransitModelForTest.FEED_ID)); + builder.getFeedInfos().add(FeedInfo.dummyForTest(TimetableRepositoryForTest.FEED_ID)); return ctxBuilder.build(); } diff --git a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java index 27e6e56c645..b37a0f55703 100644 --- a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.model.calendar.ServiceCalendar; import org.opentripplanner.model.calendar.ServiceCalendarDate; import org.opentripplanner.model.calendar.ServiceDateInterval; -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.framework.EntityById; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -45,12 +45,12 @@ public class OtpTransitServiceBuilderLimitPeriodTest { private static final LocalDate D1 = LocalDate.of(2020, 1, 8); private static final LocalDate D2 = LocalDate.of(2020, 1, 15); private static final LocalDate D3 = LocalDate.of(2020, 1, 31); - private static final FeedScopedId SERVICE_C_IN = TransitModelForTest.id("CalSrvIn"); - private static final FeedScopedId SERVICE_D_IN = TransitModelForTest.id("CalSrvDIn"); - private static final FeedScopedId SERVICE_C_OUT = TransitModelForTest.id("CalSrvOut"); - private static final FeedScopedId SERVICE_D_OUT = TransitModelForTest.id("CalSrvDOut"); + private static final FeedScopedId SERVICE_C_IN = TimetableRepositoryForTest.id("CalSrvIn"); + private static final FeedScopedId SERVICE_D_IN = TimetableRepositoryForTest.id("CalSrvDIn"); + private static final FeedScopedId SERVICE_C_OUT = TimetableRepositoryForTest.id("CalSrvOut"); + private static final FeedScopedId SERVICE_D_OUT = TimetableRepositoryForTest.id("CalSrvDOut"); private static final Deduplicator DEDUPLICATOR = new Deduplicator(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop STOP_1 = TEST_MODEL.stop("Stop-1").build(); private static final RegularStop STOP_2 = TEST_MODEL.stop("Stop-2").build(); private static final List STOP_TIMES = List.of( @@ -59,7 +59,7 @@ public class OtpTransitServiceBuilderLimitPeriodTest { ); private static final StopPattern STOP_PATTERN = new StopPattern(STOP_TIMES); private static int SEQ_NR = 0; - private final Route route = TransitModelForTest.route(newId().getId()).build(); + private final Route route = TimetableRepositoryForTest.route(newId().getId()).build(); private final Trip tripCSIn = createTrip("TCalIn", SERVICE_C_IN); private final Trip tripCSOut = createTrip("TCalOut", SERVICE_C_OUT); private final Trip tripCSDIn = createTrip("TDateIn", SERVICE_D_IN); @@ -192,11 +192,11 @@ private static StopTime createStopTime(RegularStop stop, int time) { } private static FeedScopedId newId() { - return TransitModelForTest.id(Integer.toString(++SEQ_NR)); + return TimetableRepositoryForTest.id(Integer.toString(++SEQ_NR)); } private TripPattern createTripPattern(Collection trips) { - FeedScopedId patternId = TransitModelForTest.id( + FeedScopedId patternId = TimetableRepositoryForTest.id( trips.stream().map(t -> t.getId().getId()).collect(Collectors.joining(":")) ); TripPatternBuilder tpb = TripPattern @@ -213,7 +213,7 @@ private TripPattern createTripPattern(Collection trips) { } private Trip createTrip(String id, FeedScopedId serviceId) { - return TransitModelForTest + return TimetableRepositoryForTest .trip(id) .withServiceId(serviceId) .withDirection(Direction.INBOUND) diff --git a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java index 9fd0bd4d8cb..d1c406d4ae1 100644 --- a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderTest.java @@ -17,15 +17,15 @@ import org.opentripplanner.model.ShapePoint; import org.opentripplanner.model.calendar.ServiceCalendar; import org.opentripplanner.model.calendar.ServiceCalendarDate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.organization.Agency; public class OtpTransitServiceBuilderTest { - private static final String FEED_ID = TransitModelForTest.FEED_ID; - private static final FeedScopedId SERVICE_WEEKDAYS_ID = TransitModelForTest.id("weekdays"); + private static final String FEED_ID = TimetableRepositoryForTest.FEED_ID; + private static final FeedScopedId SERVICE_WEEKDAYS_ID = TimetableRepositoryForTest.id("weekdays"); private static OtpTransitServiceBuilder subject; diff --git a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java index 9ecdbbeb451..48bff78273f 100644 --- a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java @@ -6,7 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.gtfs.GtfsContextBuilder.contextBuilder; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; import java.io.IOException; import java.util.ArrayList; @@ -20,7 +20,7 @@ import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.ShapePoint; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.Pathway; @@ -31,7 +31,7 @@ public class OtpTransitServiceImplTest { - private static final FeedScopedId STATION_ID = TransitModelForTest.id("station"); + private static final FeedScopedId STATION_ID = TimetableRepositoryForTest.id("station"); // The subject is used as read only; hence static is ok private static OtpTransitService subject; @@ -132,7 +132,7 @@ public void testGetAllTrips() { @Test public void testGetStopForId() { - RegularStop stop = subject.stopModel().getRegularStop(TransitModelForTest.id("P")); + RegularStop stop = subject.stopModel().getRegularStop(TimetableRepositoryForTest.id("P")); assertEquals("RegularStop{F:P P}", stop.toString()); } @@ -146,7 +146,9 @@ public void testGetStopsForStation() { @Test public void testGetShapePointsForShapeId() { - List shapePoints = subject.getShapePointsForShapeId(TransitModelForTest.id("5")); + List shapePoints = subject.getShapePointsForShapeId( + TimetableRepositoryForTest.id("5") + ); assertEquals( "[#1 (41,-72), #2 (41,-72), #3 (40,-72), #4 (41,-73), #5 (41,-74)]", shapePoints.stream().map(OtpTransitServiceImplTest::toString).toList().toString() diff --git a/application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java b/application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java index 1372af0f405..58bb8d84ba0 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ItineraryTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.framework.model.TimeAndCost; import org.opentripplanner.model.SystemNotice; 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; public class ItineraryTest implements PlanTestConstants { @@ -65,7 +65,7 @@ void testDerivedFieldsWithBusAllTheWay() { assertEquals(newTime(T11_00), result.firstLeg().getStartTime()); assertEquals(newTime(T11_10), result.firstLeg().getEndTime()); assertEquals(TransitMode.BUS, result.getTransitLeg(0).getMode()); - assertEquals(TransitModelForTest.id("55"), result.firstLeg().getTrip().getId()); + assertEquals(TimetableRepositoryForTest.id("55"), result.firstLeg().getTrip().getId()); assertEquals(7500, result.firstLeg().getDistanceMeters(), 1E-3); assertEquals("A ~ BUS 55 11:00 11:10 ~ B [C₁720]", result.toStr()); @@ -89,7 +89,7 @@ void testDerivedFieldsWithTrainAllTheWay() { assertEquals(newTime(T11_05), result.firstLeg().getStartTime()); assertEquals(newTime(T11_15), result.firstLeg().getEndTime()); assertEquals(TransitMode.RAIL, result.getTransitLeg(0).getMode()); - assertEquals(TransitModelForTest.id("20"), result.firstLeg().getTrip().getId()); + assertEquals(TimetableRepositoryForTest.id("20"), result.firstLeg().getTrip().getId()); assertEquals(15_000, result.firstLeg().getDistanceMeters(), 1E-3); assertEquals("A ~ RAIL R2 11:05 11:15 ~ B [C₁720]", result.toStr()); diff --git a/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java b/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java index 95d7cf629a2..3062d71facd 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.street.model.vertex.SimpleVertex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.service.StopModel; @@ -51,7 +51,7 @@ public void sameLocationBasedOnCoordinates() { @Test public void sameLocationBasedOnStopId() { - var testModel = TransitModelForTest.of(); + var testModel = TimetableRepositoryForTest.of(); var s1 = testModel.stop("1").withCoordinate(1.0, 1.0).build(); var s2 = testModel.stop("2").withCoordinate(1.0, 2.0).build(); diff --git a/application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java b/application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java index edb967b5b16..e5ec76af8af 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java +++ b/application/src/test/java/org/opentripplanner/model/plan/PlanTestConstants.java @@ -3,7 +3,7 @@ import static org.opentripplanner.framework.time.TimeUtils.time; import org.opentripplanner.framework.time.DurationUtils; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public interface PlanTestConstants { int NOT_SET = -999_999; @@ -55,55 +55,55 @@ public interface PlanTestConstants { int T11_55 = time("11:55"); /** - * @deprecated Create the TransitModelForTest per test, do not share between tests - it has state + * @deprecated Create the TimetableRepositoryForTest per test, do not share between tests - it has state */ @Deprecated - TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place A = Place.forStop(TEST_MODEL.stop("A").withCoordinate(5.0, 8.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place B = Place.forStop(TEST_MODEL.stop("B").withCoordinate(6.0, 8.5).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place C = Place.forStop(TEST_MODEL.stop("C").withCoordinate(7.0, 9.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place D = Place.forStop(TEST_MODEL.stop("D").withCoordinate(8.0, 9.5).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place E = Place.forStop(TEST_MODEL.stop("E").withCoordinate(9.0, 10.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place F = Place.forStop(TEST_MODEL.stop("F").withCoordinate(9.0, 10.5).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place G = Place.forStop(TEST_MODEL.stop("G").withCoordinate(9.5, 11.0).build()); /** - * @deprecated Depend on TransitModelForTest. Create per test, do not share between tests - it has state + * @deprecated Depend on TimetableRepositoryForTest. Create per test, do not share between tests - it has state */ @Deprecated Place H = Place.forStop(TEST_MODEL.stop("H").withCoordinate(10.0, 11.5).build()); diff --git a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java index 4b26ccb1c55..8d3d6ed7c1e 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegBuilderTest.java @@ -5,14 +5,14 @@ import java.time.LocalDate; import org.junit.jupiter.api.Test; import org.opentripplanner._support.time.ZoneIds; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; class ScheduledTransitLegBuilderTest { @Test void transferZoneId() { - var pattern = TransitModelForTest.of().pattern(TransitMode.BUS).build(); + var pattern = TimetableRepositoryForTest.of().pattern(TransitMode.BUS).build(); var leg = new ScheduledTransitLegBuilder<>() .withZoneId(ZoneIds.BERLIN) .withServiceDate(LocalDate.of(2023, 11, 15)) diff --git a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java index b41ace81e8d..89eb13c56af 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/ScheduledTransitLegTest.java @@ -3,14 +3,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -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; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner._support.time.ZoneIds; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; @@ -22,13 +22,13 @@ class ScheduledTransitLegTest { static final ZonedDateTime TIME = OffsetDateTime .parse("2023-04-17T17:49:06+02:00") .toZonedDateTime(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); - private static final Route ROUTE = TransitModelForTest.route(id("2")).build(); - private static final TripPattern PATTERN = TransitModelForTest + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); + private static final Route ROUTE = TimetableRepositoryForTest.route(id("2")).build(); + private static final TripPattern PATTERN = TimetableRepositoryForTest .tripPattern("1", ROUTE) .withStopPattern(TEST_MODEL.stopPattern(3)) .build(); - private static final Trip TRIP = TransitModelForTest.trip("trip1").build(); + private static final Trip TRIP = TimetableRepositoryForTest.trip("trip1").build(); private static final ScheduledTripTimes TRIP_TIMES = ScheduledTripTimes .of() .withArrivalTimes("10:00 11:00 12:00") diff --git a/application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java b/application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java index 7b963ae8ee6..d23759907c2 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java +++ b/application/src/test/java/org/opentripplanner/model/plan/TestItineraryBuilder.java @@ -4,9 +4,9 @@ import static org.opentripplanner.street.search.TraverseMode.BICYCLE; import static org.opentripplanner.street.search.TraverseMode.CAR; import static org.opentripplanner.street.search.TraverseMode.WALK; -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.TransitModelForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; import java.time.Duration; import java.time.LocalDate; @@ -29,7 +29,7 @@ import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.street.model._data.StreetModelForTest; 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.Money; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; @@ -440,7 +440,7 @@ public Itinerary build() { /** Create a dummy trip */ private static Trip trip(String id, Route route) { - return TransitModelForTest + return TimetableRepositoryForTest .trip(id) .withRoute(route) .withHeadsign(I18NString.of("Trip headsign %s".formatted(id))) diff --git a/application/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java b/application/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java index 2d7df788ad3..d0d17cc95ab 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/legreference/LegReferenceSerializerTest.java @@ -6,18 +6,18 @@ import java.time.LocalDate; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; class LegReferenceSerializerTest { - private static final FeedScopedId TRIP_ID = TransitModelForTest.id("Trip"); + private static final FeedScopedId TRIP_ID = TimetableRepositoryForTest.id("Trip"); private static final LocalDate SERVICE_DATE = LocalDate.of(2022, 1, 31); private static final int FROM_STOP_POS = 1; - private static final FeedScopedId FROM_STOP_ID = TransitModelForTest.id("Boarding Stop"); + private static final FeedScopedId FROM_STOP_ID = TimetableRepositoryForTest.id("Boarding Stop"); private static final int TO_STOP_POS = 3; - private static final FeedScopedId TO_STOP_ID = TransitModelForTest.id("Alighting Stop"); + private static final FeedScopedId TO_STOP_ID = TimetableRepositoryForTest.id("Alighting Stop"); /** * Token based on the initial format, without stop ids. diff --git a/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java b/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java index 277f65cfcae..d663e7bed2f 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.LocalDate; import java.util.List; @@ -14,7 +14,7 @@ import org.opentripplanner.model.calendar.CalendarServiceData; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.ScheduledTransitLeg; -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.framework.FeedScopedId; import org.opentripplanner.transit.model.network.TripPattern; @@ -25,12 +25,12 @@ import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; class ScheduledTransitLegReferenceTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final int SERVICE_CODE = 555; private static final LocalDate SERVICE_DATE = LocalDate.of(2023, 1, 1); private static final int NUMBER_OF_STOPS = 3; @@ -53,16 +53,16 @@ static void buildTransitService() { stop4 = TEST_MODEL.stop("STOP4", 0, 0).withParentStation(parentStation).build(); // build transit data - Trip trip = TransitModelForTest.trip("1").build(); + Trip trip = TimetableRepositoryForTest.trip("1").build(); var tripTimes = TripTimesFactory.tripTimes( trip, TEST_MODEL.stopTimesEvery5Minutes(5, trip, PlanTestConstants.T11_00), new Deduplicator() ); tripTimes.setServiceCode(SERVICE_CODE); - TripPattern tripPattern = TransitModelForTest - .tripPattern("1", TransitModelForTest.route(id("1")).build()) - .withStopPattern(TransitModelForTest.stopPattern(stop1, stop2, stop3)) + TripPattern tripPattern = TimetableRepositoryForTest + .tripPattern("1", TimetableRepositoryForTest.route(id("1")).build()) + .withStopPattern(TimetableRepositoryForTest.stopPattern(stop1, stop2, stop3)) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); @@ -79,14 +79,21 @@ static void buildTransitService() { .withRegularStop(stop3) .withRegularStop(stop4) .build(); - TransitModel transitModel = new TransitModel(stopModel, new Deduplicator()); - transitModel.addTripPattern(tripPattern.getId(), tripPattern); - transitModel.getServiceCodes().put(tripPattern.getId(), SERVICE_CODE); + TimetableRepository timetableRepository = new TimetableRepository( + stopModel, + new Deduplicator() + ); + timetableRepository.addTripPattern(tripPattern.getId(), tripPattern); + timetableRepository.getServiceCodes().put(tripPattern.getId(), SERVICE_CODE); CalendarServiceData calendarServiceData = new CalendarServiceData(); calendarServiceData.putServiceDatesForServiceId(tripPattern.getId(), List.of(SERVICE_DATE)); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); - transitModel.addTripOnServiceDate( + timetableRepository.addTripOnServiceDate( TripOnServiceDate .of(TRIP_ON_SERVICE_DATE_ID) .withTrip(trip) @@ -94,10 +101,10 @@ static void buildTransitService() { .build() ); - transitModel.index(); + timetableRepository.index(); // build transit service - transitService = new DefaultTransitService(transitModel); + transitService = new DefaultTransitService(timetableRepository); } @Test @@ -170,7 +177,7 @@ void getLegFromReferenceMismatchOnBoardingStop() { SERVICE_DATE, 0, 1, - TransitModelForTest.id("invalid stop id"), + TimetableRepositoryForTest.id("invalid stop id"), stopIdAtPosition1, null ); @@ -219,7 +226,7 @@ void legReferenceCannotReferToBothTripAndTripOnServiceDate() { NUMBER_OF_STOPS, stopIdAtPosition0, stopIdAtPosition1, - TransitModelForTest.id("trip on date id") + TimetableRepositoryForTest.id("trip on date id") ) ); } @@ -247,7 +254,7 @@ void getLegFromReferenceWithUnknownTripOnDate() { NUMBER_OF_STOPS, stopIdAtPosition0, stopIdAtPosition1, - TransitModelForTest.id("unknown trip on date id") + TimetableRepositoryForTest.id("unknown trip on date id") ); assertNull(scheduledTransitLegReference.getLeg(transitService)); } diff --git a/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java b/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java index 10b59007c17..f9896c66d6a 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/paging/cursor/PageCursorTest.java @@ -27,11 +27,11 @@ import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.SortOrder; import org.opentripplanner.model.plan.TestItineraryBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class PageCursorTest implements PlanTestConstants { - public static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + public static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); public static final Place A = Place.forStop( TEST_MODEL.stop("A").withCoordinate(5.0, 8.0).build() ); diff --git a/application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java b/application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java index 19e0f82e8d5..6d70936657d 100644 --- a/application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java +++ b/application/src/test/java/org/opentripplanner/model/transfer/TransferTestData.java @@ -1,6 +1,6 @@ package org.opentripplanner.model.transfer; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; @@ -8,7 +8,7 @@ public class TransferTestData { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); static final Station STATION = TEST_MODEL.station("Central Station").build(); @@ -32,14 +32,14 @@ public class TransferTestData { .build(); static final RegularStop ANY_STOP = TEST_MODEL.stop("any", 60.0, 11.0).build(); - static final Route ROUTE_1 = TransitModelForTest.route("1").build(); - static final Route ROUTE_2 = TransitModelForTest.route("2").build(); - static final Route ANY_ROUTE = TransitModelForTest.route("ANY").build(); + static final Route ROUTE_1 = TimetableRepositoryForTest.route("1").build(); + static final Route ROUTE_2 = TimetableRepositoryForTest.route("2").build(); + static final Route ANY_ROUTE = TimetableRepositoryForTest.route("ANY").build(); - static final Trip TRIP_11 = TransitModelForTest.trip("11").withRoute(ROUTE_1).build(); - static final Trip TRIP_12 = TransitModelForTest.trip("12").withRoute(ROUTE_1).build(); - static final Trip TRIP_21 = TransitModelForTest.trip("21").withRoute(ROUTE_2).build(); - static final Trip ANY_TRIP = TransitModelForTest.trip("999").withRoute(ANY_ROUTE).build(); + static final Trip TRIP_11 = TimetableRepositoryForTest.trip("11").withRoute(ROUTE_1).build(); + static final Trip TRIP_12 = TimetableRepositoryForTest.trip("12").withRoute(ROUTE_1).build(); + static final Trip TRIP_21 = TimetableRepositoryForTest.trip("21").withRoute(ROUTE_2).build(); + static final Trip ANY_TRIP = TimetableRepositoryForTest.trip("999").withRoute(ANY_ROUTE).build(); static final TransferPoint STATION_POINT = new StationTransferPoint(STATION); diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java index 7529ae52a34..4721ef03bf3 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java @@ -17,7 +17,7 @@ import org.locationtech.jts.geom.Coordinate; import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; -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.site.AreaStop; import org.opentripplanner.transit.model.site.GroupStop; @@ -126,7 +126,7 @@ class FlexStopsMapperTest { .withValue("UnrestrictedPublicTransportAreas") ); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final StopModelBuilder stopModelBuilder = testModel.stopModelBuilder(); @Test diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java index 218942d29ef..47442ce5fe2 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/MultiModalStationMapperTest.java @@ -1,6 +1,7 @@ package org.opentripplanner.netex.mapping; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.util.List; import org.junit.jupiter.api.Test; @@ -8,7 +9,7 @@ import org.opentripplanner.graph_builder.issue.service.DefaultDataImportIssueStore; import org.opentripplanner.netex.NetexTestDataSupport; import org.opentripplanner.netex.mapping.support.FeedScopedIdFactory; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.rutebanken.netex.model.StopPlace; class MultiModalStationMapperTest { @@ -16,7 +17,9 @@ class MultiModalStationMapperTest { @Test void testMissingCoordinates() { DataImportIssueStore dataIssueStore = new DefaultDataImportIssueStore(); - FeedScopedIdFactory feedScopeIdFactory = new FeedScopedIdFactory(TransitModelForTest.FEED_ID); + FeedScopedIdFactory feedScopeIdFactory = new FeedScopedIdFactory( + TimetableRepositoryForTest.FEED_ID + ); MultiModalStationMapper multiModalStationMapper = new MultiModalStationMapper( dataIssueStore, feedScopeIdFactory diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java b/application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java index b72c9b05277..56c672c7ef8 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/NetexTestDataSample.java @@ -14,7 +14,7 @@ import java.util.List; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.framework.EntityById; import org.opentripplanner.transit.model.site.RegularStop; @@ -63,7 +63,7 @@ public class NetexTestDataSample { .withName(new MultilingualString().withValue("everyday")); private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final JourneyPattern journeyPattern; private final HierarchicalMapById journeyPatternById = new HierarchicalMapById<>(); @@ -89,7 +89,7 @@ public NetexTestDataSample() { JAXBElement lineRef = createWrappedRef(line.getId(), LineRefStructure.class); // Add OTP Route (correspond to Netex Line) - otpRouteByid.add(TransitModelForTest.route(line.getId()).build()); + otpRouteByid.add(TimetableRepositoryForTest.route(line.getId()).build()); // Add Netex Route (not the same as an OTP Route) String routeId = "RUT:Route:1"; diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java index 99fcc2cb0e8..09a806169ab 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/NoticeAssignmentMapperTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.StopTime; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.framework.EntityById; @@ -47,7 +47,7 @@ public void mapNoticeAssignment() { noticeAssignment.setNoticedObjectRef(new VersionOfObjectRefStructure().withRef(ROUTE_ID)); noticeAssignment.setNotice(NOTICE); - Route route = TransitModelForTest.route(ROUTE_ID).build(); + Route route = TimetableRepositoryForTest.route(ROUTE_ID).build(); EntityById routesById = new DefaultEntityById<>(); routesById.add(route); @@ -89,7 +89,7 @@ public void mapNoticeAssignmentOnStopPoint() { ) ); - var trip = TransitModelForTest.trip("1").build(); + var trip = TimetableRepositoryForTest.trip("1").build(); StopTime stopTime1 = createStopTime(1, trip); StopTime stopTime2 = createStopTime(2, trip); diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java index 665650d0389..955a3fec34a 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java @@ -15,7 +15,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; import org.opentripplanner.netex.index.NetexEntityIndex; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.network.BikeAccess; import org.opentripplanner.transit.model.network.GroupOfRoutes; @@ -102,7 +102,7 @@ void mapRouteWithAgencySpecified() { transitBuilder.getGroupsOfRoutesByRouteId(), transitBuilder.getGroupOfRouteById(), netexIndex.readOnlyView(), - TransitModelForTest.TIME_ZONE_ID, + TimetableRepositoryForTest.TIME_ZONE_ID, EMPTY_FERRY_WITHOUT_BICYCLE_IDS ); @@ -210,7 +210,7 @@ void mapRouteWithBranding() { ArrayListMultimap.create(), new DefaultEntityById<>(), netexIndex.readOnlyView(), - TransitModelForTest.TIME_ZONE_ID, + TimetableRepositoryForTest.TIME_ZONE_ID, EMPTY_FERRY_WITHOUT_BICYCLE_IDS ); @@ -246,7 +246,7 @@ void mapRouteWithGroupOfRoutes() { transitBuilder.getGroupsOfRoutesByRouteId(), transitBuilder.getGroupOfRouteById(), netexIndex.readOnlyView(), - TransitModelForTest.TIME_ZONE_ID, + TimetableRepositoryForTest.TIME_ZONE_ID, EMPTY_FERRY_WITHOUT_BICYCLE_IDS ); @@ -278,7 +278,7 @@ private Line createExampleFerry(String id) { } private Agency createAgency() { - return TransitModelForTest + return TimetableRepositoryForTest .agency("Ruter AS") .copy() .withId(MappingSupport.ID_FACTORY.createId(AUTHORITY_ID)) diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java index 54f38421b8d..1f1ade2aa66 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/StopTimesMapperTest.java @@ -17,7 +17,7 @@ import org.opentripplanner.model.StopTime; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DefaultEntityById; import org.opentripplanner.transit.model.timetable.Trip; import org.rutebanken.netex.model.StopPointInJourneyPattern; @@ -30,7 +30,7 @@ public class StopTimesMapperTest { private static final BigInteger TWO = BigInteger.valueOf(2); private static final LocalTime QUARTER_PAST_FIVE = LocalTime.of(5, 15); - public static final Trip TRIP = TransitModelForTest.trip("T1").build(); + public static final Trip TRIP = TimetableRepositoryForTest.trip("T1").build(); @Test public void testCalculateOtpTime() { diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java index ebb83d44709..a4684fdba8f 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java @@ -12,7 +12,7 @@ import org.opentripplanner.model.impl.OtpTransitServiceBuilder; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Trip; @@ -33,7 +33,7 @@ public class TripMapperTest { private static final String ROUTE_ID = "RUT:Route:1"; private static final String SERVICE_JOURNEY_ID = NetexTestDataSample.SERVICE_JOURNEY_ID; private static final String JOURNEY_PATTERN_ID = "RUT:JourneyPattern:1"; - private static final FeedScopedId SERVICE_ID = TransitModelForTest.id("S001"); + private static final FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("S001"); private static final DataImportIssueStore issueStore = DataImportIssueStore.NOOP; private static final JAXBElement LINE_REF = MappingSupport.createWrappedRef( @@ -50,7 +50,7 @@ public void mapTripWithWheelchairAccess() { var access = new AccessibilityAssessment(); var transitBuilder = new OtpTransitServiceBuilder(new StopModel(), issueStore); - transitBuilder.getRoutes().add(TransitModelForTest.route(ROUTE_ID).build()); + transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); TripMapper tripMapper = new TripMapper( ID_FACTORY, @@ -82,7 +82,7 @@ public void mapTrip() { new StopModel(), issueStore ); - transitBuilder.getRoutes().add(TransitModelForTest.route(ROUTE_ID).build()); + transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); TripMapper tripMapper = new TripMapper( ID_FACTORY, @@ -109,7 +109,7 @@ public void mapTripWithRouteRefViaJourneyPattern() { new StopModel(), issueStore ); - transitBuilder.getRoutes().add(TransitModelForTest.route(ROUTE_ID).build()); + transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); JourneyPattern journeyPattern = new JourneyPattern().withId(JOURNEY_PATTERN_ID); journeyPattern.setRouteRef(new RouteRefStructure().withRef(ROUTE_ID)); diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java index 95af8f623e5..3af2f41391d 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/TripPatternMapperTest.java @@ -13,7 +13,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.netex.index.hierarchy.HierarchicalMap; import org.opentripplanner.netex.index.hierarchy.HierarchicalMapById; -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.framework.DefaultEntityById; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -31,7 +31,7 @@ */ class TripPatternMapperTest { - private static final FeedScopedId SERVICE_ID = TransitModelForTest.id("S01"); + private static final FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("S01"); @Test void testMapTripPattern() { diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java index aff56902c07..042887aee7a 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/calendar/CalendarServiceBuilderTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -import static org.opentripplanner.transit.model._data.TransitModelForTest.FEED_ID; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.FEED_ID; import java.time.LocalDate; import java.util.Collection; @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.calendar.ServiceCalendarDate; import org.opentripplanner.netex.mapping.support.FeedScopedIdFactory; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; public class CalendarServiceBuilderTest { @@ -18,9 +18,9 @@ public class CalendarServiceBuilderTest { private static final LocalDate D1 = LocalDate.of(2020, 11, 1); private static final LocalDate D2 = LocalDate.of(2020, 11, 2); - private static final FeedScopedId EXP_SID_1 = TransitModelForTest.id("S000001"); - private static final FeedScopedId EXP_SID_2 = TransitModelForTest.id("S000002"); - private static final FeedScopedId EXP_SID_3 = TransitModelForTest.id("S000003"); + private static final FeedScopedId EXP_SID_1 = TimetableRepositoryForTest.id("S000001"); + private static final FeedScopedId EXP_SID_2 = TimetableRepositoryForTest.id("S000002"); + private static final FeedScopedId EXP_SID_3 = TimetableRepositoryForTest.id("S000003"); @Test public void addDatesForAGivenService() { @@ -64,8 +64,8 @@ public void createServiceCalendar() { @Test public void createServiceId() { CalendarServiceBuilder subject = new CalendarServiceBuilder(new FeedScopedIdFactory(FEED_ID)); - assertEquals(TransitModelForTest.id("S000001"), subject.createServiceId()); - assertEquals(TransitModelForTest.id("S000002"), subject.createServiceId()); + assertEquals(TimetableRepositoryForTest.id("S000001"), subject.createServiceId()); + assertEquals(TimetableRepositoryForTest.id("S000002"), subject.createServiceId()); } private void assertServiceDateExistInList( diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java index 41f2fb2ca12..4a7aac19e01 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java +++ b/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java @@ -19,7 +19,7 @@ import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.raptor.moduletests.support.ModuleTestDebugLogging; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; /** @@ -32,8 +32,8 @@ public class D03_UnpreferredRouteTest implements RaptorTestConstants { private static final String EXPECTED = "Walk 30s ~ A ~ BUS %s 0:01 0:02:40 ~ B ~ Walk 20s " + "[0:00:30 0:03 2m30s Tₓ0 C₁%d]"; - private static final FeedScopedId ROUTE_ID_1 = TransitModelForTest.id("1"); - private static final FeedScopedId ROUTE_ID_2 = TransitModelForTest.id("2"); + private static final FeedScopedId ROUTE_ID_1 = TimetableRepositoryForTest.id("1"); + private static final FeedScopedId ROUTE_ID_2 = TimetableRepositoryForTest.id("2"); private static final CostLinearFunction UNPREFERRED_C1 = CostLinearFunction.of("5m + 1t"); private final TestTransitData data = new TestTransitData(); private final RaptorRequestBuilder requestBuilder = new RaptorRequestBuilder<>(); @@ -45,11 +45,17 @@ public class D03_UnpreferredRouteTest implements RaptorTestConstants { public void setup() { // Given 2 identical routes R1 and R2 data.withRoute( - route(pattern("R1", STOP_A, STOP_B).withRoute(TransitModelForTest.route(ROUTE_ID_1).build())) + route( + pattern("R1", STOP_A, STOP_B) + .withRoute(TimetableRepositoryForTest.route(ROUTE_ID_1).build()) + ) .withTimetable(schedule("00:01, 00:02:40")) ); data.withRoute( - route(pattern("R2", STOP_A, STOP_B).withRoute(TransitModelForTest.route(ROUTE_ID_2).build())) + route( + pattern("R2", STOP_A, STOP_B) + .withRoute(TimetableRepositoryForTest.route(ROUTE_ID_2).build()) + ) .withTimetable(schedule("00:01, 00:02:40")) ); diff --git a/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java b/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java index 7b6db0a5acf..2411444db49 100644 --- a/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java +++ b/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java @@ -48,21 +48,21 @@ import org.opentripplanner.street.search.request.StreetSearchRequestBuilder; import org.opentripplanner.street.search.state.State; import org.opentripplanner.street.search.strategy.EuclideanRemainingWeightHeuristic; -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.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class TestHalfEdges { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private Graph graph; private StreetEdge top, bottom, left, right, leftBack, rightBack; private IntersectionVertex br, tr, bl, tl; private TransitStopVertex station1; private TransitStopVertex station2; - private TransitModel transitModel; + private TimetableRepository timetableRepository; @BeforeEach public void setUp() { @@ -162,7 +162,7 @@ public void setUp() { var s2 = testModel.stop("morx station", 40.0099999, -74.002).build(); stopModelBuilder.withRegularStop(s1).withRegularStop(s2); - transitModel = new TransitModel(stopModelBuilder.build(), deduplicator); + timetableRepository = new TimetableRepository(stopModelBuilder.build(), deduplicator); station1 = factory.transitStop(TransitStopVertex.of().withStop(s1)); station2 = factory.transitStop(TransitStopVertex.of().withStop(s2)); @@ -172,8 +172,8 @@ public void setUp() { //Linkers aren't run otherwise in testNetworkLinker graph.hasStreets = true; - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); } @Test @@ -595,7 +595,9 @@ public void testStreetSplittingAlerts() { @Test public void testStreetLocationFinder() { StreetIndex finder = graph.getStreetIndex(); - GraphFinder graphFinder = new DirectGraphFinder(transitModel.getStopModel()::findRegularStops); + GraphFinder graphFinder = new DirectGraphFinder( + timetableRepository.getStopModel()::findRegularStops + ); Set tempEdges = new HashSet<>(); // test that the local stop finder finds stops assertTrue(graphFinder.findClosestStops(new Coordinate(-74.005000001, 40.01), 100).size() > 0); @@ -674,7 +676,7 @@ public void testTemporaryVerticesContainer() { @Test public void testNetworkLinker() { int numVerticesBefore = graph.getVertices().size(); - TestStreetLinkerModule.link(graph, transitModel); + TestStreetLinkerModule.link(graph, timetableRepository); int numVerticesAfter = graph.getVertices().size(); assertEquals(4, numVerticesAfter - numVerticesBefore); Collection outgoing = station1.getOutgoing(); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java index de40617d3d3..958bf97d41a 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/FilterTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Collection; import java.util.List; @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.routing.api.request.request.filter.SelectRequest; import org.opentripplanner.routing.api.request.request.filter.TransitFilterRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.MainAndSubMode; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; @@ -27,17 +27,17 @@ public class FilterTest { static final String AGENCY_ID_2 = "RUT:Agency:2"; static final String AGENCY_ID_3 = "RUT:Agency:3"; - static final Agency AGENCY_1 = TransitModelForTest + static final Agency AGENCY_1 = TimetableRepositoryForTest .agency("A") .copy() .withId(id(AGENCY_ID_1)) .build(); - static final Agency AGENCY_2 = TransitModelForTest + static final Agency AGENCY_2 = TimetableRepositoryForTest .agency("B") .copy() .withId(id(AGENCY_ID_2)) .build(); - static final Agency AGENCY_3 = TransitModelForTest + static final Agency AGENCY_3 = TimetableRepositoryForTest .agency("C") .copy() .withId(id(AGENCY_ID_3)) @@ -53,7 +53,7 @@ public class FilterTest { static final String JOURNEY_PATTERN_ID_3 = "RUT:JourneyPattern:3"; static final String JOURNEY_PATTERN_ID_4 = "RUT:JourneyPattern:4"; - static final StopPattern STOP_PATTERN = TransitModelForTest.of().stopPattern(2); + static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.of().stopPattern(2); private static final SubMode LOCAL_BUS = SubMode.getOrBuildAndCacheForever("localBus"); private static final SubMode NIGHT_BUS = SubMode.getOrBuildAndCacheForever("nightBus"); @@ -61,10 +61,10 @@ public class FilterTest { final String GROUP_OF_Routes_ID_1 = "RUT:GroupOfLines:1"; final String GROUP_OF_Routes_ID_2 = "RUT:GroupOfLines:2"; - final GroupOfRoutes GROUP_OF_ROUTES_1 = TransitModelForTest + final GroupOfRoutes GROUP_OF_ROUTES_1 = TimetableRepositoryForTest .groupOfRoutes(GROUP_OF_Routes_ID_1) .build(); - final GroupOfRoutes GROUP_OF_ROUTES_2 = TransitModelForTest + final GroupOfRoutes GROUP_OF_ROUTES_2 = TimetableRepositoryForTest .groupOfRoutes(GROUP_OF_Routes_ID_2) .build(); @@ -83,20 +83,20 @@ public class FilterTest { """ ) public void testOne() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -129,20 +129,20 @@ public void testOne() { """ ) public void testTwo() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_3).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -174,34 +174,34 @@ public void testTwo() { """ ) public void testThree() { - Route route1 = TransitModelForTest + Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withAgency(AGENCY_1) .withMode(TransitMode.BUS) .withNetexSubmode("schoolBus") .build(); - Route route2 = TransitModelForTest + Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withAgency(AGENCY_2) .withMode(TransitMode.RAIL) .withNetexSubmode("railShuttle") .build(); - Route route3 = TransitModelForTest + Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withAgency(AGENCY_3) .withMode(TransitMode.TRAM) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -249,20 +249,20 @@ public void testThree() { """ ) public void testFour() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -302,15 +302,15 @@ public void testFour() { """ ) public void testFive() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build() @@ -347,20 +347,20 @@ public void testFive() { """ ) public void testSix() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_1).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_1).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_1).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_1).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -397,20 +397,20 @@ public void testSix() { """ ) public void testSeven() { - Route route1 = TransitModelForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); - Route route2 = TransitModelForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); - Route route3 = TransitModelForTest.route(ROUTE_ID_3).withAgency(AGENCY_2).build(); + Route route1 = TimetableRepositoryForTest.route(ROUTE_ID_1).withAgency(AGENCY_1).build(); + Route route2 = TimetableRepositoryForTest.route(ROUTE_ID_2).withAgency(AGENCY_2).build(); + Route route3 = TimetableRepositoryForTest.route(ROUTE_ID_3).withAgency(AGENCY_2).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -448,32 +448,32 @@ public void testSeven() { """ ) public void testEight() { - final Route route1 = TransitModelForTest + final Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); - final Route route2 = TransitModelForTest + final Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withMode(TransitMode.RAIL) .withAgency(AGENCY_1) .build(); - final Route route3 = TransitModelForTest + final Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withMode(TransitMode.BUS) .withAgency(AGENCY_2) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build() @@ -513,41 +513,41 @@ public void testEight() { """ ) public void testNine() { - Route route1 = TransitModelForTest + Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withAgency(AGENCY_1) .withMode(TransitMode.BUS) .build(); - Route route2 = TransitModelForTest + Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withAgency(AGENCY_1) .withMode(TransitMode.RAIL) .build(); - Route route3 = TransitModelForTest + Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withAgency(AGENCY_1) .withMode(TransitMode.BUS) .build(); - Route route4 = TransitModelForTest + Route route4 = TimetableRepositoryForTest .route(ROUTE_ID_4) .withAgency(AGENCY_2) .withMode(TransitMode.BUS) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_4, route4) .withStopPattern(STOP_PATTERN) .build() @@ -589,37 +589,37 @@ public void testNine() { """ ) public void testTen() { - final Route route1 = TransitModelForTest + final Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); - final Route route2 = TransitModelForTest + final Route route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withMode(TransitMode.RAIL) .withAgency(AGENCY_1) .build(); - final Route route3 = TransitModelForTest + final Route route3 = TimetableRepositoryForTest .route(ROUTE_ID_3) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); - final Route route4 = TransitModelForTest.route(ROUTE_ID_4).withAgency(AGENCY_2).build(); + final Route route4 = TimetableRepositoryForTest.route(ROUTE_ID_4).withAgency(AGENCY_2).build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_3, route3) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_4, route4) .withStopPattern(STOP_PATTERN) .build() @@ -646,19 +646,19 @@ public void testTen() { @Test void testDifferentSubModesInRoute() { - final Route route1 = TransitModelForTest + final Route route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withMode(TransitMode.BUS) .withAgency(AGENCY_1) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .withNetexSubmode(LOCAL_BUS) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route1) .withStopPattern(STOP_PATTERN) .withNetexSubmode(NIGHT_BUS) @@ -696,21 +696,21 @@ private static Collection bannedPatterns( @Test public void testGroupOfLinesSelectFunctionality() { - var route1 = TransitModelForTest + var route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_1)) .build(); - var route2 = TransitModelForTest + var route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_2)) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build() @@ -734,21 +734,21 @@ public void testGroupOfLinesSelectFunctionality() { @Test public void testGroupOfLinesExcludeFunctionality() { - var route1 = TransitModelForTest + var route1 = TimetableRepositoryForTest .route(ROUTE_ID_1) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_1)) .build(); - var route2 = TransitModelForTest + var route2 = TimetableRepositoryForTest .route(ROUTE_ID_2) .withGroupOfRoutes(List.of(GROUP_OF_ROUTES_2)) .build(); var patterns = List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_1, route1) .withStopPattern(STOP_PATTERN) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern(JOURNEY_PATTERN_ID_2, route2) .withStopPattern(STOP_PATTERN) .build() diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java index 4a09d140371..8108274c318 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java @@ -48,7 +48,7 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.street.model.vertex.VertexLabel; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; @@ -62,7 +62,7 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StationBuilder; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public abstract class GraphRoutingTest { @@ -71,21 +71,21 @@ public abstract class GraphRoutingTest { protected TestOtpModel modelOf(Builder builder) { builder.build(); Graph graph = builder.graph(); - TransitModel transitModel = builder.transitModel(); - return new TestOtpModel(graph, transitModel).index(); + TimetableRepository timetableRepository = builder.timetableRepository(); + return new TestOtpModel(graph, timetableRepository).index(); } public abstract static class Builder { private final Graph graph; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final VertexFactory vertexFactory; private final VehicleParkingHelper vehicleParkingHelper; protected Builder() { var deduplicator = new Deduplicator(); graph = new Graph(deduplicator); - transitModel = new TransitModel(new StopModel(), deduplicator); + timetableRepository = new TimetableRepository(new StopModel(), deduplicator); vertexFactory = new VertexFactory(graph); vehicleParkingHelper = new VehicleParkingHelper(graph); } @@ -96,8 +96,8 @@ public Graph graph() { return graph; } - public TransitModel transitModel() { - return transitModel; + public TimetableRepository timetableRepository() { + return timetableRepository; } public T v(VertexLabel label) { @@ -229,7 +229,7 @@ public List elevator(StreetTraversalPermission permission, Vertex. // -- Transit network (pathways, linking) public Entrance entranceEntity(String id, double latitude, double longitude) { return Entrance - .of(TransitModelForTest.id(id)) + .of(TimetableRepositoryForTest.id(id)) .withName(new NonLocalizedString(id)) .withCode(id) .withCoordinate(latitude, longitude) @@ -242,8 +242,8 @@ RegularStop stopEntity( double longitude, @Nullable Station parentStation ) { - var stopModelBuilder = transitModel.getStopModel().withContext(); - var testModel = new TransitModelForTest(stopModelBuilder); + var stopModelBuilder = timetableRepository.getStopModel().withContext(); + var testModel = new TimetableRepositoryForTest(stopModelBuilder); var stopBuilder = testModel.stop(id).withCoordinate(latitude, longitude); if (parentStation != null) { @@ -251,19 +251,19 @@ RegularStop stopEntity( } var stop = stopBuilder.build(); - transitModel.mergeStopModels(stopModelBuilder.withRegularStop(stop).build()); + timetableRepository.mergeStopModels(stopModelBuilder.withRegularStop(stop).build()); return stop; } public Station stationEntity(String id, Consumer stationBuilder) { - var stopModelBuilder = transitModel.getStopModel().withContext(); - var testModel = new TransitModelForTest(stopModelBuilder); + var stopModelBuilder = timetableRepository.getStopModel().withContext(); + var testModel = new TimetableRepositoryForTest(stopModelBuilder); var builder = testModel.station(id); stationBuilder.accept(builder); var station = builder.build(); - transitModel.mergeStopModels(stopModelBuilder.withStation(station).build()); + timetableRepository.mergeStopModels(stopModelBuilder.withStation(station).build()); return station; } @@ -454,7 +454,7 @@ public VehicleParking vehicleParking( ) { var vehicleParking = VehicleParking .builder() - .id(TransitModelForTest.id(id)) + .id(TimetableRepositoryForTest.id(id)) .coordinate(new WgsCoordinate(y, x)) .bicyclePlaces(bicyclePlaces) .carPlaces(carPlaces) @@ -477,7 +477,7 @@ public VehicleParking.VehicleParkingEntranceCreator vehicleParkingEntrance( ) { return builder -> builder - .entranceId(TransitModelForTest.id(id)) + .entranceId(TimetableRepositoryForTest.id(id)) .name(new NonLocalizedString(id)) .coordinate(new WgsCoordinate(streetVertex.getCoordinate())) .vertex(streetVertex) @@ -501,12 +501,12 @@ public List biLink( } public Route route(String id, TransitMode mode, Agency agency) { - return TransitModelForTest.route(id).withAgency(agency).withMode(mode).build(); + return TimetableRepositoryForTest.route(id).withAgency(agency).withMode(mode).build(); } // Transit public void tripPattern(TripPattern tripPattern) { - transitModel.addTripPattern(tripPattern.getId(), tripPattern); + timetableRepository.addTripPattern(tripPattern.getId(), tripPattern); } public StopTime st(TransitStopVertex s1) { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java index 1a098591288..1ee0ec9c481 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/StreetModeLinkingTest.java @@ -15,7 +15,7 @@ import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.search.TemporaryVerticesContainer; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; /** * This tests linking of GenericLocations to streets for each StreetMode. The test has 5 parallel @@ -77,7 +77,7 @@ public void build() { graph = otpModel.graph(); graph.hasStreets = true; - TestStreetLinkerModule.link(graph, otpModel.transitModel()); + TestStreetLinkerModule.link(graph, otpModel.timetableRepository()); } @Test @@ -110,8 +110,8 @@ public void testCarParkLinking() { assertLinking(setup.apply(47.501, 19.04), "E1E2 street", "D1D2 street", StreetMode.CAR_TO_PARK); assertLinking( rr -> { - rr.setFrom(new GenericLocation(null, TransitModelForTest.id("STOP"), null, null)); - rr.setTo(new GenericLocation(null, TransitModelForTest.id("STOP"), null, null)); + rr.setFrom(new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null)); + rr.setTo(new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null)); }, "E1E2 street", "D1D2 street", @@ -180,8 +180,8 @@ private void assertLinkedFromTo( private void assertLinkedFromTo(String stopId, String streetName, StreetMode... streetModes) { assertLinking( rr -> { - rr.setFrom(new GenericLocation(null, TransitModelForTest.id(stopId), null, null)); - rr.setTo(new GenericLocation(null, TransitModelForTest.id(stopId), null, null)); + rr.setFrom(new GenericLocation(null, TimetableRepositoryForTest.id(stopId), null, null)); + rr.setTo(new GenericLocation(null, TimetableRepositoryForTest.id(stopId), null, null)); }, streetName, streetName, diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java b/application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java index 075fceed4eb..07d9074c350 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/TestBanning.java @@ -2,14 +2,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Collection; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.api.request.request.filter.SelectRequest; import org.opentripplanner.routing.api.request.request.filter.TransitFilterRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -56,24 +56,32 @@ public void testSetWhiteListedOnRequest() { } private List getTestPatterns() { - Agency agency1 = TransitModelForTest.agency("A").copy().withId(id("RUT:Agency:1")).build(); - Agency agency2 = TransitModelForTest.agency("B").copy().withId(id("RUT:Agency:2")).build(); + Agency agency1 = TimetableRepositoryForTest + .agency("A") + .copy() + .withId(id("RUT:Agency:1")) + .build(); + Agency agency2 = TimetableRepositoryForTest + .agency("B") + .copy() + .withId(id("RUT:Agency:2")) + .build(); - Route route1 = TransitModelForTest.route("RUT:Route:1").withAgency(agency1).build(); - Route route2 = TransitModelForTest.route("RUT:Route:2").withAgency(agency1).build(); - Route route3 = TransitModelForTest.route("RUT:Route:3").withAgency(agency2).build(); + Route route1 = TimetableRepositoryForTest.route("RUT:Route:1").withAgency(agency1).build(); + Route route2 = TimetableRepositoryForTest.route("RUT:Route:2").withAgency(agency1).build(); + Route route3 = TimetableRepositoryForTest.route("RUT:Route:3").withAgency(agency2).build(); - final StopPattern stopPattern = TransitModelForTest.of().stopPattern(2); + final StopPattern stopPattern = TimetableRepositoryForTest.of().stopPattern(2); return List.of( - TransitModelForTest + TimetableRepositoryForTest .tripPattern("RUT:JourneyPattern:1", route1) .withStopPattern(stopPattern) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern("RUT:JourneyPattern:2", route2) .withStopPattern(stopPattern) .build(), - TransitModelForTest + TimetableRepositoryForTest .tripPattern("RUT:JourneyPattern:3", route3) .withStopPattern(stopPattern) .build() diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java index 2bf4afee7fb..1cd19823f17 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/ItineraryListFilterChainTest.java @@ -35,7 +35,7 @@ import org.opentripplanner.routing.api.response.RoutingError; import org.opentripplanner.routing.api.response.RoutingErrorCode; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; /** @@ -44,7 +44,7 @@ */ class ItineraryListFilterChainTest implements PlanTestConstants { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = Place.forStop(TEST_MODEL.stop("A").build()); private static final Place B = Place.forStop(TEST_MODEL.stop("B").build()); private static final Place C = Place.forStop(TEST_MODEL.stop("C").build()); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java index 751dcc7ad3c..713e72e344c 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/PagingFilterTest.java @@ -20,11 +20,11 @@ import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.model.plan.SortOrder; import org.opentripplanner.routing.algorithm.filterchain.framework.sort.SortOrderComparator; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class PagingFilterTest implements PlanTestConstants { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = TEST_MODEL.place("A", 10, 11); private static final Place B = TEST_MODEL.place("B", 10, 13); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java index 3626ada63b3..da55d884d5c 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/SingleCriteriaComparatorTest.java @@ -9,12 +9,12 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.grouppriority.DefaultTransitGroupPriorityCalculator; class SingleCriteriaComparatorTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final DefaultTransitGroupPriorityCalculator GROUP_PRIORITY_CALCULATOR = new DefaultTransitGroupPriorityCalculator(); private static final Place A = TEST_MODEL.place("A", 10, 11); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java index c8cd04212e5..ea8ed58ae3a 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/ItemTest.java @@ -9,11 +9,11 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class ItemTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = TEST_MODEL.place("A", 10, 11); private static final Place B = TEST_MODEL.place("B", 10, 11); private static final Itinerary ITINERARY = newItinerary(A).bus(1, 1, 2, B).build(); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java index d5f2323ad90..3a192853684 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/system/mcmax/McMaxLimitFilterTest.java @@ -11,12 +11,12 @@ import org.opentripplanner.model.plan.Itinerary; import org.opentripplanner.model.plan.Place; import org.opentripplanner.routing.algorithm.filterchain.filters.system.SingleCriteriaComparator; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.grouppriority.DefaultTransitGroupPriorityCalculator; class McMaxLimitFilterTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final DefaultTransitGroupPriorityCalculator GROUP_PRIORITY_CALCULATOR = new DefaultTransitGroupPriorityCalculator(); private static final Place A = TEST_MODEL.place("A", 10, 11); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java index 379eb207155..8c64d7231d8 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/filters/transit/TransitAlertFilterTest.java @@ -12,7 +12,7 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class TransitAlertFilterTest implements PlanTestConstants { @@ -20,7 +20,7 @@ class TransitAlertFilterTest implements PlanTestConstants { @Test void testFilter() { - var transitAlertService = new TransitAlertServiceImpl(new TransitModel()); + var transitAlertService = new TransitAlertServiceImpl(new TimetableRepository()); transitAlertService.setAlerts( List.of( TransitAlert diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java index 692f3a61ca7..7ee32b845f2 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupByAllSameStationsTest.java @@ -7,13 +7,13 @@ import org.junit.jupiter.api.Test; 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.site.RegularStopBuilder; import org.opentripplanner.transit.model.site.Station; class GroupByAllSameStationsTest implements PlanTestConstants { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); Station STATION_1 = testModel.station("1").build(); Station STATION_2 = testModel.station("2").build(); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java index 26d3ca1d04b..48772cb69e2 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/filterchain/framework/groupids/GroupBySameRoutesAndStopsTest.java @@ -8,13 +8,13 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.plan.Itinerary; 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.network.Route; class GroupBySameRoutesAndStopsTest implements PlanTestConstants { - Route routeA = TransitModelForTest.route("A").build(); - Route routeB = TransitModelForTest.route("B").build(); + Route routeA = TimetableRepositoryForTest.route("A").build(); + Route routeB = TimetableRepositoryForTest.route("B").build(); Itinerary i1 = newItinerary(A) .bus(routeA, 21, T11_06, T11_28, E) diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java index d10504978a4..d1940119655 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java @@ -58,7 +58,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.search.state.State; import org.opentripplanner.street.search.state.TestStateBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -66,11 +66,11 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.booking.RoutingBookingInfo; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class RaptorPathToItineraryMapperTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final int BOARD_COST_SEC = 60; private static final int TRANSFER_COST_SEC = 120; private static final double[] TRANSIT_RELUCTANCE = new double[] { 1.0 }; @@ -79,7 +79,7 @@ public class RaptorPathToItineraryMapperTest { private static final int TRANSIT_START = TimeUtils.time("10:00"); private static final int TRANSIT_END = TimeUtils.time("11:00"); - private static final Route ROUTE = TransitModelForTest.route("route").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("route").build(); public static final RaptorCostCalculator COST_CALCULATOR = new DefaultCostCalculator<>( BOARD_COST_SEC, @@ -294,11 +294,11 @@ private RaptorPathToItineraryMapper getRaptorPathToItineraryMa .of(2022, Month.OCTOBER, 10, 12, 0, 0) .atZone(ZoneIds.STOCKHOLM) .toInstant(); - TransitModel transitModel = new TransitModel(); - transitModel.initTimeZone(ZoneIds.CET); + TimetableRepository timetableRepository = new TimetableRepository(); + timetableRepository.initTimeZone(ZoneIds.CET); return new RaptorPathToItineraryMapper<>( new Graph(), - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), getTransitLayer(), dateTime.atZone(ZoneIds.CET), new RouteRequest() 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 8dbf5536ea2..98acfeeb7af 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 @@ -85,7 +85,8 @@ public static void loadGraphBeforeClass(boolean withElevation) { protected OtpServerRequestContext serverContext() { if (serverContext == null) { TestOtpModel model = getGraph(); - serverContext = TestServerContext.createServerContext(model.graph(), model.transitModel()); + serverContext = + TestServerContext.createServerContext(model.graph(), model.timetableRepository()); } return serverContext; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java index 58a56ccb96f..db41d9b5768 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayerTest.java @@ -10,7 +10,7 @@ import java.util.Map; import org.junit.jupiter.api.Test; import org.opentripplanner.model.StopTime; -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.network.RoutingTripPattern; import org.opentripplanner.transit.model.network.StopPattern; @@ -20,7 +20,7 @@ class TransitLayerTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final TripTimes TRIP_TIMES; private static final RoutingTripPattern TRIP_PATTERN; @@ -30,17 +30,17 @@ class TransitLayerTest { var stopTime = new StopTime(); stopTime.setStop(stop); var stopPattern = new StopPattern(List.of(stopTime)); - var route = TransitModelForTest.route("1").build(); + var route = TimetableRepositoryForTest.route("1").build(); TRIP_PATTERN = TripPattern - .of(TransitModelForTest.id("P1")) + .of(TimetableRepositoryForTest.id("P1")) .withRoute(route) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); TRIP_TIMES = TripTimesFactory.tripTimes( - TransitModelForTest.trip("1").withRoute(route).build(), + TimetableRepositoryForTest.trip("1").withRoute(route).build(), List.of(new StopTime()), new Deduplicator() ); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java index dd9a2fffa66..c7f76fc3377 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TripPatternForDateTest.java @@ -11,7 +11,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.model.Frequency; import org.opentripplanner.model.StopTime; -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.network.Route; import org.opentripplanner.transit.model.network.RoutingTripPattern; @@ -24,11 +24,11 @@ class TripPatternForDateTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop STOP = TEST_MODEL.stop("TEST:STOP", 0, 0).build(); - private static final Route ROUTE = TransitModelForTest.route("1").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("1").build(); private static final TripTimes tripTimes = TripTimesFactory.tripTimes( - TransitModelForTest.trip("1").withRoute(ROUTE).build(), + TimetableRepositoryForTest.trip("1").withRoute(ROUTE).build(), List.of(new StopTime()), new Deduplicator() ); @@ -46,7 +46,7 @@ void shouldExcludeAndIncludeBasedOnFrequency(List freqs) { stopTime.setStop(STOP); StopPattern stopPattern = new StopPattern(List.of(stopTime)); RoutingTripPattern tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) + .of(TimetableRepositoryForTest.id("P1")) .withRoute(ROUTE) .withStopPattern(stopPattern) .build() diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java index 214ea55eb3c..80ec5de7ed4 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/constrainedtransfer/ConstrainedBoardingSearchTest.java @@ -26,7 +26,7 @@ import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.TestRouteData; -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.FeedScopedId; import org.opentripplanner.transit.model.network.RoutingTripPattern; @@ -35,7 +35,7 @@ public class ConstrainedBoardingSearchTest { - private static final FeedScopedId ID = TransitModelForTest.id("ID"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("ID"); private static final TransferConstraint GUARANTEED_CONSTRAINT = TransferConstraint .of() .guaranteed() diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java index fb2a9bf04d0..1aaf3dcd8ef 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java @@ -4,8 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.transit.model._data.TransitModelForTest.agency; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.agency; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.Duration; import java.util.List; @@ -25,7 +25,7 @@ import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; import org.opentripplanner.test.support.TestTableParser; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.RouteBuilder; import org.opentripplanner.transit.model.organization.Agency; @@ -212,7 +212,7 @@ RouteRequest createRouteRequest() { } private static TestTripPattern pattern(boolean unpreferredRoute, boolean unpreferredAgency) { - RouteBuilder builder = TransitModelForTest.route( + RouteBuilder builder = TimetableRepositoryForTest.route( unpreferredRoute ? UNPREFERRED_ROUTE_ID : DEFAULT_ROUTE_ID ); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java index 35aa9e1d7a2..9f7458376cc 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java @@ -1,9 +1,9 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.agency; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; -import static org.opentripplanner.transit.model._data.TransitModelForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.agency; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java index 87e90e61b2e..a8e00056a3f 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java @@ -20,13 +20,13 @@ import org.opentripplanner.routing.api.request.framework.CostLinearFunction; import org.opentripplanner.routing.api.request.via.PassThroughViaLocation; import org.opentripplanner.routing.api.request.via.VisitViaLocation; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.StopLocation; class RaptorRequestMapperTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final StopLocation STOP_A = TEST_MODEL.stop("Stop:A").build(); private static final List ACCESS = List.of(TestAccessEgress.walk(12, 45)); private static final List EGRESS = List.of(TestAccessEgress.walk(144, 54)); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java index 9296ee2730c..1301eea3844 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java @@ -6,7 +6,7 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitTuningParameters; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StopLocation; @@ -15,7 +15,7 @@ class TransitLayerMapperTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final Station STATION_A = testModel .station("A") diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java index 3f41c1d29c7..2b0751c7456 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TripPatternForDateMapperTest.java @@ -15,14 +15,14 @@ import org.opentripplanner.model.Timetable; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; -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.timetable.TripTimes; import org.opentripplanner.transit.model.timetable.TripTimesFactory; public class TripPatternForDateMapperTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final LocalDate SERVICE_DATE = LocalDate.of(2009, 8, 7); private static final int SERVICE_CODE = 555; @@ -35,7 +35,7 @@ public class TripPatternForDateMapperTest { @BeforeAll public static void setUp() throws Exception { var pattern = TEST_MODEL.pattern(BUS).build(); - var trip = TransitModelForTest.trip("1").build(); + var trip = TimetableRepositoryForTest.trip("1").build(); var tripTimes = TripTimesFactory.tripTimes( trip, TEST_MODEL.stopTimesEvery5Minutes(5, trip, PlanTestConstants.T11_00), diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java index ea815a2f47f..b81792877ae 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RaptorRoutingRequestTransitDataCreatorTest.java @@ -1,7 +1,7 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.LocalDate; import java.time.ZonedDateTime; @@ -13,7 +13,7 @@ import org.opentripplanner.framework.time.ServiceDateUtils; import org.opentripplanner.model.StopTime; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; -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.FeedScopedId; import org.opentripplanner.transit.model.network.RoutingTripPattern; @@ -25,7 +25,7 @@ public class RaptorRoutingRequestTransitDataCreatorTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); public static final FeedScopedId TP_ID_1 = id("1"); public static final FeedScopedId TP_ID_2 = id("2"); @@ -101,7 +101,7 @@ private static TripPatternForDates findTripPatternForDate( private TripTimes createTripTimesForTest() { return ScheduledTripTimes .of() - .withTrip(TransitModelForTest.trip("Test").build()) + .withTrip(TimetableRepositoryForTest.trip("Test").build()) .withDepartureTimes("00:00 02:00") .build(); } @@ -120,7 +120,7 @@ private static StopTime createStopTime() { private static RoutingTripPattern createTripPattern(FeedScopedId id) { return TripPattern .of(id) - .withRoute(TransitModelForTest.route("1").withMode(TransitMode.BUS).build()) + .withRoute(TimetableRepositoryForTest.route("1").withMode(TransitMode.BUS).build()) .withStopPattern(new StopPattern(List.of(createStopTime(), createStopTime()))) .build() .getRoutingTripPattern(); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java index be6266ccdbe..8b52f1b58fa 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/RouteRequestTransitDataProviderFilterTest.java @@ -26,7 +26,7 @@ import org.opentripplanner.routing.api.request.request.filter.SelectRequest; import org.opentripplanner.routing.api.request.request.filter.TransitFilter; import org.opentripplanner.routing.api.request.request.filter.TransitFilterRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.MainAndSubMode; import org.opentripplanner.transit.model.basic.SubMode; @@ -49,11 +49,11 @@ class RouteRequestTransitDataProviderFilterTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); - private static final Route ROUTE = TransitModelForTest.route("1").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("1").build(); - private static final FeedScopedId TRIP_ID = TransitModelForTest.id("T1"); + private static final FeedScopedId TRIP_ID = TimetableRepositoryForTest.id("T1"); private static final RegularStop STOP_FOR_TEST = TEST_MODEL.stop("TEST:STOP", 0, 0).build(); @@ -100,8 +100,8 @@ void testWheelchairAccess(Accessibility wheelchair, WheelchairPreferences access var stopPattern = new StopPattern(List.of(stopTimeStart, stopTimeEnd)); var tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) - .withRoute(TransitModelForTest.route("1").build()) + .of(TimetableRepositoryForTest.id("P1")) + .withRoute(TimetableRepositoryForTest.route("1").build()) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); @@ -150,8 +150,8 @@ void testRealtimeCancelledStops(boolean includeRealtimeCancellations) { var stopTime4 = getStopTime("TEST:4", PickDrop.SCHEDULED); var stopPattern = new StopPattern(List.of(stopTime1, stopTime2, stopTime3, stopTime4)); var tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) - .withRoute(TransitModelForTest.route("1").build()) + .of(TimetableRepositoryForTest.id("P1")) + .withRoute(TimetableRepositoryForTest.route("1").build()) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); @@ -294,7 +294,7 @@ void matchModeFilterAndBannedAgencyFilter() { SubMode.of(TransmodelTransportSubmode.UNKNOWN.getValue()) ) ), - List.of(TransitModelForTest.OTHER_AGENCY.getId()) + List.of(TimetableRepositoryForTest.OTHER_AGENCY.getId()) ) ); @@ -329,7 +329,7 @@ void matchCombinedModesAndBannedAgencyFilter() { SubMode.of(TransmodelTransportSubmode.UNKNOWN.getValue()) ) ), - List.of(TransitModelForTest.OTHER_AGENCY.getId()) + List.of(TimetableRepositoryForTest.OTHER_AGENCY.getId()) ) ); @@ -357,7 +357,10 @@ void matchSelectedAgencyExcludedSubMode() { TransitFilterRequest .of() .addSelect( - SelectRequest.of().withAgencies(List.of(TransitModelForTest.AGENCY.getId())).build() + SelectRequest + .of() + .withAgencies(List.of(TimetableRepositoryForTest.AGENCY.getId())) + .build() ) .addNot( SelectRequest @@ -675,8 +678,8 @@ void includeRealtimeCancellationsTest() { @Test void testBikesAllowed() { - RouteBuilder routeBuilder = TransitModelForTest.route("1"); - TripBuilder trip = Trip.of(TransitModelForTest.id("T1")).withRoute(routeBuilder.build()); + RouteBuilder routeBuilder = TimetableRepositoryForTest.route("1"); + TripBuilder trip = Trip.of(TimetableRepositoryForTest.id("T1")).withRoute(routeBuilder.build()); assertEquals( BikeAccess.UNKNOWN, @@ -803,20 +806,20 @@ private boolean validateModesOnTripTimes( } private TripPatternForDate createTestTripPatternForDate() { - Route route = TransitModelForTest.route("1").build(); + Route route = TimetableRepositoryForTest.route("1").build(); var stopTime = new StopTime(); stopTime.setStop(STOP_FOR_TEST); StopPattern stopPattern = new StopPattern(List.of(stopTime)); RoutingTripPattern tripPattern = TripPattern - .of(TransitModelForTest.id("P1")) + .of(TimetableRepositoryForTest.id("P1")) .withRoute(route) .withStopPattern(stopPattern) .build() .getRoutingTripPattern(); TripTimes tripTimes = TripTimesFactory.tripTimes( - TransitModelForTest.trip("1").withRoute(route).build(), + TimetableRepositoryForTest.trip("1").withRoute(route).build(), List.of(new StopTime()), new Deduplicator() ); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java index 8648ea20324..1d266ce9953 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestRouteData.java @@ -17,7 +17,7 @@ import org.opentripplanner.raptor.spi.RaptorTimeTable; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; -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.network.Route; @@ -59,7 +59,7 @@ public TestRouteData(Route route, List stops, List times) { tripPattern = TripPattern - .of(TransitModelForTest.id("TP:" + route)) + .of(TimetableRepositoryForTest.id("TP:" + route)) .withRoute(this.route) .withStopPattern(new StopPattern(stopTimesFistTrip)) .withScheduledTimeTableBuilder(builder -> builder.addAllTripTimes(tripTimes)) @@ -167,7 +167,7 @@ private Trip parseTripInfo( Deduplicator deduplicator ) { var trip = Trip - .of(TransitModelForTest.id(route + "-" + stopTimesByTrip.size() + 1)) + .of(TimetableRepositoryForTest.id(route + "-" + stopTimesByTrip.size() + 1)) .withRoute(this.route) .build(); var stopTimes = stopTimes(trip, stops, tripTimes); @@ -260,9 +260,12 @@ public Builder withSubmode(String submode) { } public TestRouteData build() { - var routeBuilder = TransitModelForTest.route(route).withMode(mode).withShortName(route); + var routeBuilder = TimetableRepositoryForTest + .route(route) + .withMode(mode) + .withShortName(route); if (agency != null) { - routeBuilder.withAgency(TransitModelForTest.agency(agency)); + routeBuilder.withAgency(TimetableRepositoryForTest.agency(agency)); } if (submode != null) { routeBuilder.withNetexSubmode(submode); diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java index c8d99f1bfaf..729b643667a 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TestTransitCaseData.java @@ -1,13 +1,13 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; import java.time.LocalDate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; public final class TestTransitCaseData { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); public static final Station STATION_A = TEST_MODEL .station("A") diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java index 4155d46fe63..90dd9e5915e 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java @@ -11,7 +11,7 @@ import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.routing.algorithm.transferoptimization.model.TripStopTime; import org.opentripplanner.routing.algorithm.transferoptimization.model.TripToTripTransfer; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.timetable.Trip; /** @@ -154,7 +154,7 @@ public TripToTripTransfer build() { private static Trip createDummyTrip(T trip) { // Set an uniq id: pattern + the first stop departure time - return TransitModelForTest + return TimetableRepositoryForTest .trip(trip.pattern().debugInfo() + ":" + TimeUtils.timeToStrCompact(trip.departure(0))) .build(); } diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java index 4425aa10ccd..7b2a4d7e7a6 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/via/ViaRoutingWorkerTest.java @@ -21,7 +21,7 @@ import org.opentripplanner.routing.api.request.request.JourneyRequest; import org.opentripplanner.routing.api.response.RoutingResponse; import org.opentripplanner.routing.api.response.ViaRoutingResponseConnection; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; /** * Create search from point A to point B via point C. Search will start at 12:00 and will find two @@ -50,7 +50,7 @@ public class ViaRoutingWorkerTest { private static List firstSearch; private static List secondSearch; - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private final Place fromA = testModel.place("A", 5.0, 8.0); private final Place viaC = testModel.place("C", 7.0, 9.0); diff --git a/application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java b/application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java index 2e64952d351..7e40bb9670e 100644 --- a/application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java +++ b/application/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java @@ -12,7 +12,7 @@ import static org.opentripplanner.model.plan.PlanTestConstants.T11_30; import static org.opentripplanner.model.plan.PlanTestConstants.T11_50; 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; diff --git a/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java index 8c56bb89a1f..a019a7059e5 100644 --- a/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java @@ -36,7 +36,7 @@ public class DefaultRoutingServiceTest extends GtfsTest { @Override public void setUp() throws Exception { super.setUp(); - transitService = new DefaultTransitService(transitModel); + transitService = new DefaultTransitService(timetableRepository); } @Override 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 f1f9ff8bfe6..03bd2d2b5cc 100644 --- a/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java @@ -29,7 +29,7 @@ import org.opentripplanner.standalone.config.RouterConfig; import org.opentripplanner.street.model.StreetLimitationParameters; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; /** * Tests that saving a graph and reloading it (round trip through serialization and deserialization) @@ -67,7 +67,7 @@ public void testRoundTripSerializationForGTFSGraph() throws Exception { TestOtpModel model = ConstantsForTests.buildNewPortlandGraph(true); var weRepo = new DefaultWorldEnvelopeRepository(); var emissionsDataModel = new EmissionsDataModel(); - testRoundTrip(model.graph(), model.transitModel(), weRepo, emissionsDataModel); + testRoundTrip(model.graph(), model.timetableRepository(), weRepo, emissionsDataModel); } /** @@ -78,7 +78,12 @@ public void testRoundTripSerializationForNetexGraph() throws Exception { TestOtpModel model = ConstantsForTests.buildNewMinimalNetexGraph(); var worldEnvelopeRepository = new DefaultWorldEnvelopeRepository(); var emissionsDataModel = new EmissionsDataModel(); - testRoundTrip(model.graph(), model.transitModel(), worldEnvelopeRepository, emissionsDataModel); + testRoundTrip( + model.graph(), + model.timetableRepository(), + worldEnvelopeRepository, + emissionsDataModel + ); } // Ideally we'd also test comparing two separate but identical complex graphs, built separately from the same inputs. @@ -175,7 +180,7 @@ private static void assertNoDifferences(Graph g1, Graph g2) { */ private void testRoundTrip( Graph originalGraph, - TransitModel originalTransitModel, + TimetableRepository originalTimetableRepository, WorldEnvelopeRepository worldEnvelopeRepository, EmissionsDataModel emissionsDataModel ) throws Exception { @@ -185,7 +190,7 @@ private void testRoundTrip( streetLimitationParameters.initMaxCarSpeed(40); SerializedGraphObject serializedObj = new SerializedGraphObject( originalGraph, - originalTransitModel, + originalTimetableRepository, worldEnvelopeRepository, BuildConfig.DEFAULT, RouterConfig.DEFAULT, @@ -197,23 +202,23 @@ private void testRoundTrip( serializedObj.save(new FileDataSource(tempFile, FileType.GRAPH)); SerializedGraphObject deserializedGraph = SerializedGraphObject.load(tempFile); Graph copiedGraph1 = deserializedGraph.graph; - TransitModel copiedTransitModel1 = deserializedGraph.transitModel; + TimetableRepository copiedTimetableRepository1 = deserializedGraph.timetableRepository; // Index both graph - we do no know if the original is indexed, because it is cached and // might be indexed by other tests. - originalTransitModel.index(); - originalGraph.index(originalTransitModel.getStopModel()); + originalTimetableRepository.index(); + originalGraph.index(originalTimetableRepository.getStopModel()); - copiedTransitModel1.index(); - copiedGraph1.index(copiedTransitModel1.getStopModel()); + copiedTimetableRepository1.index(); + copiedGraph1.index(copiedTimetableRepository1.getStopModel()); assertNoDifferences(originalGraph, copiedGraph1); SerializedGraphObject deserializedGraph2 = SerializedGraphObject.load(tempFile); Graph copiedGraph2 = deserializedGraph2.graph; - TransitModel copiedTransitModel2 = deserializedGraph2.transitModel; - copiedTransitModel2.index(); - copiedGraph2.index(copiedTransitModel2.getStopModel()); + TimetableRepository copiedTimetableRepository2 = deserializedGraph2.timetableRepository; + copiedTimetableRepository2.index(); + copiedGraph2.index(copiedTimetableRepository2.getStopModel()); assertNoDifferences(copiedGraph1, copiedGraph2); } } diff --git a/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java index cb439a9cea3..c407fa08098 100644 --- a/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java @@ -29,7 +29,7 @@ public void build() { } } ); - stopModel = model.transitModel().getStopModel(); + stopModel = model.timetableRepository().getStopModel(); } @Test diff --git a/application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java index a81d7c39c5e..6f5fe5c3760 100644 --- a/application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/NearbyStopTest.java @@ -4,11 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class NearbyStopTest { - private static TransitModelForTest MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest MODEL = TimetableRepositoryForTest.of(); // TODO Add tests for all public methods in NearbyStop here diff --git a/application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java index b69a6533334..95ad1aa316e 100644 --- a/application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/PlaceFinderTraverseVisitorTest.java @@ -4,9 +4,9 @@ import static org.opentripplanner.model.plan.PlanTestConstants.T11_00; import static org.opentripplanner.model.plan.PlanTestConstants.T11_05; import static org.opentripplanner.model.plan.PlanTestConstants.T11_10; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; -import static org.opentripplanner.transit.model._data.TransitModelForTest.route; -import static org.opentripplanner.transit.model._data.TransitModelForTest.tripPattern; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.tripPattern; import java.util.List; import org.junit.jupiter.api.Test; @@ -15,7 +15,7 @@ import org.opentripplanner.model.StopTime; import org.opentripplanner.service.vehiclerental.model.TestVehicleRentalStationBuilder; import org.opentripplanner.street.search.state.TestStateBuilder; -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.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -23,11 +23,11 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class PlaceFinderTraverseVisitorTest { - static TransitModelForTest model = TransitModelForTest.of(); + static TimetableRepositoryForTest model = TimetableRepositoryForTest.of(); static final Station STATION1 = Station .of(id("S1")) .withName(new NonLocalizedString("Station 1")) @@ -55,7 +55,7 @@ public class PlaceFinderTraverseVisitorTest { static final Route r = route("r").build(); - static TransitModel a = new TransitModel(); + static TimetableRepository a = new TimetableRepository(); static { a.addTransitMode(TransitMode.BUS); diff --git a/application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java index 428e476babd..92bafe8e36b 100644 --- a/application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/StopFinderTraverseVisitorTest.java @@ -6,12 +6,12 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.search.state.TestStateBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.RegularStop; class StopFinderTraverseVisitorTest { - static final RegularStop STOP = TransitModelForTest.of().stop("a-stop", 1, 1).build(); + static final RegularStop STOP = TimetableRepositoryForTest.of().stop("a-stop", 1, 1).build(); @Test void deduplicateStops() { diff --git a/application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java index 76f231577dd..622b76a431a 100644 --- a/application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/StreetGraphFinderTest.java @@ -13,7 +13,7 @@ import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.vertex.IntersectionVertex; import org.opentripplanner.street.model.vertex.TransitStopVertex; -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.network.Route; import org.opentripplanner.transit.model.network.StopPattern; @@ -39,7 +39,7 @@ protected void setUp() throws Exception { new Builder() { @Override public void build() { - var a = TransitModelForTest.agency("Agency"); + var a = TimetableRepositoryForTest.agency("Agency"); R1 = route("R1", TransitMode.BUS, a); R2 = route("R2", TransitMode.TRAM, a); @@ -99,7 +99,7 @@ public void build() { tripPattern( TP1 = TripPattern - .of(TransitModelForTest.id("TP1")) + .of(TimetableRepositoryForTest.id("TP1")) .withRoute(R1) .withStopPattern(new StopPattern(List.of(st(S1), st(S2)))) .build() @@ -107,7 +107,7 @@ public void build() { tripPattern( TP2 = TripPattern - .of(TransitModelForTest.id("TP2")) + .of(TimetableRepositoryForTest.id("TP2")) .withRoute(R2) .withStopPattern(new StopPattern(List.of(st(S1), st(S3)))) .build() @@ -116,7 +116,7 @@ public void build() { } ); - transitService = new DefaultTransitService(otpModel.transitModel()); + transitService = new DefaultTransitService(otpModel.timetableRepository()); graphFinder = new StreetGraphFinder(otpModel.graph()); } diff --git a/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java b/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java index 23607d2e0b3..f0ddc08087e 100644 --- a/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java +++ b/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java @@ -29,11 +29,11 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; -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.RegularStop; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,13 +41,13 @@ public class LinkStopToPlatformTest { private static final Logger LOG = LoggerFactory.getLogger(LinkStopToPlatformTest.class); private static final GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory(); - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private Graph prepareTest(Coordinate[] platform, int[] visible, Coordinate[] stops) { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); Graph graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); ArrayList vertices = new ArrayList<>(); Coordinate[] closedGeom = new Coordinate[platform.length + 1]; @@ -106,8 +106,8 @@ private Graph prepareTest(Coordinate[] platform, int[] visible, Coordinate[] sto transitStops[i] = testModel.stop("TestStop " + i).withCoordinate(stop.y, stop.x).build(); } - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); for (RegularStop s : transitStops) { var v = TransitStopVertex.of().withStop(s).build(); diff --git a/application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java b/application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java index a4699ece2ed..055fba784a9 100644 --- a/application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java +++ b/application/src/test/java/org/opentripplanner/routing/stoptimes/AlternativeLegsTest.java @@ -34,7 +34,7 @@ public String getFeedName() { @Test void testPreviousLegs() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "1.2"), @@ -68,7 +68,7 @@ void testPreviousLegs() { @Test void testNextLegs() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "2.2"), @@ -102,7 +102,7 @@ void testNextLegs() { @Test void testCircularRoutes() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "19.1"), @@ -130,7 +130,7 @@ void testCircularRoutes() { @Test void testComplexCircularRoutes() { - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); var originalLeg = new ScheduledTransitLegReference( new FeedScopedId(this.feedId.getId(), "19.1"), diff --git a/application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java b/application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java index 61fffd7a905..b5b4d471e53 100644 --- a/application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/stoptimes/StopTimesHelperTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class StopTimesHelperTest { @@ -29,9 +29,9 @@ class StopTimesHelperTest { @BeforeAll public static void setUp() throws Exception { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - TransitModel transitModel = model.transitModel(); - transitService = new DefaultTransitService(transitModel); - feedId = transitModel.getFeedIds().iterator().next(); + TimetableRepository timetableRepository = model.timetableRepository(); + transitService = new DefaultTransitService(timetableRepository); + feedId = timetableRepository.getFeedIds().iterator().next(); stopId = new FeedScopedId(feedId, "J"); var originalPattern = transitService.getPatternForTrip( transitService.getTripForId(new FeedScopedId(feedId, "5.1")) @@ -45,9 +45,9 @@ public static void setUp() throws Exception { .withScheduledTimeTableBuilder(builder -> builder.addOrUpdateTripTimes(newTripTimes)) .build(); // replace the original pattern by the updated pattern in the transit model - transitModel.addTripPattern(pattern.getId(), pattern); - transitModel.index(); - transitService = new DefaultTransitService(transitModel); + timetableRepository.addTripPattern(pattern.getId(), pattern); + timetableRepository.index(); + transitService = new DefaultTransitService(timetableRepository); } /** diff --git a/application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java b/application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java index 49ca6d9221b..130438eb75b 100644 --- a/application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java +++ b/application/src/test/java/org/opentripplanner/routing/trippattern/FrequencyEntryTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.Frequency; import org.opentripplanner.model.StopTime; -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.framework.FeedScopedId; import org.opentripplanner.transit.model.site.RegularStop; @@ -22,15 +22,15 @@ public class FrequencyEntryTest { private static final TripTimes tripTimes; static { - Trip trip = TransitModelForTest.trip("testtrip").build(); + Trip trip = TimetableRepositoryForTest.trip("testtrip").build(); List stopTimes = new ArrayList<>(); int time = 0; for (int i = 0; i < STOP_NUM; ++i) { - FeedScopedId id = TransitModelForTest.id(i + ""); + FeedScopedId id = TimetableRepositoryForTest.id(i + ""); - RegularStop stop = TransitModelForTest.of().stop(id.getId(), 0.0, 0.0).build(); + RegularStop stop = TimetableRepositoryForTest.of().stop(id.getId(), 0.0, 0.0).build(); StopTime stopTime = new StopTime(); stopTime.setStop(stop); diff --git a/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java index 9fe74c66353..7dee554efdd 100644 --- a/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java +++ b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java @@ -7,7 +7,7 @@ import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class VehicleParkingTestGraphData { @@ -15,13 +15,13 @@ public class VehicleParkingTestGraphData { protected Graph graph; - protected TransitModel transitModel; + protected TimetableRepository timetableRepository; public void initGraph() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); graph = new Graph(deduplicator); - transitModel = new TransitModel(stopModel, deduplicator); + timetableRepository = new TimetableRepository(stopModel, deduplicator); graph.hasStreets = true; var factory = new VertexFactory(graph); @@ -36,8 +36,8 @@ public Graph getGraph() { return graph; } - public TransitModel getTransitModel() { - return transitModel; + public TimetableRepository getTimetableRepository() { + return timetableRepository; } public IntersectionVertex getAVertex() { diff --git a/application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java b/application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java index 938a201576f..c4db100b56f 100644 --- a/application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java +++ b/application/src/test/java/org/opentripplanner/service/paging/TestPagingModel.java @@ -14,7 +14,7 @@ import org.opentripplanner.model.plan.TestItineraryBuilder; import org.opentripplanner.model.plan.paging.cursor.PageCursor; import org.opentripplanner.routing.algorithm.filterchain.framework.sort.SortOrderComparator; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class TestPagingModel { @@ -54,7 +54,7 @@ class TestPagingModel { private static final Instant TRANSIT_START_TIME = TestItineraryBuilder.newTime(0).toInstant(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Place A = Place.forStop(TEST_MODEL.stop("A").build()); private static final Place B = Place.forStop(TEST_MODEL.stop("B").build()); diff --git a/application/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java b/application/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java index a1c9dddaab0..7ca1ac6a760 100644 --- a/application/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java +++ b/application/src/test/java/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleServiceTest.java @@ -2,25 +2,25 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.framework.geometry.WgsCoordinate.GREENWICH; -import static org.opentripplanner.transit.model._data.TransitModelForTest.route; -import static org.opentripplanner.transit.model._data.TransitModelForTest.tripPattern; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.route; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.tripPattern; import java.time.Instant; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.service.realtimevehicles.model.RealtimeVehicle; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; class DefaultRealtimeVehicleServiceTest { private static final Route ROUTE = route("r1").build(); - private static final TransitModelForTest MODEL = TransitModelForTest.of(); - private static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern( + private static final TimetableRepositoryForTest MODEL = TimetableRepositoryForTest.of(); + private static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( MODEL.stop("1").build(), MODEL.stop("2").build() ); @@ -34,7 +34,9 @@ class DefaultRealtimeVehicleServiceTest { @Test void originalPattern() { - var service = new DefaultRealtimeVehicleService(new DefaultTransitService(new TransitModel())); + var service = new DefaultRealtimeVehicleService( + new DefaultTransitService(new TimetableRepository()) + ); service.setRealtimeVehicles(ORIGINAL, VEHICLES); var updates = service.getRealtimeVehicles(ORIGINAL); assertEquals(VEHICLES, updates); @@ -42,7 +44,9 @@ void originalPattern() { @Test void realtimeAddedPattern() { - var service = new DefaultRealtimeVehicleService(new DefaultTransitService(new TransitModel())); + var service = new DefaultRealtimeVehicleService( + new DefaultTransitService(new TimetableRepository()) + ); var realtimePattern = tripPattern("realtime-added", ROUTE) .withStopPattern(STOP_PATTERN) .withOriginalTripPattern(ORIGINAL) diff --git a/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java index f969c5d18ed..60daef889b0 100644 --- a/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java @@ -45,7 +45,7 @@ public static void createGraph() { ResourceLoader.of(BarrierRoutingTest.class).file("herrenberg-barrier-gates.osm.pbf") ); graph = model.graph(); - graph.index(model.transitModel().getStopModel()); + graph.index(model.timetableRepository().getStopModel()); } /** diff --git a/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java index 2c52d0649f5..d5d6f7452db 100644 --- a/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java @@ -34,8 +34,8 @@ public class BicycleRoutingTest { ); herrenbergGraph = model.graph(); - model.transitModel().index(); - herrenbergGraph.index(model.transitModel().getStopModel()); + model.timetableRepository().index(); + herrenbergGraph.index(model.timetableRepository().getStopModel()); } /** diff --git a/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java index 1dad09faec4..50ab7d5ea55 100644 --- a/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java @@ -29,8 +29,8 @@ class WalkRoutingTest { ); roundabout = model.graph(); - model.transitModel().index(); - roundabout.index(model.transitModel().getStopModel()); + model.timetableRepository().index(); + roundabout.index(model.timetableRepository().getStopModel()); } /** diff --git a/application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java b/application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java index a57e4227a6b..8d06e06a0c1 100644 --- a/application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/_data/StreetModelForTest.java @@ -1,6 +1,6 @@ package org.opentripplanner.street.model._data; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.LineString; diff --git a/application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java index 6ba4dea0216..748e3b608fe 100644 --- a/application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetTransitEntityLinkTest.java @@ -25,7 +25,7 @@ import org.opentripplanner.street.search.request.StreetSearchRequest; import org.opentripplanner.street.search.state.State; import org.opentripplanner.street.search.state.TestStateBuilder; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.site.RegularStop; @@ -33,7 +33,7 @@ class StreetTransitEntityLinkTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final RegularStop ACCESSIBLE_STOP = stopForTest( "A:accessible", diff --git a/application/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java index 8a3316e44e0..8c6127e716e 100644 --- a/application/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetVehicleParkingLinkTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.params.provider.Arguments.of; import static org.opentripplanner.street.model._data.StreetModelForTest.intersectionVertex; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.Set; import java.util.stream.Stream; diff --git a/application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java index 81bee23ad54..e28bf75583d 100644 --- a/application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/VehicleParkingEdgeTest.java @@ -14,7 +14,7 @@ import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; import org.opentripplanner.street.search.request.StreetSearchRequest; import org.opentripplanner.street.search.state.State; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class VehicleParkingEdgeTest { @@ -133,7 +133,7 @@ private VehicleParking createVehicleParking( ) { return StreetModelForTest .vehicleParking() - .id(TransitModelForTest.id("VehicleParking")) + .id(TimetableRepositoryForTest.id("VehicleParking")) .bicyclePlaces(bicyclePlaces) .carPlaces(carPlaces) .availability(availability) @@ -145,7 +145,7 @@ private VehicleParking.VehicleParkingEntranceCreator vehicleParkingEntrance() { String id = "Entrance"; return builder -> builder - .entranceId(TransitModelForTest.id(id)) + .entranceId(TimetableRepositoryForTest.id(id)) .name(new NonLocalizedString(id)) .coordinate(new WgsCoordinate(0, 0)); } diff --git a/application/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java b/application/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java index 61da00ed2c6..298e4fe467f 100644 --- a/application/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/vertex/OsmVertexTest.java @@ -6,12 +6,12 @@ import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.site.AreaStop; class OsmVertexTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final AreaStop AREA_STOP1 = TEST_MODEL.areaStop("flex-zone-1").build(); private static final AreaStop AREA_STOP2 = TEST_MODEL.areaStop("flex-zone-2").build(); diff --git a/application/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java b/application/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java index 3c33573621e..4e7f222a26f 100644 --- a/application/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestMapperTest.java @@ -10,7 +10,7 @@ import org.opentripplanner.routing.api.request.RequestModes; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.StreetMode; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class StreetSearchRequestMapperTest { @@ -20,7 +20,7 @@ void map() { Instant dateTime = Instant.parse("2022-11-10T10:00:00Z"); routeRequest.setDateTime(dateTime); - var from = new GenericLocation(null, TransitModelForTest.id("STOP"), null, null); + var from = new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null); routeRequest.setFrom(from); var to = new GenericLocation(60.0, 20.0); routeRequest.setTo(to); @@ -44,7 +44,7 @@ void mapToTransferRequest() { Instant dateTime = Instant.parse("2022-11-10T10:00:00Z"); routeRequest.setDateTime(dateTime); - var from = new GenericLocation(null, TransitModelForTest.id("STOP"), null, null); + var from = new GenericLocation(null, TimetableRepositoryForTest.id("STOP"), null, null); routeRequest.setFrom(from); var to = new GenericLocation(60.0, 20.0); routeRequest.setTo(to); diff --git a/application/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java b/application/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java index 1b66152ec09..9605d950ae0 100644 --- a/application/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java +++ b/application/src/test/java/org/opentripplanner/street/search/state/TestStateBuilder.java @@ -35,7 +35,7 @@ import org.opentripplanner.street.model.vertex.TransitStopVertex; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.request.StreetSearchRequest; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.RegularStop; @@ -44,7 +44,7 @@ */ public class TestStateBuilder { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); private static final Instant DEFAULT_START_TIME = OffsetDateTime .parse("2023-04-18T12:00:00+02:00") diff --git a/application/src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java b/application/src/test/java/org/opentripplanner/transit/model/TimetableRepositoryArchitectureTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java rename to application/src/test/java/org/opentripplanner/transit/model/TimetableRepositoryArchitectureTest.java index 11db763d97f..d2ae7e2e47d 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/TransitModelArchitectureTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/TimetableRepositoryArchitectureTest.java @@ -15,7 +15,7 @@ import org.opentripplanner._support.arch.ArchComponent; import org.opentripplanner._support.arch.Package; -public class TransitModelArchitectureTest { +public class TimetableRepositoryArchitectureTest { private static final Package TRANSIT_FRAMEWORK = TRANSIT_MODEL.subPackage("framework"); private static final Package BASIC = TRANSIT_MODEL.subPackage("basic"); diff --git a/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java index 0b149ae4ee4..5b3883005de 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java +++ b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java @@ -1,6 +1,6 @@ package org.opentripplanner.transit.model._data; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -13,17 +13,22 @@ public class PatternTestModel { - public static final Route ROUTE_1 = TransitModelForTest.route("1").build(); + public static final Route ROUTE_1 = TimetableRepositoryForTest.route("1").build(); private static final FeedScopedId SERVICE_ID = id("service"); - private static final Trip TRIP = TransitModelForTest + private static final Trip TRIP = TimetableRepositoryForTest .trip("t1") .withRoute(ROUTE_1) .withServiceId(SERVICE_ID) .build(); - private static final TransitModelForTest MODEL = new TransitModelForTest(StopModel.of()); + private static final TimetableRepositoryForTest MODEL = new TimetableRepositoryForTest( + StopModel.of() + ); private static final RegularStop STOP_1 = MODEL.stop("1").build(); - private static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern(STOP_1, STOP_1); + private static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( + STOP_1, + STOP_1 + ); /** * Creates a trip pattern that has a stop pattern, trip times and a trip with a service id. @@ -36,7 +41,7 @@ public static TripPattern pattern() { .withDepartureTimes("10:00 10:05") .build(); - return TransitModelForTest + return TimetableRepositoryForTest .tripPattern("1", ROUTE_1) .withStopPattern(STOP_PATTERN) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tt)) diff --git a/application/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java b/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java similarity index 97% rename from application/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java rename to application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java index 0f6d872c639..1da4b5b06e0 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/_data/TransitModelForTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java @@ -50,7 +50,7 @@ * state between tests. For now, it is just the stop index - but we want to * use this to encapsulate the StopModel completely. */ -public class TransitModelForTest { +public class TimetableRepositoryForTest { public static final String FEED_ID = "F"; public static final String TIME_ZONE_ID = "Europe/Paris"; @@ -91,12 +91,12 @@ public class TransitModelForTest { private final StopModelBuilder stopModelBuilder; - public TransitModelForTest(StopModelBuilder stopModelBuilder) { + public TimetableRepositoryForTest(StopModelBuilder stopModelBuilder) { this.stopModelBuilder = stopModelBuilder; } - public static TransitModelForTest of() { - return new TransitModelForTest(StopModel.of()); + public static TimetableRepositoryForTest of() { + return new TimetableRepositoryForTest(StopModel.of()); } public static FeedScopedId id(String id) { diff --git a/application/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java b/application/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java index 5cdd6f37e5c..5306d31077a 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/basic/NoticeTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class NoticeTest { @@ -16,7 +16,7 @@ class NoticeTest { private static final String PUBLIC_CODE = "public code"; private static final Notice subject = Notice - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withPublicCode(PUBLIC_CODE) .withText(TEXT) .build(); @@ -45,7 +45,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withPublicCode("X").build())); assertFalse(subject.sameAs(subject.copy().withText("X").build())); } diff --git a/application/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java b/application/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java index f7f1aed4666..c89d45cc036 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/framework/EntityByIdTest.java @@ -6,16 +6,16 @@ import java.util.Collections; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class EntityByIdTest { - private static final FeedScopedId ID = TransitModelForTest.id("99"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("99"); private static final TestEntity E = TestEntity.of(ID).build(); private static final String E_TO_STRING = E.toString(); private static final String LIST_OF_E_TO_STRING = String.format("[%s]", E_TO_STRING); private static final String MAP_OF_E_TO_STRING = String.format("{%s=%s}", ID, E_TO_STRING); - private static final FeedScopedId FAKE_ID = TransitModelForTest.id("77"); + private static final FeedScopedId FAKE_ID = TimetableRepositoryForTest.id("77"); private final EntityById subject = new DefaultEntityById<>(); @Test diff --git a/application/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java index ca61e3c30f3..2788b62bae9 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/GroupOfRoutesTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class GroupOfRoutesTest { @@ -18,7 +18,7 @@ public class GroupOfRoutesTest { private static final String DESCRIPTION = "description"; private static final GroupOfRoutes subject = GroupOfRoutes - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withPrivateCode(PRIVATE_CODE) .withShortName(SHORT_NAME) .withName(NAME) @@ -52,7 +52,7 @@ public void sameValue() { // Make a copy, and set the same name (nothing is changed) var other = subject.copy().build(); assertTrue(subject.sameAs(other)); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withDescription("X").build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); diff --git a/application/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java index e21465547a1..65bc3bb53a9 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/RouteTest.java @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -39,9 +39,9 @@ class RouteTest { private static final String FLEXIBLE_LINE_TYPE = "flexible line type"; private static final Integer GTFS_SORT_ORDER = 0; private static final String URL = "url"; - public static final Agency AGENCY = TransitModelForTest.AGENCY; + public static final Agency AGENCY = TimetableRepositoryForTest.AGENCY; private static final Route subject = Route - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withShortName(SHORT_NAME) .withLongName(LONG_NAME) .withDescription(DESCRIPTION) @@ -96,7 +96,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); assertFalse(subject.sameAs(subject.copy().withLongName(new NonLocalizedString("X")).build())); assertFalse(subject.sameAs(subject.copy().withDescription("X").build())); @@ -116,7 +116,9 @@ void sameAs() { .build() ) ); - assertFalse(subject.sameAs(subject.copy().withAgency(TransitModelForTest.agency("X")).build())); + assertFalse( + subject.sameAs(subject.copy().withAgency(TimetableRepositoryForTest.agency("X")).build()) + ); assertFalse( subject.sameAs( subject diff --git a/application/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java index 1bce2edf9dc..2b3a59cefab 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/StopPatternTest.java @@ -6,12 +6,12 @@ import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.timetable.Trip; class StopPatternTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); @Test void boardingAlightingConditions() { @@ -25,7 +25,7 @@ void boardingAlightingConditions() { var areaStop = testModel.areaStop("area").build(); - Trip t = TransitModelForTest.trip("trip").build(); + Trip t = TimetableRepositoryForTest.trip("trip").build(); StopPattern stopPattern = new StopPattern( List.of( @@ -54,7 +54,7 @@ void replaceStop() { var s3 = testModel.stop("3").build(); var s4 = testModel.stop("4").build(); - var pattern = TransitModelForTest.stopPattern(s1, s2, s3); + var pattern = TimetableRepositoryForTest.stopPattern(s1, s2, s3); assertEquals(List.of(s1, s2, s3), pattern.getStops()); diff --git a/application/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java index b2adc7544a3..bb0ec765331 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/TripPatternTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.framework.geometry.GeometryUtils.makeLineString; -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.Assertions; import org.junit.jupiter.api.Test; import org.locationtech.jts.geom.LineString; -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.site.RegularStop; @@ -20,13 +20,13 @@ class TripPatternTest { private static final String ID = "1"; private static final String NAME = "short name"; - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); - private static final Route ROUTE = TransitModelForTest.route("routeId").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("routeId").build(); public static final RegularStop STOP_A = TEST_MODEL.stop("A").build(); public static final RegularStop STOP_B = TEST_MODEL.stop("B").build(); public static final RegularStop STOP_C = TEST_MODEL.stop("C").build(); - private static final StopPattern STOP_PATTERN = TransitModelForTest.stopPattern( + private static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( STOP_A, STOP_B, STOP_C @@ -77,7 +77,7 @@ void sameAs() { assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse( subject.sameAs( - subject.copy().withRoute(TransitModelForTest.route("anotherId").build()).build() + subject.copy().withRoute(TimetableRepositoryForTest.route("anotherId").build()).build() ) ); assertFalse(subject.sameAs(subject.copy().withMode(TransitMode.RAIL).build())); diff --git a/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java b/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java index c1aeeea1a59..997d16bcff8 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/network/grouppriority/TripAdapterTest.java @@ -3,12 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.timetable.Trip; class TripAdapterTest { - private final Trip trip = TransitModelForTest.trip("Trip").build(); + private final Trip trip = TimetableRepositoryForTest.trip("Trip").build(); private final TripAdapter subject = new TripAdapter(trip); diff --git a/application/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java b/application/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java index b2cf1a57db3..d5b0bff33a3 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/organization/AgencyTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class AgencyTest { @@ -21,7 +21,7 @@ class AgencyTest { private static final String LANG = "image"; private static final Agency subject = Agency - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withUrl(URL) .withTimezone(TIMEZONE) @@ -60,7 +60,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withUrl("X").build())); assertFalse(subject.sameAs(subject.copy().withTimezone("CET").build())); diff --git a/application/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java b/application/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java index 39b081fc6d8..37e6217cd15 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/organization/BrandingTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; public class BrandingTest { @@ -19,7 +19,7 @@ public class BrandingTest { private static final String IMAGE = "test_image"; Branding subject = Branding - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withShortName(SHORT_NAME) .withName(NAME) .withUrl(URL) @@ -53,7 +53,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); assertFalse(subject.sameAs(subject.copy().withUrl("X").build())); diff --git a/application/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java b/application/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java index 44374f54e91..12decb1fc82 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/organization/OperatorTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class OperatorTest { @@ -17,7 +17,7 @@ class OperatorTest { private static final String PHONE = "+47 95566333"; private static final Operator subject = Operator - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withUrl(URL) .withPhone(PHONE) @@ -46,7 +46,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); assertFalse(subject.sameAs(subject.copy().withUrl("X").build())); assertFalse(subject.sameAs(subject.copy().withPhone("X").build())); diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java index a36b6611368..542dcaadc36 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java @@ -13,7 +13,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.service.StopModel; class AreaStopTest { @@ -24,7 +24,7 @@ class AreaStopTest { private static final I18NString URL = new NonLocalizedString("url"); - private static final String ZONE_ID = TransitModelForTest.TIME_ZONE_ID; + private static final String ZONE_ID = TimetableRepositoryForTest.TIME_ZONE_ID; private static final Geometry GEOMETRY = Polygons.OSLO; @@ -35,7 +35,7 @@ class AreaStopTest { private static AreaStopBuilder areaStopBuilder() { return StopModel .of() - .areaStop(TransitModelForTest.id(ID)) + .areaStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withUrl(URL) @@ -70,7 +70,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java index bc7c3455c24..235f4c089ff 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/BoardingAreaTest.java @@ -10,17 +10,20 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class BoardingAreaTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); private static final I18NString DESCRIPTION = new NonLocalizedString("description"); - private static final RegularStop PARENT_STOP = TransitModelForTest.of().stop("stopId").build(); + private static final RegularStop PARENT_STOP = TimetableRepositoryForTest + .of() + .stop("stopId") + .build(); private static final BoardingArea subject = BoardingArea - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withParentStop(PARENT_STOP) @@ -52,7 +55,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java index 738238caa0f..0a9bb5cb5a4 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/EntranceTest.java @@ -10,7 +10,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; class EntranceTest { @@ -23,11 +23,11 @@ class EntranceTest { public static final WgsCoordinate COORDINATE = new WgsCoordinate(0, 0); private static final StopLevel LEVEL = new StopLevel("level", 0); private static final Accessibility WHEELCHAIR_ACCESSIBILITY = Accessibility.POSSIBLE; - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final Entrance subject = Entrance - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -67,7 +67,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java index 442ca61377f..c98f18d7aec 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/FareZoneTest.java @@ -7,14 +7,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class FareZoneTest { private static final String ID = "1"; private static final String NAME = "name"; private static final FareZone subject = FareZone - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .build(); @@ -41,7 +41,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName("X").build())); } } diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java index 9b340f3d331..f1816e5a4b7 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/GroupOfStationsTest.java @@ -9,11 +9,11 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class GroupOfStationsTest { - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); @@ -26,7 +26,7 @@ class GroupOfStationsTest { .build(); private static final GroupOfStations subject = GroupOfStations - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addChildStation(STATION) .build(); @@ -55,7 +55,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs( diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java index b57566b68ed..654ec304792 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java @@ -14,12 +14,12 @@ import org.opentripplanner._support.geometry.Polygons; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.service.StopModel; class GroupStopTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); @@ -29,7 +29,7 @@ class GroupStopTest { .build(); private static final GroupStop subject = StopModel .of() - .groupStop(TransitModelForTest.id(ID)) + .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addLocation(STOP_LOCATION) .build(); @@ -45,7 +45,7 @@ void testGroupStopGeometry() { GroupStop groupStop = StopModel .of() - .groupStop(TransitModelForTest.id(ID)) + .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addLocation(stopLocation1) .addLocation(stopLocation2) @@ -66,7 +66,7 @@ void testGroupStopEncompassingAreaGeometry() { GroupStop groupStop = StopModel .of() - .groupStop(TransitModelForTest.id(ID)) + .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .addLocation(stopLocation) .withEncompassingAreaGeometries(List.of(Polygons.BERLIN)) @@ -105,11 +105,14 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs( - subject.copy().addLocation(TransitModelForTest.of().stop("2:stop", 1d, 2d).build()).build() + subject + .copy() + .addLocation(TimetableRepositoryForTest.of().stop("2:stop", 1d, 2d).build()) + .build() ) ); } diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java index 615b0c49674..93be75e5c13 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/MultiModalStationTest.java @@ -11,20 +11,20 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class MultiModalStationTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); - private static TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station STATION_1 = TEST_MODEL.station("1:1").build(); private static final Station STATION_2 = TEST_MODEL.station("1:2").build(); public static final Set CHILD_STATIONS = Set.of(STATION_1, STATION_2); private static final MultiModalStation subject = MultiModalStation - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withChildStations(CHILD_STATIONS) .withCoordinate(new WgsCoordinate(1, 1)) @@ -54,7 +54,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse(subject.sameAs(subject.copy().withChildStations(Set.of(STATION_1)).build())); } diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java index c5cdae2b54b..77de36ceb71 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayNodeTest.java @@ -10,7 +10,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; class PathwayNodeTest { @@ -18,7 +18,7 @@ class PathwayNodeTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); private static final I18NString DESCRIPTION = new NonLocalizedString("description"); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final String CODE = "code"; @@ -26,7 +26,7 @@ class PathwayNodeTest { private static final StopLevel LEVEL = new StopLevel("level", 0); private static final Accessibility WHEELCHAIR_ACCESSIBILITY = Accessibility.POSSIBLE; private static final PathwayNode subject = PathwayNode - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -66,7 +66,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java index 9b5e526b6dd..09bf034e6ba 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/PathwayTest.java @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.geometry.WgsCoordinate; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class PathwayTest { @@ -17,14 +17,14 @@ class PathwayTest { private static final String NAME = "name"; private static final PathwayMode MODE = PathwayMode.ESCALATOR; private static final PathwayNode FROM = PathwayNode - .of(TransitModelForTest.id("1:node")) + .of(TimetableRepositoryForTest.id("1:node")) .withCoordinate(new WgsCoordinate(20, 30)) .build(); - private static final RegularStop TO = TransitModelForTest.of().stop("1:stop").build(); + private static final RegularStop TO = TimetableRepositoryForTest.of().stop("1:stop").build(); public static final int TRAVERSAL_TIME = 120; private final Pathway subject = Pathway - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withPathwayMode(MODE) .withSignpostedAs(NAME) .withFromStop(FROM) @@ -66,7 +66,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withSignpostedAs("X").build())); assertFalse(subject.sameAs(subject.copy().withReverseSignpostedAs("X").build())); assertFalse(subject.sameAs(subject.copy().withPathwayMode(PathwayMode.ELEVATOR).build())); diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java index 104d732e37e..028a8b0b218 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; @@ -22,7 +22,7 @@ class RegularStopTest { private static final String ID = "1"; private static final I18NString NAME = new NonLocalizedString("name"); private static final I18NString DESCRIPTION = new NonLocalizedString("description"); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final String CODE = "code"; @@ -32,12 +32,12 @@ class RegularStopTest { private static final String NETEX_SUBMODE_NAME = "submode"; private static final SubMode NETEX_SUBMODE = SubMode.of(NETEX_SUBMODE_NAME); private static final TransitMode VEHICLE_TYPE = TransitMode.BUS; - public static final ZoneId TIME_ZONE = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); + public static final ZoneId TIME_ZONE = ZoneId.of(TimetableRepositoryForTest.TIME_ZONE_ID); private static final String PLATFORM_CODE = "platformCode"; private static final RegularStop subject = StopModel .of() - .regularStop(TransitModelForTest.id(ID)) + .regularStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -86,7 +86,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs(subject.copy().withDescription(new NonLocalizedString("X")).build()) @@ -97,7 +97,10 @@ void sameAs() { assertFalse(subject.sameAs(subject.copy().withVehicleType(TransitMode.TRAM).build())); assertFalse( subject.sameAs( - subject.copy().withTimeZone(ZoneId.of(TransitModelForTest.OTHER_TIME_ZONE_ID)).build() + subject + .copy() + .withTimeZone(ZoneId.of(TimetableRepositoryForTest.OTHER_TIME_ZONE_ID)) + .build() ) ); assertFalse(subject.sameAs(subject.copy().withPlatformCode("X").build())); diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/StationTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/StationTest.java index 9ff75583bfc..958816bc74d 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/StationTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/StationTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class StationTest { @@ -22,13 +22,13 @@ class StationTest { public static final WgsCoordinate COORDINATE = new WgsCoordinate(0, 0); private static final StopTransferPriority PRIORITY = StopTransferPriority.ALLOWED; - private static final ZoneId TIMEZONE = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); + private static final ZoneId TIMEZONE = ZoneId.of(TimetableRepositoryForTest.TIME_ZONE_ID); private static final I18NString URL = new NonLocalizedString("url"); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station PARENT_STATION = TEST_MODEL.station("stationId").build(); private static final Station subject = Station - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withName(NAME) .withDescription(DESCRIPTION) .withCode(CODE) @@ -67,7 +67,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withName(new NonLocalizedString("X")).build())); assertFalse(subject.sameAs(subject.copy().withCode("X").build())); assertFalse( @@ -80,7 +80,10 @@ void sameAs() { assertFalse(subject.sameAs(subject.copy().withUrl(new NonLocalizedString("X")).build())); assertFalse( subject.sameAs( - subject.copy().withTimezone(ZoneId.of(TransitModelForTest.OTHER_TIME_ZONE_ID)).build() + subject + .copy() + .withTimezone(ZoneId.of(TimetableRepositoryForTest.OTHER_TIME_ZONE_ID)) + .build() ) ); } diff --git a/application/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java index 5b3a8f76052..29da6582d8f 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/RealTimeTripTimesTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.transit.model.timetable.TimetableValidationError.ErrorCode.NEGATIVE_DWELL_TIME; import static org.opentripplanner.transit.model.timetable.TimetableValidationError.ErrorCode.NEGATIVE_HOP_TIME; @@ -16,7 +16,7 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.model.StopTime; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.DataValidationException; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; @@ -24,7 +24,7 @@ class RealTimeTripTimesTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final String TRIP_ID = "testTripId"; @@ -40,7 +40,7 @@ class RealTimeTripTimesTest { ); static TripTimes createInitialTripTimes() { - Trip trip = TransitModelForTest.trip(TRIP_ID).build(); + Trip trip = TimetableRepositoryForTest.trip(TRIP_ID).build(); List stopTimes = new LinkedList<>(); @@ -69,7 +69,7 @@ class Headsign { @Test void shouldHandleBothNullScenario() { - Trip trip = TransitModelForTest.trip("TRIP").build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").build(); List stopTimes = List.of(EMPTY_STOPPOINT, EMPTY_STOPPOINT, EMPTY_STOPPOINT); TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); @@ -80,7 +80,7 @@ void shouldHandleBothNullScenario() { @Test void shouldHandleTripOnlyHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").withHeadsign(DIRECTION).build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").withHeadsign(DIRECTION).build(); List stopTimes = List.of(EMPTY_STOPPOINT, EMPTY_STOPPOINT, EMPTY_STOPPOINT); TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, new Deduplicator()); @@ -91,7 +91,7 @@ void shouldHandleTripOnlyHeadSignScenario() { @Test void shouldHandleStopsOnlyHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").build(); StopTime stopWithHeadsign = new StopTime(); stopWithHeadsign.setStopHeadsign(STOP_TEST_DIRECTION); List stopTimes = List.of(stopWithHeadsign, stopWithHeadsign, stopWithHeadsign); @@ -104,7 +104,7 @@ void shouldHandleStopsOnlyHeadSignScenario() { @Test void shouldHandleStopsEqualToTripHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").withHeadsign(DIRECTION).build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").withHeadsign(DIRECTION).build(); StopTime stopWithHeadsign = new StopTime(); stopWithHeadsign.setStopHeadsign(DIRECTION); List stopTimes = List.of(stopWithHeadsign, stopWithHeadsign, stopWithHeadsign); @@ -117,7 +117,7 @@ void shouldHandleStopsEqualToTripHeadSignScenario() { @Test void shouldHandleDifferingTripAndStopHeadSignScenario() { - Trip trip = TransitModelForTest.trip("TRIP").withHeadsign(DIRECTION).build(); + Trip trip = TimetableRepositoryForTest.trip("TRIP").withHeadsign(DIRECTION).build(); StopTime stopWithHeadsign = new StopTime(); stopWithHeadsign.setStopHeadsign(STOP_TEST_DIRECTION); List stopTimes = List.of(stopWithHeadsign, EMPTY_STOPPOINT, EMPTY_STOPPOINT); diff --git a/application/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java index e2c1148ef51..75bf99a3fcc 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/ScheduledTripTimesTest.java @@ -5,20 +5,20 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.BitSet; import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.framework.time.TimeUtils; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.framework.DataValidationException; import org.opentripplanner.transit.model.framework.FeedScopedId; class ScheduledTripTimesTest { - private static final Trip TRIP = TransitModelForTest.trip("Trip-1").build(); + private static final Trip TRIP = TimetableRepositoryForTest.trip("Trip-1").build(); private static final List STOP_IDS = List.of(id("A"), id("B"), id("C")); private static final int SERVICE_CODE = 5; diff --git a/application/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java index a4051211c51..e86b4133256 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/StopTimeKeyTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class StopTimeKeyTest { @@ -13,7 +13,7 @@ class StopTimeKeyTest { private static final int STOP_SEQUENCE_NUMBER = 1; private static final StopTimeKey subject = StopTimeKey - .of(TransitModelForTest.id(ID), STOP_SEQUENCE_NUMBER) + .of(TimetableRepositoryForTest.id(ID), STOP_SEQUENCE_NUMBER) .build(); @Test @@ -29,6 +29,6 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); } } diff --git a/application/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java index 7dd67665e92..acccea2b531 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/TimetableValidationErrorTest.java @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.TransitMode; class TimetableValidationErrorTest { @@ -11,7 +11,7 @@ class TimetableValidationErrorTest { private TimetableValidationError subject = new TimetableValidationError( TimetableValidationError.ErrorCode.NEGATIVE_HOP_TIME, 3, - TransitModelForTest.trip("A").withMode(TransitMode.BUS).withShortName("Line A").build() + TimetableRepositoryForTest.trip("A").withMode(TransitMode.BUS).withShortName("Line A").build() ); @Test diff --git a/application/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java index c72d56b6aeb..d84af565fab 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripOnServiceDateTest.java @@ -7,20 +7,20 @@ import java.time.LocalDate; import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; class TripOnServiceDateTest { private static final String ID = "1"; private static final TripAlteration TRIP_ALTERATION = TripAlteration.CANCELLATION; private static final List REPLACEMENT_FOR = List.of( - TripOnServiceDate.of(TransitModelForTest.id("id1")).build() + TripOnServiceDate.of(TimetableRepositoryForTest.id("id1")).build() ); public static final LocalDate SERVICE_DATE = LocalDate.now(); public static final String TRIP_ID = "tripId"; private static final TripOnServiceDate subject = TripOnServiceDate - .of(TransitModelForTest.id(ID)) - .withTrip(TransitModelForTest.trip(TRIP_ID).build()) + .of(TimetableRepositoryForTest.id(ID)) + .withTrip(TimetableRepositoryForTest.trip(TRIP_ID).build()) .withServiceDate(SERVICE_DATE) .withTripAlteration(TRIP_ALTERATION) .withReplacementFor(REPLACEMENT_FOR) @@ -43,7 +43,7 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse( subject.sameAs(subject.copy().withServiceDate(LocalDate.now().plusDays(1)).build()) ); @@ -52,7 +52,9 @@ void sameAs() { subject.sameAs( subject .copy() - .withReplacementFor(List.of(TripOnServiceDate.of(TransitModelForTest.id("id2")).build())) + .withReplacementFor( + List.of(TripOnServiceDate.of(TimetableRepositoryForTest.id("id2")).build()) + ) .build() ) ); diff --git a/application/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java index 3a3f35643fa..5d50548564a 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/timetable/TripTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; @@ -20,7 +20,7 @@ class TripTest { private static final String ID = "1"; private static final String SHORT_NAME = "name"; private static final Accessibility WHEELCHAIR_ACCESSIBILITY = Accessibility.POSSIBLE; - public static final Route ROUTE = TransitModelForTest.route("routeId").build(); + public static final Route ROUTE = TimetableRepositoryForTest.route("routeId").build(); private static final Direction DIRECTION = Direction.INBOUND; public static final NonLocalizedString HEAD_SIGN = new NonLocalizedString("head sign"); private static final BikeAccess BIKE_ACCESS = BikeAccess.ALLOWED; @@ -37,7 +37,7 @@ class TripTest { private static final FeedScopedId SERVICE_ID = FeedScopedId.parse("x:serviceId"); private static final FeedScopedId SHAPE_ID = FeedScopedId.parse("x:shapeId"); private static final Trip subject = Trip - .of(TransitModelForTest.id(ID)) + .of(TimetableRepositoryForTest.id(ID)) .withShortName(SHORT_NAME) .withRoute(ROUTE) .withDirection(DIRECTION) @@ -63,7 +63,7 @@ void shouldCopyFieldsFromRoute() { .withBikesAllowed(BIKE_ACCESS) .build(); - var subject = Trip.of(TransitModelForTest.id(ID)).withRoute(routeWithModes).build(); + var subject = Trip.of(TimetableRepositoryForTest.id(ID)).withRoute(routeWithModes).build(); assertEquals(TRANSIT_MODE, subject.getMode()); assertEquals(NETEX_SUBMODE, subject.getNetexSubMode()); @@ -97,14 +97,14 @@ void copy() { @Test void sameAs() { assertTrue(subject.sameAs(subject.copy().build())); - assertFalse(subject.sameAs(subject.copy().withId(TransitModelForTest.id("X")).build())); + assertFalse(subject.sameAs(subject.copy().withId(TimetableRepositoryForTest.id("X")).build())); assertFalse(subject.sameAs(subject.copy().withShortName("X").build())); assertFalse( subject.sameAs(subject.copy().withWheelchairBoarding(Accessibility.NOT_POSSIBLE).build()) ); assertFalse( subject.sameAs( - subject.copy().withRoute(TransitModelForTest.route("otherRouteId").build()).build() + subject.copy().withRoute(TimetableRepositoryForTest.route("otherRouteId").build()).build() ) ); assertFalse(subject.sameAs(subject.copy().withDirection(Direction.OUTBOUND).build())); diff --git a/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java b/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java index b04a1258984..ec95c91a3f7 100644 --- a/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java @@ -14,7 +14,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.RealTimeTripUpdate; import org.opentripplanner.model.TimetableSnapshot; -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.network.StopPattern; import org.opentripplanner.transit.model.network.TripPattern; @@ -26,7 +26,7 @@ class DefaultTransitServiceTest { - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); static TransitService service; static Station STATION = TEST_MODEL.station("C").build(); @@ -40,7 +40,10 @@ class DefaultTransitServiceTest { static TripPattern FERRY_PATTERN = TEST_MODEL.pattern(FERRY).build(); static TripPattern BUS_PATTERN = TEST_MODEL.pattern(BUS).build(); - static StopPattern REAL_TIME_STOP_PATTERN = TransitModelForTest.stopPattern(STOP_A, STOP_B); + static StopPattern REAL_TIME_STOP_PATTERN = TimetableRepositoryForTest.stopPattern( + STOP_A, + STOP_B + ); static TripPattern REAL_TIME_PATTERN = TEST_MODEL .pattern(BUS) .withStopPattern(REAL_TIME_STOP_PATTERN) @@ -56,16 +59,16 @@ static void setup() { .withStation(STATION) .build(); - var transitModel = new TransitModel(stopModel, new Deduplicator()); - transitModel.addTripPattern(RAIL_PATTERN.getId(), RAIL_PATTERN); - transitModel.index(); + var timetableRepository = new TimetableRepository(stopModel, new Deduplicator()); + timetableRepository.addTripPattern(RAIL_PATTERN.getId(), RAIL_PATTERN); + timetableRepository.index(); - transitModel.initTimetableSnapshotProvider(() -> { + timetableRepository.initTimetableSnapshotProvider(() -> { TimetableSnapshot timetableSnapshot = new TimetableSnapshot(); RealTimeTripTimes tripTimes = RealTimeTripTimes.of( ScheduledTripTimes .of() - .withTrip(TransitModelForTest.trip("REAL_TIME_TRIP").build()) + .withTrip(TimetableRepositoryForTest.trip("REAL_TIME_TRIP").build()) .withDepartureTimes(new int[] { 0, 1 }) .build() ); @@ -77,7 +80,7 @@ static void setup() { }); service = - new DefaultTransitService(transitModel) { + new DefaultTransitService(timetableRepository) { @Override public Collection getPatternsForStop(StopLocation stop) { if (stop.equals(STOP_B)) { diff --git a/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java b/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java index b24b547a07e..aa98a85b0a7 100644 --- a/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.framework.geometry.WgsCoordinate; import org.opentripplanner.framework.i18n.NonLocalizedString; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.model.site.GroupOfStations; @@ -28,7 +28,7 @@ class StopModelTest { .getGeometryFactory() .createPoint(COOR_A.asJtsCoordinate()); public static final NonLocalizedString NAME = NonLocalizedString.ofNullable("Name"); - private static final FeedScopedId ID = TransitModelForTest.id("A"); + private static final FeedScopedId ID = TimetableRepositoryForTest.id("A"); private static final Station STATION = Station .of(ID) .withName(NAME) diff --git a/application/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java b/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java similarity index 71% rename from application/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java rename to application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java index 213d1f7b514..04740f655e3 100644 --- a/application/src/test/java/org/opentripplanner/transit/service/TransitModelTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java @@ -16,11 +16,13 @@ import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Trip; -class TransitModelTest { +class TimetableRepositoryTest { public static final String FAKE_FEED_ID = "FAKE"; public static final FeedScopedId SAMPLE_TRIP_ID = new FeedScopedId(FAKE_FEED_ID, "1.2"); - private static final ResourceLoader RESOURCE_LOADER = ResourceLoader.of(TransitModelTest.class); + private static final ResourceLoader RESOURCE_LOADER = ResourceLoader.of( + TimetableRepositoryTest.class + ); @Test void validateTimeZones() { @@ -28,22 +30,22 @@ void validateTimeZones() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, ConstantsForTests.SIMPLE_GTFS, new DefaultFareServiceFactory(), FAKE_FEED_ID ); // Then time zone should match the one provided in the feed - assertEquals("America/New_York", transitModel.getTimeZone().getId()); + assertEquals("America/New_York", timetableRepository.getTimeZone().getId()); // Then trip times should be same as in input data - TransitModelIndex transitModelIndex = transitModel.getTransitModelIndex(); - Trip trip = transitModelIndex.getTripForId(SAMPLE_TRIP_ID); - Timetable timetable = transitModelIndex.getPatternForTrip(trip).getScheduledTimetable(); + TimetableRepositoryIndex timetableRepositoryIndex = timetableRepository.getTimetableRepositoryIndex(); + Trip trip = timetableRepositoryIndex.getTripForId(SAMPLE_TRIP_ID); + Timetable timetable = timetableRepositoryIndex.getPatternForTrip(trip).getScheduledTimetable(); assertEquals(20 * 60, timetable.getTripTimes(trip).getDepartureTime(0)); // Should throw on second bundle, with different agency time zone @@ -52,7 +54,7 @@ void validateTimeZones() { () -> ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, RESOURCE_LOADER.file("kcm_gtfs.zip"), new DefaultFareServiceFactory(), null @@ -70,15 +72,15 @@ void validateTimeZonesWithExplicitTimeZone() { var deduplicator = new Deduplicator(); var stopModel = new StopModel(); var graph = new Graph(deduplicator); - var transitModel = new TransitModel(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(stopModel, deduplicator); // Whit explicit time zone - transitModel.initTimeZone(ZoneIds.CHICAGO); + timetableRepository.initTimeZone(ZoneIds.CHICAGO); // First GTFS bundle should be added successfully ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, ConstantsForTests.SIMPLE_GTFS, new DefaultFareServiceFactory(), FAKE_FEED_ID @@ -87,22 +89,22 @@ void validateTimeZonesWithExplicitTimeZone() { // Should load second bundle, with different agency time zone ConstantsForTests.addGtfsToGraph( graph, - transitModel, + timetableRepository, RESOURCE_LOADER.file("kcm_gtfs.zip"), new DefaultFareServiceFactory(), null ); - new TimeZoneAdjusterModule(transitModel).buildGraph(); + new TimeZoneAdjusterModule(timetableRepository).buildGraph(); - TransitModelIndex transitModelIndex = transitModel.getTransitModelIndex(); + TimetableRepositoryIndex timetableRepositoryIndex = timetableRepository.getTimetableRepositoryIndex(); // Then time zone should match the one provided in the feed - assertEquals("America/Chicago", transitModel.getTimeZone().getId()); + assertEquals("America/Chicago", timetableRepository.getTimeZone().getId()); // Then trip times should be on hour less than in input data - Trip trip = transitModelIndex.getTripForId(SAMPLE_TRIP_ID); - Timetable timetable = transitModelIndex.getPatternForTrip(trip).getScheduledTimetable(); + Trip trip = timetableRepositoryIndex.getTripForId(SAMPLE_TRIP_ID); + Timetable timetable = timetableRepositoryIndex.getPatternForTrip(trip).getScheduledTimetable(); assertEquals(20 * 60 - 60 * 60, timetable.getTripTimes(trip).getDepartureTime(0)); } } diff --git a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java index 61a23b10ff6..fe847aa9efc 100644 --- a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java +++ b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedIntegrationTest.java @@ -90,7 +90,7 @@ void runMultiCriteriaWithDestinationPruning() { private static void runProfile(SpeedTestProfile profile) { var opts = speedTestOptions(profile); var config = SpeedTestConfig.config(opts.rootDir()); - var speedTest = new SpeedTest(opts, config, model.graph(), model.transitModel()); + var speedTest = new SpeedTest(opts, config, model.graph(), model.timetableRepository()); // We want to validate the Raptor paths without changes done by the OptimizeTransfers // and itinerary filter chain(set to debug in config) 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 85a33281f81..38fb11712b8 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 @@ -32,7 +32,7 @@ import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig; import org.opentripplanner.standalone.server.DefaultServerRequestContext; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.speed_test.model.SpeedTestProfile; import org.opentripplanner.transit.speed_test.model.testcase.CsvFileSupport; import org.opentripplanner.transit.speed_test.model.testcase.ExpectedResults; @@ -53,7 +53,7 @@ public class SpeedTest { private static final String TRAVEL_SEARCH_FILENAME = "travelSearch"; - private final TransitModel transitModel; + private final TimetableRepository timetableRepository; private final SpeedTestTimer timer = new SpeedTestTimer(); @@ -73,11 +73,11 @@ public SpeedTest( SpeedTestCmdLineOpts opts, SpeedTestConfig config, Graph graph, - TransitModel transitModel + TimetableRepository timetableRepository ) { this.opts = opts; this.config = config; - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; this.tcIO = new CsvFileSupport( @@ -91,17 +91,17 @@ public SpeedTest( this.testCaseDefinitions = tcIO.readTestCaseDefinitions(); this.expectedResultsByTcId = tcIO.readExpectedResults(); - var transitService = new DefaultTransitService(transitModel); + var transitService = new DefaultTransitService(timetableRepository); UpdaterConfigurator.configure( graph, new DefaultRealtimeVehicleService(transitService), new DefaultVehicleRentalService(), - transitModel, + timetableRepository, config.updatersConfig ); - if (transitModel.getUpdaterManager() != null) { - transitModel.getUpdaterManager().startUpdaters(); + if (timetableRepository.getUpdaterManager() != null) { + timetableRepository.getUpdaterManager().startUpdaters(); } this.serverContext = @@ -110,7 +110,7 @@ public SpeedTest( config.request, new RaptorConfig<>(config.transitRoutingParams), graph, - new DefaultTransitService(transitModel), + new DefaultTransitService(timetableRepository), timer.getRegistry(), VectorTileConfig.DEFAULT, TestServerContext.createWorldEnvelopeService(), @@ -124,11 +124,11 @@ public SpeedTest( null, null ); - // Creating transitLayerForRaptor should be integrated into the TransitModel, but for now + // Creating transitLayerForRaptor should be integrated into the TimetableRepository, but for now // we do it manually here - creatTransitLayerForRaptor(transitModel, config.transitRoutingParams); + creatTransitLayerForRaptor(timetableRepository, config.transitRoutingParams); - initializeTransferCache(config.transitRoutingParams, transitModel); + initializeTransferCache(config.transitRoutingParams, timetableRepository); timer.setUp(opts.groupResultsByCategory()); } @@ -145,20 +145,20 @@ public static void main(String[] args) { var config = SpeedTestConfig.config(opts.rootDir()); loadOtpFeatures(opts); var model = loadGraph(opts.rootDir(), config.graph); - var transitModel = model.transitModel(); + var timetableRepository = model.timetableRepository(); var buildConfig = model.buildConfig(); var graph = model.graph(); // create a new test - var speedTest = new SpeedTest(opts, config, graph, transitModel); + var speedTest = new SpeedTest(opts, config, graph, timetableRepository); - assertTestDateHasData(transitModel, config, buildConfig); + assertTestDateHasData(timetableRepository, config, buildConfig); // and run it speedTest.runTest(); - if (speedTest.transitModel.getUpdaterManager() != null) { - speedTest.transitModel.getUpdaterManager().stop(); + if (speedTest.timetableRepository.getUpdaterManager() != null) { + speedTest.timetableRepository.getUpdaterManager().stop(); } } catch (OtpAppException ae) { System.err.println(ae.getMessage()); @@ -249,7 +249,7 @@ private RoutingResponse performRouting(TestCase testCase) { opts, config, profile, - transitModel.getTimeZone() + timetableRepository.getTimeZone() ); var routingRequest = speedTestRequest.toRouteRequest(); return serverContext.routingService().route(routingRequest); @@ -272,10 +272,10 @@ private static LoadModel loadGraph(File baseDir, URI path) { throw new IllegalStateException(); } - TransitModel transitModel = serializedGraphObject.transitModel; - transitModel.index(); - graph.index(transitModel.getStopModel()); - return new LoadModel(graph, transitModel, serializedGraphObject.buildConfig); + TimetableRepository timetableRepository = serializedGraphObject.timetableRepository; + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); + return new LoadModel(graph, timetableRepository, serializedGraphObject.buildConfig); } private void initProfileStatistics() { @@ -361,5 +361,5 @@ private List trimItineraries(RoutingResponse routingResponse) { /* inline classes */ - record LoadModel(Graph graph, TransitModel transitModel, BuildConfig buildConfig) {} + record LoadModel(Graph graph, TimetableRepository timetableRepository, BuildConfig buildConfig) {} } diff --git a/application/src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java b/application/src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java index 4113d5979b1..82db561bddf 100644 --- a/application/src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java +++ b/application/src/test/java/org/opentripplanner/transit/speed_test/support/AssertSpeedTestSetup.java @@ -3,17 +3,17 @@ import org.opentripplanner.framework.application.OtpAppException; import org.opentripplanner.framework.application.OtpFileNames; import org.opentripplanner.standalone.config.BuildConfig; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.speed_test.options.SpeedTestConfig; public class AssertSpeedTestSetup { public static void assertTestDateHasData( - TransitModel transitModel, + TimetableRepository timetableRepository, SpeedTestConfig config, BuildConfig buildConfig ) { - int numberOfPatternForTestDate = transitModel + int numberOfPatternForTestDate = timetableRepository .getTransitLayer() .getTripPatternsForRunningDate(config.testDate) .size(); diff --git a/application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java b/application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java index ffd150095b6..4da03a6b517 100644 --- a/application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java +++ b/application/src/test/java/org/opentripplanner/updater/GtfsRealtimeFuzzyTripMatcherTest.java @@ -12,10 +12,10 @@ public class GtfsRealtimeFuzzyTripMatcherTest extends GtfsTest { @Test public void testMatch() { - String feedId = transitModel.getFeedIds().iterator().next(); + String feedId = timetableRepository.getFeedIds().iterator().next(); GtfsRealtimeFuzzyTripMatcher matcher = new GtfsRealtimeFuzzyTripMatcher( - new DefaultTransitService(transitModel) + new DefaultTransitService(timetableRepository) ); TripDescriptor trip1 = TripDescriptor .newBuilder() diff --git a/application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java b/application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java index 6e590ce4957..077de6d072d 100644 --- a/application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java +++ b/application/src/test/java/org/opentripplanner/updater/alert/AlertsUpdateHandlerTest.java @@ -25,13 +25,15 @@ import org.opentripplanner.routing.alertpatch.TransitAlert; import org.opentripplanner.routing.impl.TransitAlertServiceImpl; import org.opentripplanner.routing.services.TransitAlertService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class AlertsUpdateHandlerTest { private AlertsUpdateHandler handler; - private final TransitAlertService service = new TransitAlertServiceImpl(new TransitModel()); + private final TransitAlertService service = new TransitAlertServiceImpl( + new TimetableRepository() + ); @BeforeEach public void setUp() { diff --git a/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java index 6a36bbe12dd..d5d8c9e8a74 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java @@ -18,7 +18,7 @@ import org.junit.jupiter.params.provider.CsvSource; import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.calendar.CalendarServiceData; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.AbstractTransitEntity; @@ -34,27 +34,27 @@ import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; -import org.opentripplanner.transit.service.TransitModel; import org.opentripplanner.updater.siri.mapper.SiriTransportModeMapper; import org.opentripplanner.updater.spi.UpdateError; import uk.org.siri.siri20.VehicleModesEnumeration; class AddedTripBuilderTest { - private static final Agency AGENCY = TransitModelForTest.AGENCY; + private static final Agency AGENCY = TimetableRepositoryForTest.AGENCY; private static final ZoneId TIME_ZONE = AGENCY.getTimezone(); private static final Operator OPERATOR = Operator - .of(TransitModelForTest.id("OPERATOR_ID")) + .of(TimetableRepositoryForTest.id("OPERATOR_ID")) .withName("OPERATOR_NAME") .build(); - private static final Route REPLACED_ROUTE = TransitModelForTest + private static final Route REPLACED_ROUTE = TimetableRepositoryForTest .route("REPLACED_ROUTE") .withAgency(AGENCY) .withOperator(OPERATOR) .build(); private static final String LINE_REF = "ROUTE_ID"; - private static final FeedScopedId TRIP_ID = TransitModelForTest.id("TRIP_ID"); + private static final FeedScopedId TRIP_ID = TimetableRepositoryForTest.id("TRIP_ID"); private static final LocalDate SERVICE_DATE = LocalDate.of(2023, 2, 17); private static final TransitMode TRANSIT_MODE = TransitMode.RAIL; private static final String SUB_MODE = "replacementRailService"; @@ -62,7 +62,7 @@ class AddedTripBuilderTest { private static final String HEADSIGN = "TEST TRIP TOWARDS TEST ISLAND"; /* Transit model */ - private static final TransitModelForTest MODEL_TEST = TransitModelForTest.of(); + private static final TimetableRepositoryForTest MODEL_TEST = TimetableRepositoryForTest.of(); private static final RegularStop STOP_A = MODEL_TEST.stop("A").build(); private static final RegularStop STOP_B = MODEL_TEST.stop("B").build(); @@ -77,7 +77,10 @@ class AddedTripBuilderTest { .build(); private final Deduplicator DEDUPLICATOR = new Deduplicator(); - private final TransitModel TRANSIT_MODEL = new TransitModel(STOP_MODEL, DEDUPLICATOR); + private final TimetableRepository TRANSIT_MODEL = new TimetableRepository( + STOP_MODEL, + DEDUPLICATOR + ); private TransitEditorService transitService; private EntityResolver ENTITY_RESOLVER; @@ -85,15 +88,15 @@ class AddedTripBuilderTest { void setUp() { // Add entities to transit model for the entity resolver TRANSIT_MODEL.addAgency(AGENCY); - final TripPattern pattern = TransitModelForTest + final TripPattern pattern = TimetableRepositoryForTest .tripPattern("REPLACED_ROUTE_PATTERN_ID", REPLACED_ROUTE) - .withStopPattern(TransitModelForTest.stopPattern(STOP_A, STOP_B)) + .withStopPattern(TimetableRepositoryForTest.stopPattern(STOP_A, STOP_B)) .build(); TRANSIT_MODEL.addTripPattern(pattern.getId(), pattern); // Crate a scheduled calendar, to have the SERVICE_DATE be within the transit feed coverage CalendarServiceData calendarServiceData = new CalendarServiceData(); - var cal_id = TransitModelForTest.id("CAL_1"); + var cal_id = TimetableRepositoryForTest.id("CAL_1"); calendarServiceData.putServiceDatesForServiceId( cal_id, List.of(SERVICE_DATE.minusDays(1), SERVICE_DATE, SERVICE_DATE.plusDays(1)) @@ -107,7 +110,10 @@ void setUp() { // Create the entity resolver only after the model has been indexed ENTITY_RESOLVER = - new EntityResolver(new DefaultTransitService(TRANSIT_MODEL), TransitModelForTest.FEED_ID); + new EntityResolver( + new DefaultTransitService(TRANSIT_MODEL), + TimetableRepositoryForTest.FEED_ID + ); } @Test @@ -250,7 +256,7 @@ void testAddedTripOnAddedRoute() { var firstTrip = firstAddedTrip.successValue().tripTimes().getTrip(); - var tripId2 = TransitModelForTest.id("TRIP_ID_2"); + var tripId2 = TimetableRepositoryForTest.id("TRIP_ID_2"); var secondAddedTrip = new AddedTripBuilder( transitService, @@ -559,7 +565,7 @@ void testGetTransportMode( ) { // Arrange var route = Route - .of(TransitModelForTest.id(LINE_REF)) + .of(TimetableRepositoryForTest.id(LINE_REF)) .withShortName(SHORT_NAME) .withAgency(AGENCY) .withMode(TransitMode.valueOf(replacedRouteMode)) diff --git a/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java index 3323aaee74c..17fee84cc56 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java @@ -17,7 +17,7 @@ import org.opentripplanner.model.PickDrop; import org.opentripplanner.model.StopTime; import org.opentripplanner.model.calendar.CalendarServiceData; -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.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -32,7 +32,7 @@ import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.UpdateError; import uk.org.siri.siri20.DepartureBoardingActivityEnumeration; @@ -40,9 +40,9 @@ class ModifiedTripBuilderTest { /* Transit model */ - private static final Agency AGENCY = TransitModelForTest.AGENCY; + private static final Agency AGENCY = TimetableRepositoryForTest.AGENCY; private static final ZoneId TIME_ZONE = AGENCY.getTimezone(); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); private static final Station STATION_A = TEST_MODEL.station("A").build(); private static final Station STATION_B = TEST_MODEL.station("B").build(); private static final Station STATION_C = TEST_MODEL.station("C").build(); @@ -65,19 +65,19 @@ class ModifiedTripBuilderTest { .build(); private static final RegularStop STOP_D = TEST_MODEL.stop("D").build(); - private static final Route ROUTE = TransitModelForTest + private static final Route ROUTE = TimetableRepositoryForTest .route("ROUTE_ID") .withAgency(AGENCY) .build(); - private static final TripPattern PATTERN = TransitModelForTest + private static final TripPattern PATTERN = TimetableRepositoryForTest .tripPattern("PATTERN_ID", ROUTE) - .withStopPattern(TransitModelForTest.stopPattern(STOP_A_1, STOP_B_1, STOP_C_1)) + .withStopPattern(TimetableRepositoryForTest.stopPattern(STOP_A_1, STOP_B_1, STOP_C_1)) .build(); - private static final FeedScopedId SERVICE_ID = TransitModelForTest.id("CAL_1"); + private static final FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("CAL_1"); - private static final Trip TRIP = TransitModelForTest + private static final Trip TRIP = TimetableRepositoryForTest .trip("TRIP") .withRoute(ROUTE) .withServiceId(SERVICE_ID) @@ -127,14 +127,17 @@ class ModifiedTripBuilderTest { .withRegularStop(STOP_C_1) .withRegularStop(STOP_D) .build(); - private final TransitModel transitModel = new TransitModel(stopModel, DEDUPLICATOR); + private final TimetableRepository timetableRepository = new TimetableRepository( + stopModel, + DEDUPLICATOR + ); private EntityResolver entityResolver; @BeforeEach void setUp() { // Add entities to transit model for the entity resolver - transitModel.addAgency(AGENCY); - transitModel.addTripPattern(PATTERN.getId(), PATTERN); + timetableRepository.addAgency(AGENCY); + timetableRepository.addTripPattern(PATTERN.getId(), PATTERN); // Crate a scheduled calendar, to have the SERVICE_DATE be within the transit feed coverage CalendarServiceData calendarServiceData = new CalendarServiceData(); @@ -142,15 +145,22 @@ void setUp() { SERVICE_ID, List.of(SERVICE_DATE.minusDays(1), SERVICE_DATE, SERVICE_DATE.plusDays(1)) ); - transitModel.getServiceCodes().put(SERVICE_ID, 0); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); + timetableRepository.getServiceCodes().put(SERVICE_ID, 0); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); // Create transit model index - transitModel.index(); + timetableRepository.index(); // Create the entity resolver only after the model has been indexed entityResolver = - new EntityResolver(new DefaultTransitService(transitModel), TransitModelForTest.FEED_ID); + new EntityResolver( + new DefaultTransitService(timetableRepository), + TimetableRepositoryForTest.FEED_ID + ); } @Test @@ -159,7 +169,7 @@ void testUpdateNoCalls() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of(), false, @@ -188,7 +198,7 @@ void testUpdateCancellation() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of(), true, @@ -211,7 +221,7 @@ void testUpdateSameStops() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -261,7 +271,7 @@ void testUpdateValidationFailure() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -309,7 +319,7 @@ void testUpdateSameStopsDepartEarly() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -359,7 +369,7 @@ void testUpdateUpdatedStop() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -414,7 +424,7 @@ void testUpdateCascading() { TRIP_TIMES, PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall @@ -464,7 +474,7 @@ void testUpdateCascading() { firstResult.successValue().tripTimes(), PATTERN, SERVICE_DATE, - transitModel.getTimeZone(), + timetableRepository.getTimeZone(), entityResolver, List.of( TestCall diff --git a/application/src/test/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandlerTest.java b/application/src/test/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandlerTest.java index 12bdcbbedce..94c4af8d22e 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandlerTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/SiriAlertsUpdateHandlerTest.java @@ -34,7 +34,6 @@ import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.RealTimeUpdateContext; -import org.opentripplanner.updater.siri.SiriAlertsUpdateHandler; import uk.org.ifopt.siri20.StopPlaceRef; import uk.org.siri.siri20.AffectedLineStructure; import uk.org.siri.siri20.AffectedRouteStructure; @@ -81,15 +80,17 @@ public String getFeedName() { public void setUp() throws Exception { super.setUp(); - realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, transitModel); + realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, timetableRepository); if (transitService == null) { - transitService = new DefaultTransitService(transitModel); - transitModel.setUpdaterManager(new GraphUpdaterManager(realTimeUpdateContext, List.of())); + transitService = new DefaultTransitService(timetableRepository); + timetableRepository.setUpdaterManager( + new GraphUpdaterManager(realTimeUpdateContext, List.of()) + ); } else { transitAlertService.getAllAlerts().clear(); } if (alertsUpdateHandler == null) { - transitAlertService = new TransitAlertServiceImpl(transitModel); + transitAlertService = new TransitAlertServiceImpl(timetableRepository); alertsUpdateHandler = new SiriAlertsUpdateHandler(FEED_ID, transitAlertService, Duration.ZERO); } @@ -458,7 +459,7 @@ public void testSiriSxUpdateForTripByVehicleJourney() { assertTrue(transitAlertService.getAllAlerts().isEmpty()); - var modelZoneId = transitModel.getTimeZone(); + var modelZoneId = timetableRepository.getTimeZone(); var situationNumber = "TST:SituationNumber:1234"; var startTime = LocalDateTime.parse("2014-01-01T00:00:00").atZone(modelZoneId); var endTime = LocalDateTime.parse("2014-01-01T23:59:59").atZone(modelZoneId); @@ -497,7 +498,7 @@ public void testSiriSxUpdateForTripAndStopByVehicleJourney() { assertTrue(transitAlertService.getAllAlerts().isEmpty()); - ZoneId zoneId = transitModel.getTimeZone(); + ZoneId zoneId = timetableRepository.getTimeZone(); final String situationNumber = "TST:SituationNumber:1234"; final ZonedDateTime startTime = LocalDateTime.parse("2014-01-01T00:00:00").atZone(zoneId); final ZonedDateTime endTime = LocalDateTime.parse("2014-01-01T23:59:59").atZone(zoneId); diff --git a/application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java b/application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java index 83076998f4d..901842adb45 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/SiriTimetableSnapshotSourceTest.java @@ -2,7 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertFailure; import org.junit.jupiter.api.Disabled; diff --git a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java index bad0c1982e9..489dfef8956 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java @@ -1,10 +1,10 @@ package org.opentripplanner.updater.trip; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.time.LocalDate; import java.time.ZoneId; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.organization.Operator; @@ -14,7 +14,7 @@ public interface RealtimeTestConstants { LocalDate SERVICE_DATE = LocalDate.of(2024, 5, 8); - FeedScopedId SERVICE_ID = TransitModelForTest.id("CAL_1"); + FeedScopedId SERVICE_ID = TimetableRepositoryForTest.id("CAL_1"); String STOP_A1_ID = "A1"; String STOP_B1_ID = "B1"; String STOP_C1_ID = "C1"; @@ -24,8 +24,8 @@ public interface RealtimeTestConstants { Operator OPERATOR1 = Operator.of(id(OPERATOR_1_ID)).withName(OPERATOR_1_ID).build(); String ROUTE_1_ID = "TestRoute1"; - TransitModelForTest TEST_MODEL = TransitModelForTest.of(); - ZoneId TIME_ZONE = ZoneId.of(TransitModelForTest.TIME_ZONE_ID); + TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); + ZoneId TIME_ZONE = ZoneId.of(TimetableRepositoryForTest.TIME_ZONE_ID); Station STATION_A = TEST_MODEL.station("A").build(); Station STATION_B = TEST_MODEL.station("B").build(); Station STATION_C = TEST_MODEL.station("C").build(); @@ -44,5 +44,5 @@ public interface RealtimeTestConstants { .withRegularStop(STOP_D1) .build(); - Route ROUTE_1 = TransitModelForTest.route(ROUTE_1_ID).build(); + Route ROUTE_1 = TimetableRepositoryForTest.route(ROUTE_1_ID).build(); } diff --git a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java index 543bc6d3a17..8231d8868f1 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironment.java @@ -1,6 +1,6 @@ package org.opentripplanner.updater.trip; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; import static org.opentripplanner.updater.trip.UpdateIncrementality.FULL_DATASET; @@ -12,13 +12,13 @@ import org.opentripplanner.DateTimeHelper; import org.opentripplanner.model.TimetableSnapshot; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.model.timetable.TripTimesStringBuilder; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; @@ -42,7 +42,7 @@ public final class RealtimeTestEnvironment implements RealtimeTestConstants { false ); - public final TransitModel transitModel; + public final TimetableRepository timetableRepository; private final SiriTimetableSnapshotSource siriSource; private final TimetableSnapshotSource gtfsSource; private final DateTimeHelper dateTimeHelper; @@ -66,19 +66,19 @@ public static RealtimeTestEnvironmentBuilder gtfs() { return new RealtimeTestEnvironmentBuilder().withSourceType(SourceType.GTFS_RT); } - RealtimeTestEnvironment(SourceType sourceType, TransitModel transitModel) { + RealtimeTestEnvironment(SourceType sourceType, TimetableRepository timetableRepository) { Objects.requireNonNull(sourceType); - this.transitModel = transitModel; + this.timetableRepository = timetableRepository; - this.transitModel.index(); + this.timetableRepository.index(); // SIRI and GTFS-RT cannot be registered with the transit model at the same time // we are actively refactoring to remove this restriction // for the time being you cannot run a SIRI and GTFS-RT test at the same time if (sourceType == SourceType.SIRI) { - siriSource = new SiriTimetableSnapshotSource(PARAMETERS, transitModel); + siriSource = new SiriTimetableSnapshotSource(PARAMETERS, timetableRepository); gtfsSource = null; } else { - gtfsSource = new TimetableSnapshotSource(PARAMETERS, transitModel); + gtfsSource = new TimetableSnapshotSource(PARAMETERS, timetableRepository); siriSource = null; } dateTimeHelper = new DateTimeHelper(TIME_ZONE, SERVICE_DATE); @@ -88,7 +88,7 @@ public static RealtimeTestEnvironmentBuilder gtfs() { * Returns a new fresh TransitService */ public TransitService getTransitService() { - return new DefaultTransitService(transitModel); + return new DefaultTransitService(timetableRepository); } /** @@ -103,7 +103,7 @@ public TripTimes getTripTimesForTrip(FeedScopedId tripId, LocalDate serviceDate) } public String getFeedId() { - return TransitModelForTest.FEED_ID; + return TimetableRepositoryForTest.FEED_ID; } private EstimatedTimetableHandler getEstimatedTimetableHandler(boolean fuzzyMatching) { @@ -219,7 +219,7 @@ private UpdateResult applyEstimatedTimetable( DIFFERENTIAL, new DefaultRealTimeUpdateContext( new Graph(), - transitModel, + timetableRepository, siriSource.getTimetableSnapshotBuffer() ) ); diff --git a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java index 3203d7d49fc..99be7a86a43 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java @@ -1,6 +1,6 @@ package org.opentripplanner.updater.trip; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import java.util.List; import java.util.Objects; @@ -9,7 +9,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.model.StopTime; import org.opentripplanner.model.calendar.CalendarServiceData; -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.network.TripPattern; import org.opentripplanner.transit.model.site.StopLocation; @@ -17,12 +17,15 @@ import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.model.timetable.TripTimesFactory; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; public class RealtimeTestEnvironmentBuilder implements RealtimeTestConstants { private RealtimeTestEnvironment.SourceType sourceType; - private final TransitModel transitModel = new TransitModel(STOP_MODEL, new Deduplicator()); + private final TimetableRepository timetableRepository = new TimetableRepository( + STOP_MODEL, + new Deduplicator() + ); RealtimeTestEnvironmentBuilder withSourceType(RealtimeTestEnvironment.SourceType sourceType) { this.sourceType = sourceType; @@ -31,24 +34,28 @@ RealtimeTestEnvironmentBuilder withSourceType(RealtimeTestEnvironment.SourceType public RealtimeTestEnvironmentBuilder addTrip(TripInput trip) { createTrip(trip); - transitModel.index(); + timetableRepository.index(); return this; } public RealtimeTestEnvironment build() { Objects.requireNonNull(sourceType, "sourceType cannot be null"); - transitModel.initTimeZone(TIME_ZONE); - transitModel.addAgency(TransitModelForTest.AGENCY); + timetableRepository.initTimeZone(TIME_ZONE); + timetableRepository.addAgency(TimetableRepositoryForTest.AGENCY); CalendarServiceData calendarServiceData = new CalendarServiceData(); calendarServiceData.putServiceDatesForServiceId( SERVICE_ID, List.of(SERVICE_DATE.minusDays(1), SERVICE_DATE, SERVICE_DATE.plusDays(1)) ); - transitModel.getServiceCodes().put(SERVICE_ID, 0); - transitModel.updateCalendarServiceData(true, calendarServiceData, DataImportIssueStore.NOOP); + timetableRepository.getServiceCodes().put(SERVICE_ID, 0); + timetableRepository.updateCalendarServiceData( + true, + calendarServiceData, + DataImportIssueStore.NOOP + ); - return new RealtimeTestEnvironment(sourceType, transitModel); + return new RealtimeTestEnvironment(sourceType, timetableRepository); } private Trip createTrip(TripInput tripInput) { @@ -65,10 +72,10 @@ private Trip createTrip(TripInput tripInput) { .withServiceDate(SERVICE_DATE) .build(); - transitModel.addTripOnServiceDate(tripOnServiceDate); + timetableRepository.addTripOnServiceDate(tripOnServiceDate); if (tripInput.route().getOperator() != null) { - transitModel.addOperators(List.of(tripInput.route().getOperator())); + timetableRepository.addOperators(List.of(tripInput.route().getOperator())); } var stopTimes = IntStream @@ -81,17 +88,17 @@ private Trip createTrip(TripInput tripInput) { TripTimes tripTimes = TripTimesFactory.tripTimes(trip, stopTimes, null); - final TripPattern pattern = TransitModelForTest + final TripPattern pattern = TimetableRepositoryForTest .tripPattern(tripInput.id() + "Pattern", tripInput.route()) .withStopPattern( - TransitModelForTest.stopPattern( + TimetableRepositoryForTest.stopPattern( tripInput.stops().stream().map(TripInput.StopCall::stop).toList() ) ) .withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes)) .build(); - transitModel.addTripPattern(pattern.getId(), pattern); + timetableRepository.addTripPattern(pattern.getId(), pattern); return trip; } diff --git a/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java index 1f3f71a2588..93c5ddbdc55 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotManagerTest.java @@ -15,7 +15,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.model.RealTimeTripUpdate; import org.opentripplanner.model.TimetableSnapshot; -import org.opentripplanner.transit.model._data.TransitModelForTest; +import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; import org.opentripplanner.transit.model.timetable.ScheduledTripTimes; @@ -27,18 +27,21 @@ class TimetableSnapshotManagerTest { private static final LocalDate TOMORROW = TODAY.plusDays(1); private static final LocalDate YESTERDAY = TODAY.minusDays(1); - private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of(); - private static final TripPattern PATTERN = TransitModelForTest - .tripPattern("pattern", TransitModelForTest.route("r1").build()) + private static final TimetableRepositoryForTest TEST_MODEL = TimetableRepositoryForTest.of(); + private static final TripPattern PATTERN = TimetableRepositoryForTest + .tripPattern("pattern", TimetableRepositoryForTest.route("r1").build()) .withStopPattern( - TransitModelForTest.stopPattern(TEST_MODEL.stop("1").build(), TEST_MODEL.stop("2").build()) + TimetableRepositoryForTest.stopPattern( + TEST_MODEL.stop("1").build(), + TEST_MODEL.stop("2").build() + ) ) .build(); private static final RealTimeTripTimes TRIP_TIMES = RealTimeTripTimes.of( ScheduledTripTimes .of() .withArrivalTimes("00:00 00:01") - .withTrip(TransitModelForTest.trip("trip").build()) + .withTrip(TimetableRepositoryForTest.trip("trip").build()) .build() ); diff --git a/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java index c3050cf11fe..e817c6e18bb 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/TimetableSnapshotSourceTest.java @@ -33,7 +33,7 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.opentripplanner.updater.GtfsRealtimeFuzzyTripMatcher; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; @@ -48,7 +48,7 @@ public class TimetableSnapshotSourceTest { ZoneIds.NEW_YORK ) .build(); - private TransitModel transitModel; + private TimetableRepository timetableRepository; private TransitService transitService; private final GtfsRealtimeFuzzyTripMatcher TRIP_MATCHER_NOOP = null; @@ -58,8 +58,8 @@ public class TimetableSnapshotSourceTest { @BeforeEach public void setUp() { TestOtpModel model = ConstantsForTests.buildGtfsGraph(ConstantsForTests.SIMPLE_GTFS); - transitModel = model.transitModel(); - transitService = new DefaultTransitService(transitModel); + timetableRepository = model.timetableRepository(); + transitService = new DefaultTransitService(timetableRepository); feedId = transitService.getFeedIds().stream().findFirst().get(); } @@ -284,7 +284,7 @@ public void testHandleModifiedTrip() { private TimetableSnapshotSource defaultUpdater() { return new TimetableSnapshotSource( new TimetableSnapshotSourceParameters(Duration.ZERO, true), - transitModel, + timetableRepository, () -> SERVICE_DATE ); } diff --git a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java index 6b662e8c8f3..77b54c0e962 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java @@ -12,7 +12,7 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.opentripplanner.model.PickDrop; -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.network.TripPattern; import org.opentripplanner.transit.model.timetable.RealTimeState; @@ -63,8 +63,8 @@ void addedTripWithNewRoute() { assertEquals(TransitMode.RAIL, route.getMode()); TransitService transitService = env.getTransitService(); - var fromTransitModel = transitService.getRouteForId(route.getId()); - assertEquals(fromTransitModel, route); + var fromTimetableRepository = transitService.getRouteForId(route.getId()); + assertEquals(fromTimetableRepository, route); var patternsForRoute = transitService.getPatternsForRoute(route); assertEquals(1, patternsForRoute.size()); assertEquals(pattern, patternsForRoute.stream().findFirst().orElseThrow()); @@ -128,11 +128,11 @@ private TripPattern assertAddedTrip(String tripId, RealtimeTestEnvironment env) var snapshot = env.getTimetableSnapshot(); TransitService transitService = env.getTransitService(); - Trip trip = transitService.getTripForId(TransitModelForTest.id(ADDED_TRIP_ID)); + Trip trip = transitService.getTripForId(TimetableRepositoryForTest.id(ADDED_TRIP_ID)); assertNotNull(trip); assertNotNull(transitService.getPatternForTrip(trip)); - var stopA = env.transitModel.getStopModel().getRegularStop(STOP_A1.getId()); + var stopA = env.timetableRepository.getStopModel().getRegularStop(STOP_A1.getId()); // Get the trip pattern of the added trip which goes through stopA var patternsAtA = env.getTimetableSnapshot().getPatternsForStop(stopA); diff --git a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java index b8bd5c4574b..e79ca7f6ce5 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/cancellation/CancellationDeletionTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; diff --git a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java index f45a82b9ba0..8231e21bce7 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/DelayedTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; import org.junit.jupiter.api.Test; diff --git a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java index 45304af5130..c4b4c9e9bbd 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/delay/SkippedTest.java @@ -6,7 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertSuccess; import static org.opentripplanner.updater.trip.UpdateIncrementality.DIFFERENTIAL; diff --git a/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java index 33455cf9b9a..27b6a038418 100644 --- a/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingAvailabilityUpdaterTest.java @@ -3,7 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.opentripplanner.standalone.config.framework.json.JsonSupport.newNodeAdapterForTest; -import static org.opentripplanner.transit.model._data.TransitModelForTest.id; +import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; import com.google.common.util.concurrent.Futures; import java.util.List; @@ -17,7 +17,7 @@ import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces; import org.opentripplanner.standalone.config.routerconfig.updaters.VehicleParkingUpdaterConfig; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.GraphWriterRunnable; @@ -118,7 +118,7 @@ private void runUpdaterOnce(VehicleParkingAvailabilityUpdater updater) { class GraphUpdaterMock extends GraphUpdaterManager { private static final Graph GRAPH = new Graph(); - private static final TransitModel TRANSIT_MODEL = new TransitModel(); + private static final TimetableRepository TRANSIT_MODEL = new TimetableRepository(); public static final DefaultRealTimeUpdateContext REAL_TIME_UPDATE_CONTEXT = new DefaultRealTimeUpdateContext( GRAPH, TRANSIT_MODEL diff --git a/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java index e504e42eb6c..f83680f8aff 100644 --- a/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java @@ -20,7 +20,7 @@ import org.opentripplanner.street.model.edge.StreetVehicleParkingLink; import org.opentripplanner.street.model.edge.VehicleParkingEdge; import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.GraphWriterRunnable; @@ -31,7 +31,7 @@ class VehicleParkingUpdaterTest { private DataSource dataSource; private Graph graph; - private TransitModel transitModel; + private TimetableRepository timetableRepository; private DefaultRealTimeUpdateContext realTimeUpdateContext; private VehicleParkingUpdater vehicleParkingUpdater; @@ -42,14 +42,14 @@ public void setup() { VehicleParkingTestGraphData graphData = new VehicleParkingTestGraphData(); graphData.initGraph(); graph = graphData.getGraph(); - transitModel = graphData.getTransitModel(); - realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, transitModel); + timetableRepository = graphData.getTimetableRepository(); + realTimeUpdateContext = new DefaultRealTimeUpdateContext(graph, timetableRepository); dataSource = (DataSource) Mockito.mock(DataSource.class); when(dataSource.update()).thenReturn(true); - transitModel.index(); - graph.index(transitModel.getStopModel()); + timetableRepository.index(); + graph.index(timetableRepository.getStopModel()); var parameters = new VehicleParkingUpdaterParameters() { @Override @@ -270,7 +270,11 @@ private void assertVehicleParkingsInGraph(int vehicleParkingNumber) { private void runUpdaterOnce() { class GraphUpdaterMock extends GraphUpdaterManager { - public GraphUpdaterMock(Graph graph, TransitModel transitModel, List updaters) { + public GraphUpdaterMock( + Graph graph, + TimetableRepository timetableRepository, + List updaters + ) { super(realTimeUpdateContext, updaters); } @@ -283,7 +287,7 @@ public Future execute(GraphWriterRunnable runnable) { var graphUpdaterManager = new GraphUpdaterMock( graph, - transitModel, + timetableRepository, List.of(vehicleParkingUpdater) ); graphUpdaterManager.startUpdaters(); diff --git a/application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java index 4f10fb2d64b..5fa7c5e8df0 100644 --- a/application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_position/RealtimeVehicleMatcherTest.java @@ -29,7 +29,7 @@ import org.opentripplanner.model.StopTime; import org.opentripplanner.service.realtimevehicles.internal.DefaultRealtimeVehicleService; import org.opentripplanner.standalone.config.routerconfig.updaters.VehiclePositionsUpdaterConfig; -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.framework.FeedScopedId; import org.opentripplanner.transit.model.network.Route; @@ -41,9 +41,9 @@ public class RealtimeVehicleMatcherTest { - private final TransitModelForTest testModel = TransitModelForTest.of(); + private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); - private static final Route ROUTE = TransitModelForTest.route("1").build(); + private static final Route ROUTE = TimetableRepositoryForTest.route("1").build(); private static final Set FEATURES = Set.of( POSITION, STOP_POSITION, @@ -51,7 +51,7 @@ public class RealtimeVehicleMatcherTest { ); ZoneId zoneId = ZoneIds.BERLIN; String tripId = "trip1"; - FeedScopedId scopedTripId = TransitModelForTest.id(tripId); + FeedScopedId scopedTripId = TimetableRepositoryForTest.id(tripId); @Test public void matchRealtimeVehiclesToTrip() { @@ -89,15 +89,15 @@ public void tripNotFoundInPattern() { final String secondTripId = "trip2"; - var trip1 = TransitModelForTest.trip(tripId).build(); - var trip2 = TransitModelForTest.trip(secondTripId).build(); + var trip1 = TimetableRepositoryForTest.trip(tripId).build(); + var trip2 = TimetableRepositoryForTest.trip(secondTripId).build(); var stopTimes = testModel.stopTimesEvery5Minutes(3, trip1, T11_00); var pattern = tripPattern(trip1, stopTimes); // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, ignored -> trip2, ignored -> pattern, (id, time) -> pattern, @@ -119,8 +119,8 @@ public void sequenceId() { var service = new DefaultRealtimeVehicleService(null); var tripId = "trip1"; - var scopedTripId = TransitModelForTest.id(tripId); - var trip1 = TransitModelForTest.trip(tripId).build(); + var scopedTripId = TimetableRepositoryForTest.id(tripId); + var trip1 = TimetableRepositoryForTest.trip(tripId).build(); var stopTimes = List.of( testModel.stopTime(trip1, 10), @@ -134,7 +134,7 @@ public void sequenceId() { // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -176,7 +176,7 @@ void invalidStopSequence() { private void testVehiclePositions(VehiclePosition pos) { var service = new DefaultRealtimeVehicleService(null); - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var stopTimes = List.of( testModel.stopTime(trip, 0), testModel.stopTime(trip, 1), @@ -193,7 +193,7 @@ private void testVehiclePositions(VehiclePosition pos) { // Map positions to trips in feed var matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -224,7 +224,7 @@ private void testVehiclePositions(VehiclePosition pos) { private void testVehiclePositionOccupancy(VehiclePosition pos) { var service = new DefaultRealtimeVehicleService(null); - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var stopTimes = List.of( testModel.stopTime(trip, 0), testModel.stopTime(trip, 1), @@ -241,7 +241,7 @@ private void testVehiclePositionOccupancy(VehiclePosition pos) { // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -267,11 +267,11 @@ public void clearOldTrips() { var tripId1 = "trip1"; var tripId2 = "trip2"; - var scopedTripId1 = TransitModelForTest.id(tripId1); - var scopedTripId2 = TransitModelForTest.id(tripId2); + var scopedTripId1 = TimetableRepositoryForTest.id(tripId1); + var scopedTripId2 = TimetableRepositoryForTest.id(tripId2); - var trip1 = TransitModelForTest.trip(tripId1).build(); - var trip2 = TransitModelForTest.trip(tripId2).build(); + var trip1 = TimetableRepositoryForTest.trip(tripId1).build(); + var trip2 = TimetableRepositoryForTest.trip(tripId2).build(); var stopTimes1 = List.of( testModel.stopTime(trip1, 0), @@ -297,7 +297,7 @@ public void clearOldTrips() { // Map positions to trips in feed RealtimeVehiclePatternMatcher matcher = new RealtimeVehiclePatternMatcher( - TransitModelForTest.FEED_ID, + TimetableRepositoryForTest.FEED_ID, tripForId::get, patternForTrip::get, (id, time) -> patternForTrip.get(id), @@ -337,7 +337,7 @@ static Stream inferenceTestCases() { @ParameterizedTest(name = "{0} should resolve to {1}") @MethodSource("inferenceTestCases") void inferServiceDayOfTripAt6(String time, String expectedDate) { - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var sixOclock = (int) Duration.ofHours(18).toSeconds(); var fivePast6 = sixOclock + 300; @@ -357,7 +357,7 @@ void inferServiceDayOfTripAt6(String time, String expectedDate) { @Test void inferServiceDateCloseToMidnight() { - var trip = TransitModelForTest.trip(tripId).build(); + var trip = TimetableRepositoryForTest.trip(tripId).build(); var fiveToMidnight = LocalTime.parse("23:55").toSecondOfDay(); var fivePastMidnight = fiveToMidnight + (10 * 60); diff --git a/application/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java index 99910e04f7c..4eea85b4dc9 100644 --- a/application/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/GeofencingVertexUpdaterTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.opentripplanner.street.model._data.StreetModelForTest.intersectionVertex; import static org.opentripplanner.street.model._data.StreetModelForTest.streetEdge; -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; diff --git a/application/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java index 17eb3fb3c63..2ca93a10f28 100644 --- a/application/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_rental/VehicleRentalUpdaterTest.java @@ -14,7 +14,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.service.vehiclerental.internal.DefaultVehicleRentalService; import org.opentripplanner.service.vehiclerental.model.VehicleRentalPlace; -import org.opentripplanner.transit.service.TransitModel; +import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.DefaultRealTimeUpdateContext; import org.opentripplanner.updater.GraphUpdaterManager; import org.opentripplanner.updater.GraphWriterRunnable; @@ -45,7 +45,10 @@ void failingDatasourceCountsAsPrimed() { static class MockManager extends GraphUpdaterManager { public MockManager(VehicleRentalUpdater updater) { - super(new DefaultRealTimeUpdateContext(new Graph(), new TransitModel()), List.of(updater)); + super( + new DefaultRealTimeUpdateContext(new Graph(), new TimetableRepository()), + List.of(updater) + ); } @Override From 75718169870e25dea17ff73284f8afcd614d3cd7 Mon Sep 17 00:00:00 2001 From: Vincent Paturet Date: Wed, 16 Oct 2024 11:22:06 +0200 Subject: [PATCH 3/3] Fix merge conflict --- .../stopconsolidation/DecorateConsolidatedStopNamesTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java index 4929c3872b3..bcbc84fc4b8 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/DecorateConsolidatedStopNamesTest.java @@ -102,12 +102,12 @@ void keepRegularTransfer() { } private static DecorateConsolidatedStopNames defaultFilter() { - var transitModel = TestStopConsolidationModel.buildTransitModel(); + var timetableRepository = TestStopConsolidationModel.buildTimetableRepository(); var repo = new DefaultStopConsolidationRepository(); repo.addGroups(GROUPS); - var service = new DefaultStopConsolidationService(repo, transitModel); + var service = new DefaultStopConsolidationService(repo, timetableRepository); return new DecorateConsolidatedStopNames(service); } }