use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.
the class TestHopFactory method setUp.
public void setUp() throws Exception {
GtfsContext context = contextBuilder(ConstantsForTests.FAKE_GTFS).build();
graph = new Graph();
GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
factory.run(graph);
graph.putService(CalendarServiceData.class, context.getCalendarServiceData());
feedId = context.getFeedId().getId();
}
use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.
the class TimetableSnapshotSourceTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
// The ".turnOnSetAgencyToFeedIdForAllElements()" is commented out so it can be
// removed from the code, it in no longer in use. It is not deleted here to better
// allow the reader of the test understand how the test once worked. There should
// be new test to replace this one.
context = contextBuilder(ConstantsForTests.FAKE_GTFS).withIssueStoreAndDeduplicator(graph).build();
feedId = context.getFeedId().getId();
GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
factory.run(graph);
graph.index();
final TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder();
tripDescriptorBuilder.setTripId("1.1");
tripDescriptorBuilder.setScheduleRelationship(TripDescriptor.ScheduleRelationship.CANCELED);
final TripUpdate.Builder tripUpdateBuilder = TripUpdate.newBuilder();
tripUpdateBuilder.setTrip(tripDescriptorBuilder);
cancellation = tripUpdateBuilder.build().toByteArray();
}
use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.
the class TestFares method testKCM.
public void testKCM() throws Exception {
Graph gg = new Graph();
GtfsContext context = contextBuilder(ConstantsForTests.KCM_GTFS).build();
GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
factory.setFareServiceFactory(new SeattleFareServiceFactory());
factory.run(gg);
gg.putService(CalendarServiceData.class, context.getCalendarServiceData());
RoutingRequest options = new RoutingRequest();
String feedId = gg.getFeedIds().iterator().next();
String vertex0 = feedId + ":2010";
String vertex1 = feedId + ":2140";
ShortestPathTree spt;
GraphPath path = null;
FareService fareService = gg.getService(FareService.class);
options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2016, 5, 24, 5, 0, 0);
options.setRoutingContext(gg, vertex0, vertex1);
spt = aStar.getShortestPathTree(options);
path = spt.getPath(gg.getVertex(vertex1), true);
// was: fareService.getCost(path);
Fare costOffPeak = null;
assertEquals(costOffPeak.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 250));
long onPeakStartTime = TestUtils.dateInSeconds("America/Los_Angeles", 2016, 5, 24, 8, 0, 0);
options.dateTime = onPeakStartTime;
options.setRoutingContext(gg, vertex0, vertex1);
spt = aStar.getShortestPathTree(options);
path = spt.getPath(gg.getVertex(vertex1), true);
// was: fareService.getCost(path);
Fare costOnPeak = null;
assertEquals(costOnPeak.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 275));
}
use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.
the class TestFares method testBasic.
public void testBasic() throws Exception {
Graph gg = new Graph();
GtfsContext context = contextBuilder(ConstantsForTests.CALTRAIN_GTFS).build();
GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
factory.run(gg);
gg.putService(CalendarServiceData.class, context.getCalendarServiceData());
RoutingRequest options = new RoutingRequest();
String feedId = gg.getFeedIds().iterator().next();
options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 8, 7, 12, 0, 0);
options.setRoutingContext(gg, feedId + ":Millbrae Caltrain", feedId + ":Mountain View Caltrain");
ShortestPathTree spt;
GraphPath path = null;
spt = aStar.getShortestPathTree(options);
path = spt.getPath(gg.getVertex(feedId + ":Mountain View Caltrain"), true);
FareService fareService = gg.getService(FareService.class);
// was: fareService.getCost(path);
Fare cost = null;
assertEquals(cost.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 425));
}
use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.
the class TestGraphPath method setUp.
public void setUp() throws Exception {
GtfsContext context = contextBuilder(ConstantsForTests.FAKE_GTFS).build();
graph = new Graph();
GeometryAndBlockProcessor hl = new GeometryAndBlockProcessor(context);
hl.run(graph);
graph.putService(CalendarServiceData.class, context.getCalendarServiceData());
}
Aggregations