use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class OtpTransitServiceImplTest method testGetShapePointsForShapeId.
@Test
public void testGetShapePointsForShapeId() {
List<ShapePoint> shapePoints = subject.getShapePointsForShapeId(new FeedScopedId("Z", "5"));
assertEquals("[#1 (41,-72), #2 (41,-72), #3 (40,-72), #4 (41,-73), #5 (41,-74)]", shapePoints.stream().map(OtpTransitServiceImplTest::toString).collect(toList()).toString());
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class ItineraryTest method testDerivedFieldsWithTrainAllTheWay.
@Test
public void testDerivedFieldsWithTrainAllTheWay() {
Itinerary result = newItinerary(TestItineraryBuilder.A).rail(20, 5, 15, TestItineraryBuilder.B).build();
assertEquals(600, result.durationSeconds);
assertEquals(0, result.nTransfers);
assertEquals(720, result.generalizedCost);
assertEquals(600, result.transitTimeSeconds);
assertEquals(0, result.nonTransitTimeSeconds);
assertEquals(0, result.waitingTimeSeconds);
assertFalse(result.walkOnly);
// Expected fields on bus leg set
assertSameLocation(TestItineraryBuilder.A, result.firstLeg().from);
assertSameLocation(TestItineraryBuilder.B, result.firstLeg().to);
assertEquals(newTime(5), result.firstLeg().startTime);
assertEquals(newTime(15), result.firstLeg().endTime);
assertEquals(TraverseMode.RAIL, result.firstLeg().mode);
assertEquals(new FeedScopedId("F", "20"), result.firstLeg().getTrip().getId());
assertEquals(15_000, result.firstLeg().distanceMeters, 1E-3);
assertEquals("A ~ RAIL 20 12:05 12:15 ~ B [cost: 720]", result.toStr());
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class NetexLoaderSmokeTest method assertStops.
private void assertStops(Collection<Stop> stops) {
Map<FeedScopedId, Stop> map = stops.stream().collect(Collectors.toMap(Stop::getId, s -> s));
Stop quay = map.get(fId("NSR:Quay:122003"));
assertEquals("N/A", quay.getName());
assertEquals(59.909803, quay.getLat(), 0.000001);
assertEquals(10.748062, quay.getLon(), 0.000001);
assertEquals("RB:NSR:StopPlace:3995", quay.getParentStation().getId().toString());
assertEquals("L", quay.getCode());
assertEquals(16, stops.size());
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class NetexLoaderSmokeTest method assertTripPatterns.
private void assertTripPatterns(Collection<TripPattern> patterns) {
Map<FeedScopedId, TripPattern> map = patterns.stream().collect(Collectors.toMap(TripPattern::getId, s -> s));
TripPattern p = map.get(fId("RUT:JourneyPattern:12-1"));
assertEquals("Jernbanetorget", p.getDirection());
assertEquals("RB", p.getFeedId());
assertEquals("[<Stop RB:NSR:Quay:7203>, <Stop RB:NSR:Quay:8027>]", p.getStops().toString());
assertEquals("[<Trip RB:RUT:ServiceJourney:12-101375-1000>]", p.getTrips().toString());
// TODO OTP2 - Why?
assertNull(p.getServices());
assertEquals(4, patterns.size());
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class NetexLoaderSmokeTest method assertMultiModalStations.
private void assertMultiModalStations(Collection<MultiModalStation> multiModalStations) {
Map<FeedScopedId, MultiModalStation> map = multiModalStations.stream().collect(Collectors.toMap(MultiModalStation::getId, s -> s));
MultiModalStation multiModalStation = map.get(fId("NSR:StopPlace:58243"));
assertEquals("Bergkrystallen", multiModalStation.getName());
assertEquals(59.866603, multiModalStation.getLat(), 0.000001);
assertEquals(10.821614, multiModalStation.getLon(), 0.000001);
assertEquals(3, multiModalStations.size());
}
Aggregations