Examples of GtfsRelationalDao


Examples of org.onebusaway.gtfs.services.GtfsRelationalDao

  @Test
  public void test() {

    ShapePointHelper helper = new ShapePointHelper();

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

    AgencyAndId shapeId = new AgencyAndId("1", "shapeA");

    ShapePoint p1 = point(47.652300128129454, -122.30622018270873);
    ShapePoint p2 = point(47.653181844549394, -122.30523312979125);
    ShapePoint p3 = point(47.654265901710744, -122.30511511259459);
    List<ShapePoint> points = Arrays.asList(p1, p2, p3);

    Mockito.when(gtfsDao.getShapePointsForShapeId(shapeId)).thenReturn(points);

    ShapePoints shapePoints = helper.getShapePointsForShapeId(shapeId);

    assertEquals(3, shapePoints.getSize());
    for (int i = 0; i < 3; i++) {
View Full Code Here

Examples of org.onebusaway.gtfs.services.GtfsRelationalDao

    stopB.setLat(47.1);
    stopB.setLon(-122.1);
    stopB.setLocationType(0);
    stopB.setName("Stop B");

    GtfsRelationalDao dao = Mockito.mock(GtfsRelationalDao.class);
    Mockito.when(dao.getAllStops()).thenReturn(Arrays.asList(stopA, stopB));

    StopEntriesFactory factory = new StopEntriesFactory();
    factory.setGtfsDao(dao);

    TransitGraphImpl graph = new TransitGraphImpl();
View Full Code Here

Examples of org.onebusaway.gtfs.services.GtfsRelationalDao

    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());
View Full Code Here

Examples of org.onebusaway.gtfs.services.GtfsRelationalDao

    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

Examples of org.onebusaway.gtfs.services.GtfsRelationalDao

public class TripEntriesFactoryTest {

  @Test
  public void test() {

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

    Agency agency = new Agency();
    agency.setId("1");
    agency.setTimezone("America/Los_Angeles");
    // gtfsDao.saveEntity(agency);

    Route route = new Route();
    route.setId(new AgencyAndId("1", "routeA"));
    route.setAgency(agency);
    Mockito.when(gtfsDao.getAllRoutes()).thenReturn(Arrays.asList(route));

    AgencyAndId shapeId = new AgencyAndId("1", "shapeId");

    Trip trip = new Trip();
    trip.setId(new AgencyAndId("1", "tripA"));
    trip.setRoute(route);
    trip.setServiceId(new AgencyAndId("1", "serviceId"));
    trip.setShapeId(shapeId);
    Mockito.when(gtfsDao.getTripsForRoute(route)).thenReturn(
        Arrays.asList(trip));

    Stop stopA = new Stop();
    stopA.setId(aid("stopA"));

    StopTime stA = new StopTime();
    stA.setId(100);
    stA.setArrivalTime(time(9, 00));
    stA.setDepartureTime(time(9, 05));
    stA.setStopSequence(100);
    stA.setStop(stopA);
    stA.setTrip(trip);

    Stop stopB = new Stop();
    stopB.setId(aid("stopB"));

    StopTime stB = new StopTime();
    stB.setId(101);
    stB.setArrivalTime(time(10, 00));
    stB.setDepartureTime(time(10, 05));
    stB.setStopSequence(102);
    stB.setStop(stopB);
    stB.setTrip(trip);

    Mockito.when(gtfsDao.getStopTimesForTrip(trip)).thenReturn(
        Arrays.asList(stA, stB));

    TransitGraphImpl graph = new TransitGraphImpl();

    graph.putStopEntry(stop("stopA", 47.672207391799056, -122.387855896286));
View Full Code Here

Examples of org.onebusaway.gtfs.services.GtfsRelationalDao

public class AgencyEntriesFactoryTest {

  @Test
  public void testProcessAgencies() {

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

    Agency agencyA = new Agency();
    agencyA.setId("A");

    Agency agencyB = new Agency();
    agencyB.setId("B");

    Mockito.when(gtfsDao.getAllAgencies()).thenReturn(
        Arrays.asList(agencyA, agencyB));

    TransitGraphImpl graph = new TransitGraphImpl();

    AgencyEntriesFactory factory = new AgencyEntriesFactory();
View Full Code Here

Examples of org.onebusaway.gtfs.services.GtfsRelationalDao

public class RouteEntriesFactoryTest {

  @Test
  public void testProcessRoutes() {

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

    Agency agency = new Agency();
    agency.setId("A");

    Route routeA = new Route();
    routeA.setAgency(agency);
    routeA.setId(new AgencyAndId("A", "routeA"));

    Route routeB = new Route();
    routeB.setAgency(agency);
    routeB.setId(new AgencyAndId("A", "routeB"));

    Mockito.when(gtfsDao.getAllRoutes()).thenReturn(
        Arrays.asList(routeA, routeB));

    TransitGraphImpl graph = new TransitGraphImpl();

    RouteEntriesFactory factory = new RouteEntriesFactory();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.