Skip to content

Commit

Permalink
remove the feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Oct 31, 2024
1 parent 44c94d1 commit 06cf46d
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public enum ApiRequestMode {
}

public Collection<TransitMode> getTransitModes() {
if (this == BUS && OTPFeature.GtfsCoach.isOff()) {
return List.of(TransitMode.BUS, TransitMode.COACH);
}

return transitModes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -134,19 +133,6 @@ static Stream<Arguments> 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<Arguments> transportModesCasesWithCoach() {
return Stream.of(
of(
List.of(mode("BUS")),
"[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS]}]}]"
Expand All @@ -165,16 +151,6 @@ static Stream<Arguments> transportModesCasesWithCoach() {
@ParameterizedTest
@MethodSource("transportModesCases")
void modes(List<Map<String, Object>> modes, String expectedFilters) {
OTPFeature.GtfsCoach.testOff(() -> testModes(modes, expectedFilters));
}

@ParameterizedTest
@MethodSource("transportModesCasesWithCoach")
void modesWithCoach(List<Map<String, Object>> modes, String expectedFilters) {
OTPFeature.GtfsCoach.testOn(() -> testModes(modes, expectedFilters));
}

private void testModes(List<Map<String, Object>> modes, String expectedFilters) {
Map<String, Object> arguments = Map.of("transportModes", modes);

var routeRequest = LegacyRouteRequestMapper.toRouteRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ static Stream<Arguments> 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),
Expand Down Expand Up @@ -86,16 +88,4 @@ static Stream<Arguments> 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));
});
}
}
1 change: 0 additions & 1 deletion doc/user/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. | | |
Expand Down

0 comments on commit 06cf46d

Please sign in to comment.