Search in sources :

Example 41 with FeedScopedId

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;
}
Also used : FareAttribute(org.opentripplanner.model.FareAttribute) FareRule(org.opentripplanner.model.FareRule) FeedScopedId(org.opentripplanner.model.FeedScopedId)

Example 42 with FeedScopedId

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());
}
Also used : TestItineraryBuilder.newItinerary(org.opentripplanner.model.plan.TestItineraryBuilder.newItinerary) FeedScopedId(org.opentripplanner.model.FeedScopedId) Test(org.junit.Test)

Example 43 with FeedScopedId

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;
}
Also used : FeedScopedId(org.opentripplanner.model.FeedScopedId)

Example 44 with FeedScopedId

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());
}
Also used : MultiModalStation(org.opentripplanner.model.MultiModalStation) Station(org.opentripplanner.model.Station) StopTimeKey(org.opentripplanner.model.StopTimeKey) Trip(org.opentripplanner.model.Trip) MultiModalStation(org.opentripplanner.model.MultiModalStation) Multimap(com.google.common.collect.Multimap) OtpTransitServiceBuilder(org.opentripplanner.model.impl.OtpTransitServiceBuilder) ServiceDate(org.opentripplanner.model.calendar.ServiceDate) CalendarServiceData(org.opentripplanner.model.calendar.CalendarServiceData) ArrayList(java.util.ArrayList) TransitEntity(org.opentripplanner.model.TransitEntity) Map(java.util.Map) ConstantsForTests(org.opentripplanner.ConstantsForTests) DataImportIssueStore(org.opentripplanner.graph_builder.DataImportIssueStore) Assert.fail(org.junit.Assert.fail) NetexBundle(org.opentripplanner.netex.loader.NetexBundle) FeedScopedId(org.opentripplanner.model.FeedScopedId) Station(org.opentripplanner.model.Station) Operator(org.opentripplanner.model.Operator) TripPattern(org.opentripplanner.model.TripPattern) Stop(org.opentripplanner.model.Stop) Collection(java.util.Collection) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Notice(org.opentripplanner.model.Notice) Agency(org.opentripplanner.model.Agency) Collectors(java.util.stream.Collectors) Serializable(java.io.Serializable) OtpTransitService(org.opentripplanner.model.OtpTransitService) List(java.util.List) Assert.assertNull(org.junit.Assert.assertNull) Deduplicator(org.opentripplanner.routing.trippattern.Deduplicator) Assert.assertEquals(org.junit.Assert.assertEquals) FeedScopedId(org.opentripplanner.model.FeedScopedId)

Example 45 with FeedScopedId

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());
}
Also used : ServiceDate(org.opentripplanner.model.calendar.ServiceDate) FeedScopedId(org.opentripplanner.model.FeedScopedId)

Aggregations

FeedScopedId (org.opentripplanner.model.FeedScopedId)117 Trip (org.opentripplanner.model.Trip)32 Test (org.junit.Test)29 Stop (org.opentripplanner.model.Stop)25 TripPattern (org.opentripplanner.model.TripPattern)25 ServiceDate (org.opentripplanner.model.calendar.ServiceDate)21 ArrayList (java.util.ArrayList)20 Route (org.opentripplanner.model.Route)15 HashSet (java.util.HashSet)11 List (java.util.List)11 Agency (org.opentripplanner.model.Agency)11 Collection (java.util.Collection)9 Map (java.util.Map)9 Collectors (java.util.stream.Collectors)9 ZonedDateTime (java.time.ZonedDateTime)8 TransitEntity (org.opentripplanner.model.TransitEntity)8 RoutingService (org.opentripplanner.routing.RoutingService)8 TripTimes (org.opentripplanner.routing.trippattern.TripTimes)8 Notice (org.opentripplanner.model.Notice)7 Station (org.opentripplanner.model.Station)7