use of org.opentripplanner.graph_builder.module.GtfsFeedId in project OpenTripPlanner by opentripplanner.
the class GTFSPatternHopFactoryTest method testBikesAllowed.
@Test
public void testBikesAllowed() throws IOException {
MockGtfs gtfs = MockGtfs.create();
gtfs.putAgencies(1);
gtfs.putRoutes(1);
gtfs.putStops(2);
gtfs.putCalendars(1);
gtfs.putTrips(1, "r0", "sid0", "bikes_allowed=1");
gtfs.putStopTimes("t0", "s0,s1");
gtfs.putLines("frequencies.txt", "trip_id,start_time,end_time,headway_secs", "t0,09:00:00,17:00:00,300");
GtfsFeedId feedId = new GtfsFeedId.Builder().id("FEED").build();
GTFSPatternHopFactory factory = new GTFSPatternHopFactory(GtfsLibrary.createContext(feedId, gtfs.read()));
Graph graph = new Graph();
factory.run(graph);
for (Edge edge : graph.getEdges()) {
if (edge instanceof TransitBoardAlight) {
TripPattern pattern = ((TransitBoardAlight) edge).getPattern();
// TODO assertTrue(pattern.getBikesAllowed());
}
}
}
use of org.opentripplanner.graph_builder.module.GtfsFeedId in project OpenTripPlanner by opentripplanner.
the class GtfsLibrary method readGtfs.
public static GtfsContext readGtfs(File path) throws IOException {
GtfsRelationalDaoImpl dao = new GtfsRelationalDaoImpl();
GtfsReader reader = new GtfsReader();
reader.setInputLocation(path);
reader.setEntityStore(dao);
GtfsFeedId feedId = new GtfsFeedId.Builder().fromGtfsFeed(reader.getInputSource()).build();
reader.setDefaultAgencyId(feedId.getId());
reader.run();
CalendarService calendarService = createCalendarService(dao);
return new GtfsContextImpl(feedId, dao, calendarService);
}
Aggregations