Package org.onebusaway.transit_data_federation.impl.transit_graph

Examples of org.onebusaway.transit_data_federation.impl.transit_graph.RouteEntryImpl


    graph.refreshRouteMapping();
  }

  private RouteEntryImpl processRoute(TransitGraphImpl graph, Route route) {
    RouteEntryImpl routeEntry = new RouteEntryImpl();
    routeEntry.setId(unique(route.getId()));
    graph.putRouteEntry(routeEntry);
    return routeEntry;
  }
View Full Code Here


    affects9.setRouteId(ServiceAlertLibrary.id("1", "RouteX"));
    affects9.setDirectionId("0");
    builder9.addAffects(affects9);
    _service.createOrUpdateServiceAlert(builder9, "1");

    RouteEntryImpl route = route("RouteX");
    routeCollection("RouteX", route);
    StopEntryImpl stop = stop("10020", 47.0, -122.0);
    TripEntryImpl trip = trip("TripA");
    trip.setRoute(route);
    trip.setDirectionId("1");
View Full Code Here

    affects9.setRouteId(ServiceAlertLibrary.id("1", "RouteX"));
    affects9.setDirectionId("0");
    builder9.addAffects(affects9);
    _service.createOrUpdateServiceAlert(builder9, "1");

    RouteEntryImpl route = route("RouteX");
    routeCollection("RouteX", route);
    StopEntryImpl stop = stop("10020", 47.0, -122.0);
    TripEntryImpl trip = trip("TripA");
    trip.setRoute(route);
    trip.setDirectionId("1");
