Search in sources :

Example 6 with ServiceCalendarDate

use of org.opentripplanner.model.calendar.ServiceCalendarDate in project OpenTripPlanner by opentripplanner.

the class OtpTransitServiceBuilderLimitPeriodTest method setUp.

@Before
public void setUp() {
    subject = new OtpTransitServiceBuilder();
    // Add a service calendar that overlap with the period limit
    subject.getCalendars().add(createServiceCalendar(SERVICE_C_IN, D1, D3));
    // Add a service calendar that is outside the period limit, expected deleted later
    subject.getCalendars().add(createServiceCalendar(SERVICE_C_OUT, D0, D1));
    // Add a service calendar date that is within the period limit
    subject.getCalendarDates().add(new ServiceCalendarDate(SERVICE_D_IN, D2, 1));
    // Add a service calendar date that is OUTSIDE the period limit, expected deleted later
    subject.getCalendarDates().add(new ServiceCalendarDate(SERVICE_D_OUT, D1, 1));
    // Add 2 stops
    subject.getStops().add(STOP_1);
    subject.getStops().add(STOP_2);
    // Add Route
    route.setId(newId());
    route.setType(3);
    route.setMode(TransitMode.BUS);
    subject.getRoutes().add(route);
    // Add trips; one for each day and calendar
    subject.getTripsById().addAll(List.of(tripCSIn, tripCSOut, tripCSDIn, tripCSDOut));
    // Pattern with trips that is partially deleted later
    patternInT1 = createTripPattern(List.of(tripCSIn, tripCSOut));
    // Pattern with trip that is inside period
    patternInT2 = createTripPattern(List.of(tripCSDIn));
    // Pattern with trip outside limiting period - pattern is deleted later
    TripPattern patternOut = createTripPattern(List.of(tripCSDOut));
    subject.getTripPatterns().put(STOP_PATTERN, patternInT1);
    subject.getTripPatterns().put(STOP_PATTERN, patternInT2);
    subject.getTripPatterns().put(STOP_PATTERN, patternOut);
}
Also used : ServiceCalendarDate(org.opentripplanner.model.calendar.ServiceCalendarDate) TripPattern(org.opentripplanner.model.TripPattern) Before(org.junit.Before)

Aggregations

ServiceCalendarDate (org.opentripplanner.model.calendar.ServiceCalendarDate)6 ServiceCalendar (org.opentripplanner.model.calendar.ServiceCalendar)3 ServiceDate (org.opentripplanner.model.calendar.ServiceDate)3 TripPattern (org.opentripplanner.model.TripPattern)2 DayTypeRefsToServiceIdAdapter (org.opentripplanner.netex.support.DayTypeRefsToServiceIdAdapter)2 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 Calendar (java.util.Calendar)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Before (org.junit.Before)1 Test (org.junit.Test)1 DataImportIssue (org.opentripplanner.graph_builder.DataImportIssue)1 DataImportIssueStore (org.opentripplanner.graph_builder.DataImportIssueStore)1 ServiceCodeDoesNotContainServiceDates (org.opentripplanner.graph_builder.issues.ServiceCodeDoesNotContainServiceDates)1 FeedScopedId (org.opentripplanner.model.FeedScopedId)1