-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4529 from HSLdevcom/vector-tile-translations
Translations for vector tiles sandbox
- Loading branch information
Showing
27 changed files
with
607 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
src/ext-test/java/org/opentripplanner/ext/vectortiles/StopsLayerTest.java
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package org.opentripplanner.ext.vectortiles.layers.stops; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
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.transit.model.basic.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.service.DefaultTransitService; | ||
import org.opentripplanner.transit.service.StopModel; | ||
import org.opentripplanner.transit.service.TransitModel; | ||
|
||
public class StopsLayerTest { | ||
|
||
private RegularStop stop; | ||
|
||
@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 = | ||
RegularStop | ||
.of(new FeedScopedId("F", "name")) | ||
.withName(nameTranslations) | ||
.withDescription(descTranslations) | ||
.withCoordinate(50, 10) | ||
.build(); | ||
} | ||
|
||
@Test | ||
public void digitransitStopPropertyMapperTest() { | ||
var deduplicator = new Deduplicator(); | ||
var transitModel = new TransitModel(new StopModel(), deduplicator); | ||
transitModel.index(); | ||
var transitService = new DefaultTransitService(transitModel); | ||
|
||
DigitransitStopPropertyMapper mapper = DigitransitStopPropertyMapper.create( | ||
transitService, | ||
new Locale("en-US") | ||
); | ||
|
||
Map<String, Object> map = new HashMap<>(); | ||
mapper.map(stop).forEach(o -> map.put(o.first, o.second)); | ||
|
||
assertEquals("F:name", map.get("gtfsId")); | ||
assertEquals("name", map.get("name")); | ||
assertEquals("desc", map.get("desc")); | ||
} | ||
|
||
@Test | ||
public void digitransitStopPropertyMapperTranslationTest() { | ||
var deduplicator = new Deduplicator(); | ||
var transitModel = new TransitModel(new StopModel(), deduplicator); | ||
transitModel.index(); | ||
var transitService = new DefaultTransitService(transitModel); | ||
|
||
DigitransitStopPropertyMapper mapper = DigitransitStopPropertyMapper.create( | ||
transitService, | ||
new Locale("de") | ||
); | ||
|
||
Map<String, Object> map = new HashMap<>(); | ||
mapper.map(stop).forEach(o -> map.put(o.first, o.second)); | ||
|
||
assertEquals("nameDE", map.get("name")); | ||
assertEquals("descDE", map.get("desc")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.