use of org.onebusaway.gtfs.model.AgencyAndId in project onebusaway-gtfs-modules by OneBusAway.
the class CalendarSimplicationStrategyTest method testBasicSimplification.
@Test
public void testBasicSimplification() {
_gtfs.putAgencies(1);
_gtfs.putStops(1);
_gtfs.putRoutes(1);
_gtfs.putTrips(1, "r0", "sid0");
_gtfs.putStopTimes("t0", "s0");
_gtfs.putCalendars(1, "start_date=20120903", "end_date=20120916");
_gtfs.putCalendarDates("sid0=20120917,20120918,20120919,20120920,20120921,20120922,20120923");
GtfsRelationalDao dao = transform();
AgencyAndId serviceId = new AgencyAndId("a0", "sid0");
ServiceCalendar c = dao.getCalendarForServiceId(serviceId);
assertEquals(new ServiceDate(2012, 9, 3), c.getStartDate());
assertEquals(new ServiceDate(2012, 9, 23), c.getEndDate());
List<ServiceCalendarDate> serviceDates = dao.getCalendarDatesForServiceId(serviceId);
assertEquals(0, serviceDates.size());
}
use of org.onebusaway.gtfs.model.AgencyAndId in project onebusaway-gtfs-modules by OneBusAway.
the class ServiceCalendarDateComparator method compare.
@Override
public int compare(ServiceCalendarDate o1, ServiceCalendarDate o2) {
AgencyAndId id1 = o1.getServiceId();
AgencyAndId id2 = o2.getServiceId();
int c = id1.compareTo(id2);
if (c != 0)
return c;
ServiceDate d1 = o1.getDate();
ServiceDate d2 = o2.getDate();
return d1.compareTo(d2);
}
use of org.onebusaway.gtfs.model.AgencyAndId in project onebusaway-gtfs-modules by OneBusAway.
the class GtfsTransformerTest method testUpdateTrips.
@Test
public void testUpdateTrips() throws Exception {
GtfsRelationalDao dao = transform("{'op':'update', 'match':{'file':'trips.txt', 'route_id':'r0'}, 'update':{'route_id': 'r1'}}");
assertEquals(2, dao.getTripsForRoute(dao.getRouteForId(new AgencyAndId("a0", "r1"))).size());
}
use of org.onebusaway.gtfs.model.AgencyAndId in project onebusaway-gtfs-modules by OneBusAway.
the class GtfsTransformerTest method testRetainCalendarCollection.
@Test
public void testRetainCalendarCollection() throws Exception {
GtfsRelationalDao dao = transform("{'op':'retain', 'match':{'collection':'calendar', 'service_id':'sid1'}}");
assertNull(dao.getCalendarForServiceId(new AgencyAndId("a0", "sid0")));
assertNull(dao.getTripForId(new AgencyAndId("a0", "t0")));
}
use of org.onebusaway.gtfs.model.AgencyAndId in project onebusaway-gtfs-modules by OneBusAway.
the class GtfsTransformerTest method testRemoveRoute.
@Test
public void testRemoveRoute() throws Exception {
GtfsRelationalDao dao = transform("{'op':'remove', 'match':{'file':'routes.txt', 'route_id':'r0'}}");
assertNull(dao.getRouteForId(new AgencyAndId("a0", "r0")));
assertNotNull(dao.getRouteForId(new AgencyAndId("a0", "r1")));
assertNull(dao.getTripForId(new AgencyAndId("a0", "t0")));
assertNotNull(dao.getTripForId(new AgencyAndId("a0", "t1")));
assertEquals(2, dao.getAllStopTimes().size());
}
Aggregations