Search in sources :

Example 1 with RouteRefStructure

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"));
}
Also used : OtpTransitServiceBuilder(org.opentripplanner.model.impl.OtpTransitServiceBuilder) ServiceJourney(org.rutebanken.netex.model.ServiceJourney) Trip(org.opentripplanner.model.Trip) HierarchicalMapById(org.opentripplanner.netex.loader.util.HierarchicalMapById) JourneyPattern(org.rutebanken.netex.model.JourneyPattern) JourneyPatternRefStructure(org.rutebanken.netex.model.JourneyPatternRefStructure) RouteRefStructure(org.rutebanken.netex.model.RouteRefStructure) Route(org.opentripplanner.model.Route) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Route (org.opentripplanner.model.Route)1 Trip (org.opentripplanner.model.Trip)1 OtpTransitServiceBuilder (org.opentripplanner.model.impl.OtpTransitServiceBuilder)1 HierarchicalMapById (org.opentripplanner.netex.loader.util.HierarchicalMapById)1 JourneyPattern (org.rutebanken.netex.model.JourneyPattern)1 JourneyPatternRefStructure (org.rutebanken.netex.model.JourneyPatternRefStructure)1 RouteRefStructure (org.rutebanken.netex.model.RouteRefStructure)1 ServiceJourney (org.rutebanken.netex.model.ServiceJourney)1