View Full Code Here

  }

  @Test
  public void testGenerateRouteNarratives() {

    RouteEntryImpl r1 = route("routeA1");
    RouteEntryImpl r2 = route("routeA2");
    RouteCollectionEntryImpl rc = routeCollection("routeA", r1, r2);

    TripEntry t1 = trip("t1");
    TripEntry t2 = trip("t2");
    TripEntry t3 = trip("t3");

    // r2's values should win out over r1's because it has more trips
    r1.setTrips(Arrays.asList(t1));
    r2.setTrips(Arrays.asList(t2, t3));

    Mockito.when(_transitGraphDao.getAllRouteCollections()).thenReturn(
        Arrays.asList((RouteCollectionEntry) rc));

    Route route1 = new Route();
    route1.setId(r1.getId());
    route1.setBikesAllowed(0);
    route1.setColor("#000000");
    route1.setDesc("Route One Desc");
    route1.setLongName("Route One");
    route1.setShortName("One");
    route1.setTextColor("#ff0000");
    route1.setType(3);
    route1.setUrl("http://agency.gov/route-one");

    Route route2 = new Route();
    route2.setId(r2.getId());
    route2.setBikesAllowed(1);
    route2.setColor("#0000ff");
    route2.setDesc("Route Two Desc");
    route2.setLongName("Route Two");
    route2.setShortName("Two");
    route2.setTextColor("#000000");
    route2.setType(3);
    route2.setUrl("http://agency.gov/route-two");

    Mockito.when(_gtfsDao.getRouteForId(r1.getId())).thenReturn(route1);
    Mockito.when(_gtfsDao.getRouteForId(r2.getId())).thenReturn(route2);

    _task.generateRouteNarratives(_provider);

    RouteCollectionNarrative narrative = _provider.getNarrativeForRouteCollectionId(rc.getId());
    assertEquals(route2.getColor(), narrative.getColor());
View Full Code Here

  public void testGetRouteId() {

    RouteCollectionEntryImpl routeCollection = new RouteCollectionEntryImpl();
    routeCollection.setId(new AgencyAndId("2", "R10C"));

    RouteEntryImpl route = new RouteEntryImpl();
    route.setId(new AgencyAndId("2", "R10"));
    route.setParent(routeCollection);

    Mockito.when(_dao.getRouteForId(route.getId())).thenReturn(route);
    Id routeId = _source.getRouteId("R10");
    assertEquals("2", routeId.getAgencyId());
    assertEquals("R10C", routeId.getId());

    routeId = _source.getRouteId("R11");
View Full Code Here

  @Test
  public void testGetStopsForRoute() {

    AgencyAndId routeId = new AgencyAndId("1", "route");

    RouteEntryImpl route = new RouteEntryImpl();
    route.setId(new AgencyAndId("1", "raw_route"));
    List<RouteEntry> routes = Arrays.asList((RouteEntry) route);

    RouteCollectionEntryImpl routeCollection = new RouteCollectionEntryImpl();
    routeCollection.setId(routeId);
    routeCollection.setChildren(routes);
    route.setParent(routeCollection);

    Mockito.when(_transitGraphDao.getRouteCollectionForId(routeId)).thenReturn(
        routeCollection);

    RouteCollectionNarrative.Builder rcNarrative = RouteCollectionNarrative.builder();
    Mockito.when(_narrativeService.getRouteCollectionForId(routeId)).thenReturn(
        rcNarrative.create());

    StopEntryImpl stopA = stop("stopA", 47.0, -122.0);
    StopEntryImpl stopB = stop("stopB", 47.1, -122.1);
    StopEntryImpl stopC = stop("stopC", 47.2, -122.2);

    BlockEntryImpl blockA = block("blockA");
    TripEntryImpl tripA = trip("tripA", "sidA");
    TripEntryImpl tripB = trip("tripB", "sidA");

    tripA.setRoute(route);
    tripA.setDirectionId("0");
    tripB.setRoute(route);
    tripB.setDirectionId("1");

    route.setTrips(Arrays.asList((TripEntry) tripA, tripB));

    TripNarrative.Builder tnA = TripNarrative.builder();
    tnA.setTripHeadsign("Destination A");
    Mockito.when(_narrativeService.getTripForId(tripA.getId())).thenReturn(
        tnA.create());
View Full Code Here

    agency.setId(id);
    return agency;
  }

  public static RouteEntryImpl route(String id) {
    RouteEntryImpl route = new RouteEntryImpl();
    route.setId(aid(id));
    return route;
  }
View Full Code Here

    AgencyEntryImpl agency = new AgencyEntryImpl();
    agency.setId("A");
    graph.putAgencyEntry(agency);
    graph.refreshAgencyMapping();

    RouteEntryImpl routeA = new RouteEntryImpl();
    routeA.setId(new AgencyAndId("A", "routeA"));
    graph.putRouteEntry(routeA);

    RouteEntryImpl routeB = new RouteEntryImpl();
    routeB.setId(new AgencyAndId("A", "routeB"));
    graph.putRouteEntry(routeB);

    RouteCollectionEntriesFactory factory = new RouteCollectionEntriesFactory();
    GtfsRelationalDao gtfsDao = Mockito.mock(GtfsRelationalDao.class);
    factory.setGtfsDao(gtfsDao);
    factory.setUniqueService(new UniqueServiceImpl());
    factory.processRouteCollections(graph);

    RouteCollectionEntry routeEntryA = graph.getRouteCollectionForId(routeA.getId());
    assertEquals(routeA.getId(), routeEntryA.getId());
    List<RouteEntry> routes = routeEntryA.getChildren();
    assertEquals(1, routes.size());
    assertTrue(routes.contains(routeA));

    RouteCollectionEntry routeEntryB = graph.getRouteCollectionForId(routeB.getId());
    assertEquals(routeB.getId(), routeEntryB.getId());
    routes = routeEntryB.getChildren();
    assertEquals(1, routes.size());
    assertTrue(routes.contains(routeB));

    List<RouteCollectionEntry> routeCollections = graph.getAllRouteCollections();
View Full Code Here

    AgencyEntryImpl agency = new AgencyEntryImpl();
    agency.setId("A");
    graph.putAgencyEntry(agency);
    graph.refreshAgencyMapping();

    RouteEntryImpl routeA = new RouteEntryImpl();
    routeA.setId(new AgencyAndId("A", "routeA"));
    graph.putRouteEntry(routeA);

    RouteEntryImpl routeB = new RouteEntryImpl();
    routeB.setId(new AgencyAndId("A", "routeB"));
    graph.putRouteEntry(routeB);

    GtfsRelationalDao gtfsDao = Mockito.mock(GtfsRelationalDao.class);

    Route rA = new Route();
    rA.setId(routeA.getId());
    rA.setShortName("10");
    Mockito.when(gtfsDao.getRouteForId(routeA.getId())).thenReturn(rA);

    Route rB = new Route();
    rB.setId(routeB.getId());
    rB.setShortName("10");
    Mockito.when(gtfsDao.getRouteForId(routeB.getId())).thenReturn(rB);

    RouteCollectionEntriesFactory factory = new RouteCollectionEntriesFactory();
    factory.setGroupRoutesByShortName(true);

    factory.setGtfsDao(gtfsDao);
View Full Code Here

    graph.putStopEntry(stop("stopA", 47.672207391799056, -122.387855896286));

    graph.putStopEntry(stop("stopB", 47.66852277218285, -122.3853882639923));

    RouteEntryImpl routeEntry = route("routeA");
    graph.putRouteEntry(routeEntry);

    graph.initialize();

    ShapePointsFactory shapePointsFactory = new ShapePointsFactory();
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.impl.transit_graph.RouteEntryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.