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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations