@@ -231,6 +231,7 @@ void canMergeRegionalWithOnlyCalendarFeed () throws SQLException {
231
231
versions .add (onlyCalendarVersion );
232
232
FeedVersion mergedVersion = regionallyMergeVersions (versions );
233
233
SqlAssert sqlAssert = new SqlAssert (mergedVersion );
234
+ sqlAssert .assertNoRefIntegrityErrors ();
234
235
235
236
// - calendar table should have 2 records.
236
237
sqlAssert .calendar .assertCount (2 );
@@ -416,15 +417,15 @@ void mergeMTCShouldHandleMatchingTripIdsAndDropUnusedFutureCalendar() throws Exc
416
417
sqlAssert .calendarDates .assertCount (5 );
417
418
// - only_calendar_id:
418
419
// 1 from future feed (that service id is not scoped),
419
- sqlAssert .calendarDates .assertCount (1 , "service_id = 'only_calendar_id'" );
420
+ sqlAssert .calendarDates .assertCount (1 , "service_id= 'only_calendar_id'" );
420
421
// 0 from active feed
421
422
// (in the active feed, that service id starts after the future feed start date)
422
- sqlAssert .calendarDates .assertCount (0 , "service_id = 'Fake_Transit1:dropped_calendar_id'" );
423
+ sqlAssert .calendarDates .assertCount (0 , "service_id= 'Fake_Transit1:dropped_calendar_id'" );
423
424
// - common_id:
424
425
// 2 from active feed for the calendar item that was extended due to shared trip,
425
- sqlAssert .calendarDates .assertCount (2 , "service_id = 'Fake_Transit7:common_id'" );
426
+ sqlAssert .calendarDates .assertCount (2 , "service_id= 'Fake_Transit7:common_id'" );
426
427
// 2 from active feed for the active trip not in the future feed.
427
- sqlAssert .calendarDates .assertCount (2 , "service_id = 'Fake_Transit1:common_id'" );
428
+ sqlAssert .calendarDates .assertCount (2 , "service_id= 'Fake_Transit1:common_id'" );
428
429
429
430
// The GTFS+ calendar_attributes table should contain the same number of entries as the calendar table
430
431
// (reported by MTC).
@@ -505,6 +506,7 @@ void mergeMTCShouldHandleDisjointTripIds() throws SQLException {
505
506
);
506
507
507
508
SqlAssert sqlAssert = new SqlAssert (mergeFeedsJob .mergedVersion );
509
+ sqlAssert .assertNoRefIntegrityErrors ();
508
510
509
511
// calendar table should have 4 records
510
512
// - 2 records from future feed, including only_calendar_dates which absorbs its active counterpart,
@@ -613,6 +615,7 @@ void canMergeFeedsWithMTCForServiceIds1 () throws SQLException {
613
615
mergeFeedsJob .run ();
614
616
assertFeedMergeSucceeded (mergeFeedsJob );
615
617
SqlAssert sqlAssert = new SqlAssert (mergeFeedsJob .mergedVersion );
618
+ sqlAssert .assertNoRefIntegrityErrors ();
616
619
617
620
// - calendar table should have 4 records.
618
621
sqlAssert .calendar .assertCount (4 );
@@ -663,6 +666,7 @@ void canMergeFeedsWithMTCForServiceIds2 () throws SQLException {
663
666
mergeFeedsJob .run ();
664
667
assertFeedMergeSucceeded (mergeFeedsJob );
665
668
SqlAssert sqlAssert = new SqlAssert (mergeFeedsJob .mergedVersion );
669
+ sqlAssert .assertNoRefIntegrityErrors ();
666
670
667
671
// - calendar table should have 2 records.
668
672
sqlAssert .calendar .assertCount (2 );
@@ -710,6 +714,7 @@ void canMergeFeedsWithMTCForServiceIds3 () throws SQLException {
710
714
mergeFeedsJob .run ();
711
715
assertFeedMergeSucceeded (mergeFeedsJob );
712
716
SqlAssert sqlAssert = new SqlAssert (mergeFeedsJob .mergedVersion );
717
+ sqlAssert .assertNoRefIntegrityErrors ();
713
718
714
719
// - calendar table should have 3 records.
715
720
sqlAssert .calendar .assertCount (3 );
@@ -720,23 +725,23 @@ void canMergeFeedsWithMTCForServiceIds3 () throws SQLException {
720
725
// within the future feed timespan.
721
726
sqlAssert .calendarDates .assertCount (1 , "service_id='common_id' and date='20170916'" );
722
727
723
- // - trips table should have 3 records.
724
- sqlAssert .trips .assertCount (3 );
728
+ // trips table should have 2 records.
729
+ // - this includes all trips from both feed except the trip associated
730
+ // with cal_to_remove, which calendar operates within the future feed.
731
+ sqlAssert .trips .assertCount (2 );
725
732
726
733
// common_id service_id should be scoped for earlier feed version.
727
734
sqlAssert .trips .assertCount (1 , "service_id='Fake_Agency4:common_id'" );
728
735
729
- // cal_to_remove service_id should be scoped for earlier feed version .
730
- sqlAssert .trips .assertCount (1 , "service_id='Fake_Agency4:cal_to_remove'" );
736
+ // trips for cal_to_remove service_id should be removed .
737
+ sqlAssert .trips .assertCount (0 , "service_id='Fake_Agency4:cal_to_remove'" );
731
738
732
739
// Amended calendar record from earlier feed version should also have a modified end date (one day before the
733
740
// earliest start_date from the future feed).
734
741
sqlAssert .calendar .assertCount (1 , "service_id='Fake_Agency4:common_id' AND end_date='20170914'" );
735
742
736
- // Modified cal_to_remove should still exist in calendar_dates. It is modified even though it does not exist in
737
- // the future feed due to the MTC requirement to update all service_ids in the active feed.
738
- // See https://github.com/ibi-group/datatools-server/issues/244
739
- sqlAssert .calendarDates .assertCount (1 , "service_id='Fake_Agency4:cal_to_remove'" );
743
+ // cal_to_remove should be removed from calendar_dates.
744
+ sqlAssert .calendarDates .assertCount (0 , "service_id='Fake_Agency4:cal_to_remove'" );
740
745
}
741
746
742
747
/**
@@ -754,6 +759,8 @@ void canMergeFeedsWithMTCForServiceIds4 () throws SQLException {
754
759
mergeFeedsJob .run ();
755
760
assertFeedMergeSucceeded (mergeFeedsJob );
756
761
SqlAssert sqlAssert = new SqlAssert (mergeFeedsJob .mergedVersion );
762
+ // FIXME: "version3" contains ref integrity errors... was hat intentional?
763
+ // sqlAssert.assertNoRefIntegrityErrors();
757
764
758
765
// - calendar table should have 3 records.
759
766
sqlAssert .calendar .assertCount (3 );
0 commit comments