use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class OtpTransitServiceImplTest method createFareRule.
private static FareRule createFareRule() {
FareAttribute fa = new FareAttribute();
fa.setId(new FeedScopedId(FEED_ID, "FA"));
FareRule rule = new FareRule();
rule.setOriginId("Zone A");
rule.setContainsId("Zone B");
rule.setDestinationId("Zone C");
rule.setFare(fa);
return rule;
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class ItineraryTest method testDerivedFieldsWithBusAllTheWay.
@Test
public void testDerivedFieldsWithBusAllTheWay() {
Itinerary result = newItinerary(TestItineraryBuilder.A).bus(55, 10, 20, 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(10), result.firstLeg().startTime);
assertEquals(newTime(20), result.firstLeg().endTime);
assertEquals(TraverseMode.BUS, result.firstLeg().mode);
assertEquals(new FeedScopedId("F", "55"), result.firstLeg().getTrip().getId());
assertEquals(7500, result.firstLeg().distanceMeters, 1E-3);
assertEquals("A ~ BUS 55 12:10 12:20 ~ B [cost: 720]", result.toStr());
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class PlaceTest method place.
private static Place place(String name, String stopId) {
Place p = new Place(null, null, name);
p.stopId = new FeedScopedId("S", stopId);
return p;
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class NetexLoaderSmokeTest method assertStations.
private void assertStations(Collection<Station> stations) {
Map<FeedScopedId, Station> map = stations.stream().collect(Collectors.toMap(Station::getId, s -> s));
Station station = map.get(fId("NSR:StopPlace:5825"));
assertEquals("Bergkrystallen T", station.getName());
assertEquals(59.866297, station.getLat(), 0.000001);
assertEquals(10.821484, station.getLon(), 0.000001);
assertEquals(5, stations.size());
}
use of org.opentripplanner.model.FeedScopedId in project OpenTripPlanner by opentripplanner.
the class NetexLoaderSmokeTest method assetServiceCalendar.
private void assetServiceCalendar(CalendarServiceData cal) {
assertEquals("[RB:RUT:Authority:RUT]", cal.getAgencyIds().toString());
assertEquals("Europe/Oslo", cal.getTimeZoneForAgencyId(new FeedScopedId("RB", "RUT:Authority:RUT")).toZoneId().toString());
assertEquals("[RUT:DayType:0-105025+RUT:DayType:0-105026+RUT:DayType:6-101468, RUT:DayType:6-101468]", cal.getServiceIds().stream().map(FeedScopedId::getId).sorted().collect(Collectors.toList()).toString());
assertEquals("[2017-12-21, 2017-12-22, 2017-12-25, 2017-12-26, 2017-12-27, 2017-12-28, 2017-12-29, 2018-01-02, 2018-01-03, 2018-01-04]", cal.getServiceDatesForServiceId(fId("RUT:DayType:6-101468")).toString());
ServiceDate DEC_29 = new ServiceDate(2017, 12, 29);
assertEquals("RUT:DayType:0-105025+RUT:DayType:0-105026+RUT:DayType:6-101468, RUT:DayType:6-101468", cal.getServiceIdsForDate(DEC_29).stream().map(FeedScopedId::getId).sorted().collect(Collectors.joining(", ")));
assertEquals(2, cal.getServiceIds().size());
assertEquals(1, cal.getAgencyIds().size());
}
Aggregations