use of org.rutebanken.netex.model.RouteRefStructure in project OpenTripPlanner by opentripplanner.
the class TripMapperTest method mapTripWithRouteRefViaJourneyPattern.
@Test
public void mapTripWithRouteRefViaJourneyPattern() {
OtpTransitServiceBuilder transitBuilder = new OtpTransitServiceBuilder();
Route route = new Route();
route.setId(ID_FACTORY.createId(ROUTE_ID));
transitBuilder.getRoutes().add(route);
JourneyPattern journeyPattern = new JourneyPattern().withId(JOURNEY_PATTERN_ID);
journeyPattern.setRouteRef(new RouteRefStructure().withRef(ROUTE_ID));
ServiceJourney serviceJourney = createExampleServiceJourney();
serviceJourney.setJourneyPatternRef(MappingSupport.createWrappedRef(JOURNEY_PATTERN_ID, JourneyPatternRefStructure.class));
org.rutebanken.netex.model.Route netexRoute = new org.rutebanken.netex.model.Route();
netexRoute.setLineRef(LINE_REF);
netexRoute.setId(ROUTE_ID);
HierarchicalMapById<org.rutebanken.netex.model.Route> routeById = new HierarchicalMapById<>();
routeById.add(netexRoute);
HierarchicalMapById<JourneyPattern> journeyPatternById = new HierarchicalMapById<>();
journeyPatternById.add(journeyPattern);
TripMapper tripMapper = new TripMapper(ID_FACTORY, transitBuilder.getRoutes(), routeById, journeyPatternById, Collections.emptySet());
Trip trip = tripMapper.mapServiceJourney(serviceJourney);
assertEquals(trip.getId(), ID_FACTORY.createId("RUT:ServiceJourney:1"));
}
Aggregations