From 06cf46dcf43b9cb9b8b785efa8db02e98b73a7d2 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Thu, 31 Oct 2024 15:27:09 +0000 Subject: [PATCH] remove the feature flag --- .../parameter/QualifiedModeSetTest.java | 2 +- .../api/parameter/ApiRequestMode.java | 4 ---- .../framework/application/OTPFeature.java | 8 ------- .../gtfs/mapping/TransitModeMapper.java | 2 +- .../LegacyRouteRequestMapperTest.java | 24 ------------------- .../gtfs/mapping/TransitModeMapperTest.java | 14 ++--------- doc/user/Configuration.md | 1 - 7 files changed, 4 insertions(+), 51 deletions(-) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java index ad344713a74..7c3bf410192 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java @@ -231,7 +231,7 @@ void carHail() { @Test void carHailWithTransit() { var modeSet = new QualifiedModeSet("CAR_HAIL,BUS,RAIL"); - assertEquals(Set.of(COACH, BUS, RAIL), Set.copyOf(modeSet.getTransitModes())); + assertEquals(Set.of(BUS, RAIL), Set.copyOf(modeSet.getTransitModes())); assertEquals(WALK, modeSet.getRequestModes().directMode); assertEquals(CAR_HAILING, modeSet.getRequestModes().accessMode); diff --git a/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java b/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java index c78e5dfb66f..5681bd1d76d 100644 --- a/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java +++ b/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java @@ -42,10 +42,6 @@ public enum ApiRequestMode { } public Collection getTransitModes() { - if (this == BUS && OTPFeature.GtfsCoach.isOff()) { - return List.of(TransitMode.BUS, TransitMode.COACH); - } - return transitModes; } } diff --git a/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java b/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java index c8816981974..324f5397673 100644 --- a/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java +++ b/application/src/main/java/org/opentripplanner/framework/application/OTPFeature.java @@ -38,14 +38,6 @@ public enum OTPFeature { "Should there be a transfer leg when transferring on the very same stop. Note that for in-seat/interlined transfers no transfer leg will be generated." ), FloatingBike(true, false, "Enable floating bike routing."), - GtfsCoach( - false, - false, - """ - When parsing GTFS data, treat GTFS route type 200 to 299 as coach routes instead of bus routes. - When using the GTFS GraphQL API, do not return coach routes when only BUS is specified as a mode. - """ - ), GtfsGraphQlApi(true, false, "Enable the [GTFS GraphQL API](apis/GTFS-GraphQL-API.md)."), GtfsGraphQlApiRentalStationFuzzyMatching( false, diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java index 1b5044e3530..aef5399475e 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java @@ -21,7 +21,7 @@ public static TransitMode mapMode(int routeType) { // Railway Service return TransitMode.RAIL; } else if (routeType >= 200 && routeType < 300) { //Coach Service - return OTPFeature.GtfsCoach.isOn() ? TransitMode.COACH : TransitMode.BUS; + return TransitMode.COACH; } else if (routeType >= 300 && routeType < 500) { //Suburban Railway Service and Urban Railway service if (routeType >= 401 && routeType <= 402) { return TransitMode.SUBWAY; 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 b42ea828462..78f287f78ac 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 @@ -27,7 +27,6 @@ import org.opentripplanner.apis.gtfs.TestRoutingService; import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; import org.opentripplanner.ext.fares.impl.DefaultFareService; -import org.opentripplanner.framework.application.OTPFeature; import org.opentripplanner.model.plan.PlanTestConstants; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.preference.TimeSlopeSafetyTriangle; @@ -134,19 +133,6 @@ static Stream transportModesCases() { return Stream.of( of(List.of(), "[ExcludeAllTransitFilter{}]"), of(List.of(mode("BICYCLE")), "[ExcludeAllTransitFilter{}]"), - of( - List.of(mode("BUS")), - "[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, COACH]}]}]" - ), - of( - List.of(mode("BUS"), mode("MONORAIL")), - "[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, COACH, MONORAIL]}]}]" - ) - ); - } - - static Stream transportModesCasesWithCoach() { - return Stream.of( of( List.of(mode("BUS")), "[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS]}]}]" @@ -165,16 +151,6 @@ static Stream transportModesCasesWithCoach() { @ParameterizedTest @MethodSource("transportModesCases") void modes(List> modes, String expectedFilters) { - OTPFeature.GtfsCoach.testOff(() -> testModes(modes, expectedFilters)); - } - - @ParameterizedTest - @MethodSource("transportModesCasesWithCoach") - void modesWithCoach(List> modes, String expectedFilters) { - OTPFeature.GtfsCoach.testOn(() -> testModes(modes, expectedFilters)); - } - - private void testModes(List> modes, String expectedFilters) { Map arguments = Map.of("transportModes", modes); var routeRequest = LegacyRouteRequestMapper.toRouteRequest( diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java index ac1da483c86..d5086d153b6 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java @@ -45,6 +45,8 @@ static Stream testCases() { // https://groups.google.com/g/gtfs-changes/c/keT5rTPS7Y0/m/71uMz2l6ke0J?pli=1 Arguments.of(100, RAIL), Arguments.of(199, RAIL), + Arguments.of(200, COACH), + Arguments.of(299, COACH), Arguments.of(400, RAIL), Arguments.of(401, SUBWAY), Arguments.of(402, SUBWAY), @@ -86,16 +88,4 @@ static Stream testCases() { void map(int mode, TransitMode expectedMode) { assertEquals(expectedMode, TransitModeMapper.mapMode(mode)); } - - @Test - void testCoachFeatureFlag() { - OTPFeature.GtfsCoach.testOff(() -> { - assertEquals(BUS, TransitModeMapper.mapMode(200)); - assertEquals(BUS, TransitModeMapper.mapMode(299)); - }); - OTPFeature.GtfsCoach.testOn(() -> { - assertEquals(COACH, TransitModeMapper.mapMode(200)); - assertEquals(COACH, TransitModeMapper.mapMode(299)); - }); - } } diff --git a/doc/user/Configuration.md b/doc/user/Configuration.md index 1ae152d331c..bca974f8617 100644 --- a/doc/user/Configuration.md +++ b/doc/user/Configuration.md @@ -228,7 +228,6 @@ Here is a list of all features which can be toggled on/off and their default val | `DebugUi` | Enable the debug GraphQL client and web UI and located at the root of the web server as well as the debug map tiles it uses. Be aware that the map tiles are not a stable API and can change without notice. Use the [vector tiles feature if](sandbox/MapboxVectorTilesApi.md) you want a stable map tiles API. | ✓️ | | | `ExtraTransferLegOnSameStop` | Should there be a transfer leg when transferring on the very same stop. Note that for in-seat/interlined transfers no transfer leg will be generated. | | | | `FloatingBike` | Enable floating bike routing. | ✓️ | | -| `GtfsCoach` | When parsing GTFS data, treat GTFS route type 200 to 299 as coach routes instead of bus routes. When using the GTFS GraphQL API, do not return coach routes when only BUS is specified as a mode. | | | | `GtfsGraphQlApi` | Enable the [GTFS GraphQL API](apis/GTFS-GraphQL-API.md). | ✓️ | | | `GtfsGraphQlApiRentalStationFuzzyMatching` | Does vehicleRentalStation query also allow ids that are not feed scoped. | | | | `MinimumTransferTimeIsDefinitive` | If the minimum transfer time is a lower bound (default) or the definitive time for the transfer. Set this to `true` if you want to set a transfer time lower than what OTP derives from OSM data. | | |