Skip to content

Commit

Permalink
Merge branch 'master' into 1640-add-GtfsNetworkSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
jcpitre authored Jan 25, 2024
2 parents 3090532 + a734495 commit dab9f0b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ private void loadSpecFeaturesBasedOnFilePresence(GtfsFeedContainer feedContainer
}

private void loadSpecFeaturesBasedOnFieldPresence(GtfsFeedContainer feedContainer) {
loadRouteNamesComponent(feedContainer);
loadRouteColorsComponent(feedContainer);
loadAgencyInformationComponent(feedContainer);
loadHeadsignsComponent(feedContainer);
loadWheelchairAccessibilityComponent(feedContainer);
loadTTSComponent(feedContainer);
Expand Down Expand Up @@ -297,17 +295,6 @@ private void loadHeadsignsComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsStopTime, Boolean>) GtfsStopTime::hasStopHeadsign)));
}

private void loadAgencyInformationComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Agency Information",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsAgency.FILENAME,
List.of(
GtfsAgency::hasAgencyEmail,
(Function<GtfsAgency, Boolean>) GtfsAgency::hasAgencyPhone)));
}

private void loadRouteColorsComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Route Colors",
Expand All @@ -321,17 +308,6 @@ private void loadRouteColorsComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsRoute, Boolean>) GtfsRoute::hasRouteTextColor)));
}

private void loadRouteNamesComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Route Names",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsRoute.FILENAME,
List.of(
GtfsRoute::hasRouteShortName,
(Function<GtfsRoute, Boolean>) GtfsRoute::hasRouteLongName)));
}

private void loadZoneBasedComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Zone-Based Fares", hasAtLeastOneRecordInFile(feedContainer, GtfsArea.FILENAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,58 +68,6 @@ private void validateSpecFeature(
}
}

@Test
public void containsRouteNamesComponentTest() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,Short Name,Long Name,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
true,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsRouteNamesComponentTest1() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,,,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsRouteNamesComponentTest2() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,Short Name,,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsRouteNamesComponentTest3() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,,Long Name,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
/**
* This method is to test when both route_color and route_text_color are present in routes.txt,
Expand Down Expand Up @@ -248,10 +196,6 @@ public void omitsComponents() throws IOException, InterruptedException {
"Pathways (basic)",
false,
ImmutableList.of(GtfsPathwayTableDescriptor.class, GtfsAgencyTableDescriptor.class));
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
validateSpecFeature(
"Shapes",
false,
Expand Down Expand Up @@ -423,48 +367,6 @@ public void omitsZoneBasedFaresComponentTest() throws IOException, InterruptedEx
ImmutableList.of(GtfsStopAreaTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void containsAgencyInformationComponent() throws IOException, InterruptedException {
tmpDir.delete();
rootDir = tmpDir.newFolder("data");
String agencyContent =
"agency_id, agency_name, agency_url, agency_timezone, agency_phone, agency_email\n"
+ "1, name, https://dummy.ca, America/Los_Angeles, 1234567890, [email protected]\n";
createDataFile(GtfsAgency.FILENAME, agencyContent);
validateSpecFeature(
"Agency Information", true, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsAgencyInformationComponent1() throws IOException, InterruptedException {
tmpDir.delete();
rootDir = tmpDir.newFolder("data");
String agencyContent =
"agency_id, agency_name, agency_url, agency_timezone, agency_phone, agency_email\n"
+ "1, name, https://dummy.ca, America/Los_Angeles, , [email protected]\n";
createDataFile(GtfsAgency.FILENAME, agencyContent);
validateSpecFeature(
"Agency Information", false, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsAgencyInformationComponent2() throws IOException, InterruptedException {
tmpDir.delete();
rootDir = tmpDir.newFolder("data");
String agencyContent =
"agency_id, agency_name, agency_url, agency_timezone, agency_phone, agency_email\n"
+ "1, name, https://dummy.ca, America/Los_Angeles, 1234567890, \n";
createDataFile(GtfsAgency.FILENAME, agencyContent);
validateSpecFeature(
"Agency Information", false, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsAgencyInformationComponent3() throws IOException, InterruptedException {
validateSpecFeature(
"Agency Information", false, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void containsHeadsignsComponent1() throws IOException, InterruptedException {
String content = "route_id, service_id, trip_id, trip_headsign\n" + "1, 2, 3, headsign_dummy\n";
Expand Down

0 comments on commit dab9f0b

Please sign in to comment.