Search in sources :

Example 71 with Route

use of org.onebusaway.gtfs.model.Route in project onebusaway-gtfs-modules by OneBusAway.

the class HibernateGtfsRelationalDaoImplCaltrainTest method testGetRouteById.

@Test
public void testGetRouteById() {
    Route route = _dao.getRouteForId(aid("ct_bullet"));
    assertEquals(aid("ct_bullet"), route.getId());
    assertEquals("Bullet", route.getLongName());
    assertEquals(2, route.getType());
    assertEquals(null, route.getColor());
    assertEquals("ff0000", route.getTextColor());
    assertEquals(null, route.getUrl());
}
Also used : Route(org.onebusaway.gtfs.model.Route) Test(org.junit.Test)

Example 72 with Route

use of org.onebusaway.gtfs.model.Route in project onebusaway-gtfs-modules by OneBusAway.

the class HibernateGtfsRelationalDaoImplCaltrainTest method testGetTripsForRoute.

@Test
public void testGetTripsForRoute() {
    Route route = _dao.getRouteForId(aid("ct_local"));
    List<Trip> tripsForRoute = _dao.getTripsForRoute(route);
    assertEquals(120, tripsForRoute.size());
}
Also used : Trip(org.onebusaway.gtfs.model.Trip) Route(org.onebusaway.gtfs.model.Route) Test(org.junit.Test)

Example 73 with Route

use of org.onebusaway.gtfs.model.Route in project onebusaway-gtfs-modules by OneBusAway.

the class HibernateGtfsRelationalDaoImplCaltrainTest method testGetTripById.

@Test
public void testGetTripById() {
    Route route = _dao.getRouteForId(aid("ct_local"));
    Trip trip = _dao.getTripForId(aid("10101272009"));
    assertEquals(aid("10101272009"), trip.getId());
    assertNull(trip.getBlockId());
    assertEquals("0", trip.getDirectionId());
    assertEquals(route, trip.getRoute());
    assertNull(trip.getRouteShortName());
    assertEquals(aid("WD01272009"), trip.getServiceId());
    assertEquals(aid("cal_sj_sf"), trip.getShapeId());
    assertEquals("101", trip.getTripShortName());
    assertEquals("San Jose to San Francisco", trip.getTripHeadsign());
}
Also used : Trip(org.onebusaway.gtfs.model.Trip) Route(org.onebusaway.gtfs.model.Route) Test(org.junit.Test)

Example 74 with Route

use of org.onebusaway.gtfs.model.Route in project onebusaway-gtfs-modules by OneBusAway.

the class LongRouteDescriptionTest method testGetRouteById.

/**
 **
 * {@link Route} Methods
 ***
 */
@Test
public void testGetRouteById() {
    Route route = _dao.getRouteForId(aid("ct_bullet"));
    assertEquals(aid("ct_bullet"), route.getId());
    assertEquals("Bullet", route.getLongName());
    assertEquals(2, route.getType());
    assertEquals(null, route.getColor());
    assertEquals("ff0000", route.getTextColor());
    assertEquals(null, route.getUrl());
    // Long route description
    assertEquals(406, route.getDesc().length());
}
Also used : Route(org.onebusaway.gtfs.model.Route) Test(org.junit.Test)

Example 75 with Route

use of org.onebusaway.gtfs.model.Route in project onebusaway-gtfs-modules by OneBusAway.

the class TransformFactoryTest method test.

@Test
public void test() throws IOException, TransformSpecificationException {
    _factory.addModificationsFromString("{'op':'remove', 'match':{'class':'Route', 'shortName':'10'}}");
    GtfsTransformStrategy transform = _transformer.getLastTransform();
    assertEquals(EntitiesTransformStrategy.class, transform.getClass());
    EntitiesTransformStrategy strategy = (EntitiesTransformStrategy) transform;
    List<MatchAndTransform> transforms = strategy.getModifications();
    assertEquals(1, transforms.size());
    MatchAndTransform pair = transforms.get(0);
    EntityMatch match = pair.getMatch();
    Route route = new Route();
    assertFalse(match.isApplicableToObject(route));
    route.setShortName("10");
    assertTrue(match.isApplicableToObject(route));
    EntityTransformStrategy entityTransform = pair.getTransform();
    assertEquals(RemoveEntityUpdateStrategy.class, entityTransform.getClass());
}
Also used : EntityTransformStrategy(org.onebusaway.gtfs_transformer.services.EntityTransformStrategy) MatchAndTransform(org.onebusaway.gtfs_transformer.factory.EntitiesTransformStrategy.MatchAndTransform) GtfsTransformStrategy(org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy) EntityMatch(org.onebusaway.gtfs_transformer.match.EntityMatch) Route(org.onebusaway.gtfs.model.Route) Test(org.junit.Test)

Aggregations

Route (org.onebusaway.gtfs.model.Route)90 Trip (org.onebusaway.gtfs.model.Trip)52 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)46 Test (org.junit.Test)33 Stop (org.onebusaway.gtfs.model.Stop)28 Agency (org.onebusaway.gtfs.model.Agency)21 ArrayList (java.util.ArrayList)16 StopTime (org.onebusaway.gtfs.model.StopTime)14 TripPattern (org.opentripplanner.routing.edgetype.TripPattern)14 TransitStop (org.opentripplanner.routing.vertextype.TransitStop)12 HashMap (java.util.HashMap)10 Edge (org.opentripplanner.routing.graph.Edge)8 GET (javax.ws.rs.GET)7 Path (javax.ws.rs.Path)7 ServiceDate (org.onebusaway.gtfs.model.calendar.ServiceDate)7 TransitGraphImpl (org.onebusaway.transit_data_federation.impl.transit_graph.TransitGraphImpl)7 List (java.util.List)6 RouteEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.RouteEntryImpl)6 TripEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.TripEntryImpl)6 Coordinate (com.vividsolutions.jts.geom.Coordinate)5