Search in sources :

Example 1 with GtfsContextBuilder

use of org.opentripplanner.gtfs.GtfsContextBuilder in project OpenTripPlanner by opentripplanner.

the class GeometryAndBlockProcessorTest 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();
    Graph graph = new Graph();
    GtfsContext context = new GtfsContextBuilder(feedId, gtfs.read()).withIssueStoreAndDeduplicator(graph).build();
    GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
    factory.run(graph);
}
Also used : Graph(org.opentripplanner.routing.graph.Graph) GtfsFeedId(org.opentripplanner.graph_builder.module.GtfsFeedId) GtfsContext(org.opentripplanner.gtfs.GtfsContext) MockGtfs(org.opentripplanner.gtfs.MockGtfs) GtfsContextBuilder(org.opentripplanner.gtfs.GtfsContextBuilder) GtfsContextBuilder(org.opentripplanner.gtfs.GtfsContextBuilder) Test(org.junit.Test)

Example 2 with GtfsContextBuilder

use of org.opentripplanner.gtfs.GtfsContextBuilder in project OpenTripPlanner by opentripplanner.

the class OtpTransitServiceImplTest method setup.

@BeforeClass
public static void setup() throws IOException {
    GtfsContextBuilder contextBuilder = contextBuilder(FEED_ID, ConstantsForTests.FAKE_GTFS);
    OtpTransitServiceBuilder builder = contextBuilder.getTransitBuilder();
    agency = first(builder.getAgenciesById().values());
    // Supplement test data with at least one entity in all collections
    FareRule rule = createFareRule();
    builder.getFareAttributes().add(rule.getFare());
    builder.getFareRules().add(rule);
    builder.getFeedInfos().add(new FeedInfo());
    subject = builder.build();
}
Also used : GtfsContextBuilder(org.opentripplanner.gtfs.GtfsContextBuilder) FareRule(org.opentripplanner.model.FareRule) FeedInfo(org.opentripplanner.model.FeedInfo) BeforeClass(org.junit.BeforeClass)

Example 3 with GtfsContextBuilder

use of org.opentripplanner.gtfs.GtfsContextBuilder in project OpenTripPlanner by opentripplanner.

the class CalendarServiceDataFactoryImplTest method createCtxBuilder.

private static GtfsContext createCtxBuilder() throws IOException {
    GtfsContextBuilder ctxBuilder = contextBuilder(FEED_ID, ConstantsForTests.FAKE_GTFS);
    OtpTransitServiceBuilder builder = ctxBuilder.withDataImportIssueStore(new DataImportIssueStore(false)).getTransitBuilder();
    Agency agency = agency(builder);
    // Supplement test data with at least one entity in all collections
    builder.getCalendarDates().add(removeMondayFromAlldays());
    builder.getFareAttributes().add(createFareAttribute(agency));
    builder.getFareRules().add(new FareRule());
    builder.getFeedInfos().add(new FeedInfo());
    return ctxBuilder.build();
}
Also used : OtpTransitServiceBuilder(org.opentripplanner.model.impl.OtpTransitServiceBuilder) Agency(org.opentripplanner.model.Agency) GtfsContextBuilder(org.opentripplanner.gtfs.GtfsContextBuilder) FareRule(org.opentripplanner.model.FareRule) FeedInfo(org.opentripplanner.model.FeedInfo) DataImportIssueStore(org.opentripplanner.graph_builder.DataImportIssueStore)

Aggregations

GtfsContextBuilder (org.opentripplanner.gtfs.GtfsContextBuilder)3 FareRule (org.opentripplanner.model.FareRule)2 FeedInfo (org.opentripplanner.model.FeedInfo)2 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 DataImportIssueStore (org.opentripplanner.graph_builder.DataImportIssueStore)1 GtfsFeedId (org.opentripplanner.graph_builder.module.GtfsFeedId)1 GtfsContext (org.opentripplanner.gtfs.GtfsContext)1 MockGtfs (org.opentripplanner.gtfs.MockGtfs)1 Agency (org.opentripplanner.model.Agency)1 OtpTransitServiceBuilder (org.opentripplanner.model.impl.OtpTransitServiceBuilder)1 Graph (org.opentripplanner.routing.graph.Graph)1