Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-2.x' into upstream-merge-2…
Browse files Browse the repository at this point in the history
…024-08-01
  • Loading branch information
leonardehrenfried committed Aug 6, 2024
2 parents 74949a1 + c58311e commit 5775704
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 43 deletions.
4 changes: 2 additions & 2 deletions docs/RouteRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -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."


<h3 id="rd_maxJourneyDuration">maxJourneyDuration</h3>
Expand Down Expand Up @@ -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.


<h3 id="rd_accessEgress_maxStopCount">maxStopCount</h3>
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -65,12 +69,13 @@ public void digitransitStopPropertyMapperTest() {
);

Map<String, Object> 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
Expand All @@ -86,7 +91,7 @@ public void digitransitStopPropertyMapperTranslationTest() {
);

Map<String, Object> 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"));
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -52,10 +54,7 @@ protected static Collection<KeyValue> 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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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()),
Expand Down

0 comments on commit 5775704

Please sign in to comment.