diff --git a/docs/RouteRequest.md b/docs/RouteRequest.md index 14d937eeb63..a8baaf1603b 100644 --- a/docs/RouteRequest.md +++ b/docs/RouteRequest.md @@ -254,7 +254,7 @@ This is a performance limit and should therefore be set high. Results close to t guaranteed to be optimal. Use itinerary-filters to limit what is presented to the client. The duration can be set per mode(`maxDirectStreetDurationForMode`), because some street modes searches are much more resource intensive than others. A default value is applied if the mode specific value -do not exist." +does not exist."

maxJourneyDuration

@@ -403,7 +403,7 @@ This is a performance limit and should therefore be set high. Results close to t guaranteed to be optimal. Use itinerary-filters to limit what is presented to the client. The duration can be set per mode(`maxDurationForMode`), because some street modes searches are much more resource intensive than others. A default value is applied if the mode specific value -do not exist. +does not exist.

maxStopCount

diff --git a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java b/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java index 4c3e60701bd..7760eee13b8 100644 --- a/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java +++ b/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java @@ -1,56 +1,60 @@ 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 java.util.HashMap; import java.util.Locale; import java.util.Map; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.opentripplanner.ext.vectortiles.layers.TestTransitService; +import org.opentripplanner.framework.geometry.WgsCoordinate; +import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.TranslatedString; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; 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.StopModel; import org.opentripplanner.transit.service.TransitModel; public class StopsLayerTest { - private RegularStop stop; + private static final I18NString NAME_TRANSLATIONS = TranslatedString.getI18NString( + new HashMap<>() { + { + put(null, "name"); + put("de", "nameDE"); + } + }, + false, + false + ); + private static final I18NString DESC_TRANSLATIONS = TranslatedString.getI18NString( + new HashMap<>() { + { + put(null, "desc"); + put("de", "descDE"); + } + }, + false, + false + ); - @BeforeEach - public void setUp() { - var nameTranslations = TranslatedString.getI18NString( - new HashMap<>() { - { - put(null, "name"); - put("de", "nameDE"); - } - }, - false, - false - ); - var descTranslations = TranslatedString.getI18NString( - new HashMap<>() { - { - put(null, "desc"); - put("de", "descDE"); - } - }, - false, - false - ); - stop = - StopModel - .of() - .regularStop(new FeedScopedId("F", "name")) - .withName(nameTranslations) - .withDescription(descTranslations) - .withCoordinate(50, 10) - .build(); - } + private static final Station STATION = Station + .of(id("station1")) + .withCoordinate(WgsCoordinate.GREENWICH) + .withName(I18NString.of("A Station")) + .build(); + private static final RegularStop STOP = StopModel + .of() + .regularStop(new FeedScopedId("F", "name")) + .withName(NAME_TRANSLATIONS) + .withDescription(DESC_TRANSLATIONS) + .withCoordinate(50, 10) + .withParentStation(STATION) + .build(); @Test public void digitransitStopPropertyMapperTest() { @@ -65,12 +69,13 @@ public void digitransitStopPropertyMapperTest() { ); Map map = new HashMap<>(); - mapper.map(stop).forEach(o -> map.put(o.key(), o.value())); + mapper.map(STOP).forEach(o -> map.put(o.key(), o.value())); assertEquals("F:name", map.get("gtfsId")); assertEquals("name", map.get("name")); assertEquals("desc", map.get("desc")); assertEquals("[{\"gtfsType\":100}]", map.get("routes")); + assertEquals(STATION.getId().toString(), map.get("parentStation")); } @Test @@ -86,7 +91,7 @@ public void digitransitStopPropertyMapperTranslationTest() { ); Map map = new HashMap<>(); - mapper.map(stop).forEach(o -> map.put(o.key(), o.value())); + mapper.map(STOP).forEach(o -> map.put(o.key(), o.value())); assertEquals("nameDE", map.get("name")); assertEquals("descDE", map.get("desc")); diff --git a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java b/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java index d10e221b1d5..edf9c7d8188 100644 --- a/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java +++ b/src/ext/java/org/opentripplanner/ext/vectortiles/layers/stops/DigitransitStopPropertyMapper.java @@ -1,5 +1,7 @@ package org.opentripplanner.ext.vectortiles.layers.stops; +import static org.opentripplanner.inspector.vector.KeyValue.kv; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Collection; @@ -52,10 +54,7 @@ protected static Collection getBaseKeyValues( new KeyValue("desc", i18NStringMapper.mapToApi(stop.getDescription())), new KeyValue("type", getType(transitService, stop)), new KeyValue("routes", getRoutes(transitService, stop)), - new KeyValue( - "parentStation", - stop.getParentStation() != null ? stop.getParentStation().getId() : null - ) + kv("parentStation", stop.getParentStation() != null ? stop.getParentStation().getId() : null) ); } diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java b/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java index 6fa33aac267..dc91388458a 100644 --- a/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java +++ b/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java @@ -514,7 +514,7 @@ the access legs used. In other cases where the access(CAR) is faster than transi guaranteed to be optimal. Use itinerary-filters to limit what is presented to the client. The duration can be set per mode(`maxDurationForMode`), because some street modes searches are much more resource intensive than others. A default value is applied if the mode specific value -do not exist. +does not exist. """ ) .asDuration(dftAccessEgress.maxDuration().defaultValue()), @@ -554,7 +554,7 @@ duration can be set per mode(`maxDurationForMode`), because some street modes se guaranteed to be optimal. Use itinerary-filters to limit what is presented to the client. The duration can be set per mode(`maxDirectStreetDurationForMode`), because some street modes searches are much more resource intensive than others. A default value is applied if the mode specific value -do not exist." +does not exist." """ ) .asDuration(dft.maxDirectDuration().defaultValue()),